Created
April 8, 2011 17:53
-
-
Save deathbob/910375 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 TenCommandments | |
| # Had to change this method name, it didn't read well in my test suite. | |
| # t.should be_thou_shalt_not_kill??? Give me a break. Not idiomatic Ruby! | |
| # *I* would't be caught dead with those specs on. | |
| # def thou_shalt_not_kill | |
| # true | |
| # end | |
| # Much more idiomatic. Now my specs read like butter too. | |
| # t.should be_a_person_who_does_not_commit_murder. | |
| def a_person_who_does_not_commit_murder | |
| true | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
def murderer? <= the question mark is idiomatic ruby
true
end
person.should_not be_murderer
Your "thou shalt not kill" method doesn't make sense; I can't think of an equivalent method I'd write an use that way. But it actually does kind of sound like a test:
thou.should_not kill(thee)
The issue here is that the idiomatic method makes it clear that this is a state check. This is distinct from a identity check, such as:
thou = ChildOfGod.new
thou.should be_a_child_of_god
With all that said, yes: Yahweh probably would not have used RSpec as his Ten Commandments design tool. Granted. :)