Reputation: 10604
Just learning RSpec and trying to do some tutorials. In one of the tutorials the criteria below has been provided. I am to write the test and code to make it pass. I am just learning Ruby and RSpec. Where do I find a 'cookbook' for writing the RSpec tests according to the type of spec?
The specs:
A person should save correctly
A person should have many addresses
A person's address must have a street, city, and zip
A person's address can have an optional country
If the 'country' is left blank, it should default to 'USA' prior to saving
Upvotes: 0
Views: 678
Reputation: 160170
[Updated April 2014: The first two references are effectively dead and have been unlinked The original links are still available in the markdown in case they come back to life.]
Those should be more than enough to cover the tests you list; probably the model one is plenty. I'm wary of "person should save correctly", since that's actually testing Rails.
Upvotes: 3