internetee-registry/test/integration/registrar/login_test.rb
Artur Beljajev 9684c8e59f Refactor Devise integration
- Use scoped users
- Use the named route helpers instead of hardcoded paths
2018-06-20 12:21:22 +03:00

39 lines
No EOL
1 KiB
Ruby

require 'test_helper'
class RegistrarAreaLoginTest < ActionDispatch::IntegrationTest
def setup
@user = users(:api_bestnames)
end
def test_correct_username_and_password
visit new_registrar_user_session_url
fill_in 'depp_user_tag', with: @user.username
fill_in 'depp_user_password', with: 'testtest'
click_button 'Login'
assert_text 'Log out'
assert_current_path registrar_root_path
end
def test_wrong_password
visit new_registrar_user_session_url
fill_in 'depp_user_tag', with: @user.username
fill_in 'depp_user_password', with: 'wrong'
click_button 'Login'
assert_text 'No such user'
assert_current_path new_registrar_user_session_path
end
def test_inactive_user
@user.update!(active: false)
visit new_registrar_user_session_url
fill_in 'depp_user_tag', with: @user.username
fill_in 'depp_user_password', with: 'testtest'
click_button 'Login'
assert_text 'User is not active'
assert_current_path new_registrar_user_session_path
end
end