Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- context "A user (in general)" do
- def setup
- @user = User.new
- end
- specify "should be invalid without a username" do
- @user.email = 'joe@bloggs.com'
- @user.password = 'abcdefg'
- @user.should_not_be_valid
- @user.errors.on(:username).should_equal "is required"
- @user.username = 'someusername'
- @user.should_be_valid
- end
- specify "should be invalid without an email" do
- @user.username = 'joebloggs'
- @user.password = 'abcdefg'
- @user.should_not_be_valid
- @user.errors.on(:email).should_equal "is required"
- @user.email = 'joe@bloggs.com'
- @user.should_be_valid
- end
- spec "should be invalid without a password" do
- @user.email = 'joe@bloggs.com'
- @user.username = 'joebloggs'
- @user.should_not_be_valid
- @user.password = 'abcdefg'
- @user.should_be_valid
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement