mirror of
https://github.com/internetee/registry.git
synced 2025-07-23 19:20:37 +02:00
Refactor Devise integration
- Use scoped users - Use the named route helpers instead of hardcoded paths
This commit is contained in:
parent
c31f507c25
commit
9684c8e59f
52 changed files with 313 additions and 280 deletions
27
test/integration/admin/login_test.rb
Normal file
27
test/integration/admin/login_test.rb
Normal file
|
@ -0,0 +1,27 @@
|
|||
require 'test_helper'
|
||||
|
||||
class AdminAreaLoginTest < ActionDispatch::IntegrationTest
|
||||
def setup
|
||||
@user = users(:admin)
|
||||
end
|
||||
|
||||
def test_correct_username_and_password
|
||||
visit new_admin_user_session_url
|
||||
fill_in 'admin_user_username', with: @user.username
|
||||
fill_in 'admin_user_password', with: 'testtest'
|
||||
click_button 'Log in'
|
||||
|
||||
assert_text 'Log out'
|
||||
assert_current_path admin_root_path
|
||||
end
|
||||
|
||||
def test_wrong_password
|
||||
visit new_admin_user_session_url
|
||||
fill_in 'admin_user_username', with: @user.username
|
||||
fill_in 'admin_user_password', with: 'wrong'
|
||||
click_button 'Log in'
|
||||
|
||||
assert_text 'Authorization error'
|
||||
assert_current_path new_admin_user_session_path
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue