Created
July 30, 2010 17:29
-
-
Save squarelover/500947 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def reset_attribute!(name) | |
value = attribute_was(name) | |
@attributes[name] = value | |
modifications.delete(name) | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ... | |
# this is line 396 | |
context "change previously unset attribute" do | |
before do | |
@person.ssn = "111-22-3456" | |
end | |
it "resets the value to unset" do | |
@person.reset_attribute!("ssn") | |
@person.ssn.should be_nil | |
end | |
it "removes the field from the changes" do | |
@person.reset_attribute!("ssn") | |
@person.changed.should == [] | |
end | |
end | |
# ... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment