refactoring how casting works

This commit is contained in:
Seth Ladd 2009-06-09 18:02:04 -10:00
parent 209e36f61b
commit 92d7fdb94d
5 changed files with 82 additions and 59 deletions

View file

@ -43,16 +43,14 @@ describe "assigning a value to casted attribute after initializing an object" do
@car.driver.should be_nil
end
# Note that this isn't casting the attribute, it's just assigning it a value
# (see "should not cast attribute")
it "should let you assign the value" do
@car.driver = @driver
@car.driver.name.should == 'Matt'
end
it "should not cast attribute" do
it "should cast attribute" do
@car.driver = JSON.parse(JSON.generate(@driver))
@car.driver.should_not be_instance_of(Driver)
@car.driver.should be_instance_of(Driver)
end
end