Created
June 30, 2009 16:34
-
-
Save jqr/138260 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
class User < ActiveRecord::Base | |
def score=(value) | |
super(value * 1_000_000) # pinball scores do it, why not Users? | |
end | |
end | |
describe User do | |
describe "creating a new user" do | |
it "should multiply the score by some ridiculous amount" do | |
user = User.new(:score => 5) | |
user.score.should == 5_000_000 | |
end | |
end | |
describe "updating an old user" do | |
it "should multiply the score by some ridiculous amount" do | |
user = User.create! | |
user.update_attributes(:score => 3) | |
user.score.should == 3_000_000 | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment