Created
September 5, 2010 21:51
-
-
Save leosoto/566357 to your computer and use it in GitHub Desktop.
This file contains 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
describe Something do | |
context "when it is too old" do | |
# Two options here: | |
# (a) make it too old by changing the internal state | |
# Pros: Simple | |
# Cons: If you change the definition of what is "too old" you have to change many tests | |
before { subject.updated_at = 2.years.ago } | |
# (b) stub the too_old? method | |
# Pros: Resistant to changes of what "too old" exactly means | |
# Cons: Forces the implementation to use a specific method. | |
before { subject.stubs(:too_old?).returns(true) } | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment