Guest User

Untitled

a guest
Apr 16th, 2018
272
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. Model:
  2.  
  3. attr_accessor :password, :terms_of_service
  4.  
  5. validates_acceptance_of :terms_of_service, :on => :create, :allow_nil => false
  6.  
  7. Test (failing):
  8.  
  9. def test_should_create_user
  10. assert_difference 'User.count' do
  11. user = create_user
  12. assert !user.new_record?, "#{user.errors.full_messages.to_sentence}"
  13. end
  14. end
  15.  
  16. protected
  17.  
  18. def create_user(options = {})
  19. User.create({ :login => 'quire', :email => 'quire@example.com', :password => 'quire', :password_confirmation => 'quire', :terms_of_service => "1" }.merge(options))
  20. end
Add Comment
Please, Sign In to add comment