Created
March 15, 2009 16:36
-
-
Save bmabey/79470 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
module ObjectLocators | |
def the_policy | |
if @policy | |
@policy | |
else | |
case Policy.count | |
when 0 | |
raise "There is no @policy variable defined and no policy in the DB! Establish state in previous step or create a new policy." | |
when 1 | |
Policy.first | |
else | |
raise "There are multiple policies in DB and no @policy variable set! Please disambiguate the state in previous step." | |
end | |
end | |
end | |
end | |
World { |world| world.extend(ObjectLocators) } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment