Skip to content

Instantly share code, notes, and snippets.

@motdotla
Created November 15, 2008 08:11
Show Gist options
  • Save motdotla/25216 to your computer and use it in GitHub Desktop.
Save motdotla/25216 to your computer and use it in GitHub Desktop.
# http://www.peterryan.net/2007/08/08/bdd-model-validation-using-rspec-and-extensions-to-hash/
1. before(:each) do
2. @team = Team.new
3. end
4.
5. def valid_team
6. {
7. :name => "team name",
8. :contact_number => "call me here!",
9. :people => [valid_person, valid_person],
10. :knowledge_of_chicago => "pretty good",
11. :why_will_win => "might get lucky",
12. :relationship => "great"
13. }.extend(HashExtension)
14. end
15.
16. def valid_person
17. person = Person.new
18. person.attributes = {
19. :email => "[email protected]",
20. :name => "My Great Name",
21. :shirt_size => "L",
22. :hometown => "Chicago",
23. :team => @team,
24. :occupation => "occupation"
25. }
26. person
27. end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment