SHARE
TWEET

Untitled

a guest Dec 6th, 2016 75 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. require 'test_helper'
  2.  
  3. class UsersSigninTest < ActionDispatch::IntegrationTest
  4.   include Devise::Test::IntegrationHelpers
  5.  
  6.   def setup
  7.     @user = User.create(email: 'washington@example.com',
  8.                                             password: Devise::Encryptor.digest(User, 'foobar'))
  9.   end
  10.  
  11.   test 'invalid user sign in' do
  12.       get new_user_session_path
  13.       assert_template 'sessions/new'
  14.       post new_user_session_path, session: { email: '',
  15.                                                                         password: ''
  16.                                                                     }
  17.       assert_template 'sessions/new'
  18.       assert_select '.alert'
  19.     end
  20.  
  21.     test 'valid user sign in' do
  22.         @user.save
  23.         get new_user_session_path
  24.         post user_session_path,  'user[email]' => @user.email,
  25.                                                                              'user[password]' => @user.password
  26.                                                                            
  27.         puts
  28.         puts @response.inspect.to_yaml
  29.         puts
  30.         puts @user.email
  31.         puts @user.password
  32.         assert_redirected_to @user
  33.         follow_redirect!
  34.         assert_template 'users/show'
  35.         assert_select 'a[href=?]', destroy_user_session, count: 0
  36.     end
  37. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top