Guest User

Untitled

a guest
Oct 13th, 2018
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. require 'spec_helper'
  2.  
  3. describe User do
  4. subject {@user}
  5. before {@user = User.new(name:'ExampleUser', email:'hah@gmail.com',
  6. password: 'foobar', password_confirmation:'foobar') }
  7.  
  8. it {should be_valid}
  9. it {should respond_to(:name)}
  10. it {should respond_to(:email)}
  11.  
  12. it {should respond_to(:password)}
  13. it {should respond_to(:password_confirmation)}
  14.  
  15. describe "Login" do
  16. it "should authenticate success when use valid password" do
  17. @user.authenticate('foobar').should be_true
  18. end
  19. it "should authenticate fail when use invalid password" do
  20. @user.authenticate('invalid').should be_false
  21. end
  22. end
  23. end
Add Comment
Please, Sign In to add comment