mirror of
https://github.com/internetee/registry.git
synced 2025-08-04 08:52:04 +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
|
@ -2,7 +2,7 @@ require 'rails_helper'
|
|||
|
||||
RSpec.feature 'Registrar area home link', db: true do
|
||||
scenario 'is visible' do
|
||||
visit registrar_login_url
|
||||
visit new_registrar_user_session_url
|
||||
expect(page).to have_link('registrar-home-btn', href: registrar_root_path)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -9,7 +9,7 @@ RSpec.feature 'Mobile ID login', db: true do
|
|||
end
|
||||
|
||||
scenario 'login with phone number' do
|
||||
visit registrar_login_path
|
||||
visit new_registrar_user_session_url
|
||||
click_on 'login-with-mobile-id-btn'
|
||||
|
||||
fill_in 'user[phone]', with: '1234'
|
||||
|
|
|
@ -1,39 +0,0 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.feature 'Registrar area password sign-in' do
|
||||
scenario 'signs in the user with valid credentials' do
|
||||
create(:api_user_with_unlimited_balance,
|
||||
active: true,
|
||||
login: 'test',
|
||||
password: 'testtest')
|
||||
|
||||
visit registrar_login_path
|
||||
sign_in_with 'test', 'testtest'
|
||||
|
||||
expect(page).to have_text(t('registrar.base.current_user.sign_out'))
|
||||
end
|
||||
|
||||
scenario 'notifies the user with invalid credentials' do
|
||||
create(:api_user, login: 'test', password: 'testtest')
|
||||
|
||||
visit registrar_login_path
|
||||
sign_in_with 'test', 'invalid'
|
||||
|
||||
expect(page).to have_text('No such user')
|
||||
end
|
||||
|
||||
scenario 'notifies the user with inactive account' do
|
||||
create(:api_user, active: false, login: 'test', password: 'testtest')
|
||||
|
||||
visit registrar_login_path
|
||||
sign_in_with 'test', 'testtest'
|
||||
|
||||
expect(page).to have_text('User is not active')
|
||||
end
|
||||
|
||||
def sign_in_with(username, password)
|
||||
fill_in 'depp_user_tag', with: username
|
||||
fill_in 'depp_user_password', with: password
|
||||
click_button 'Login'
|
||||
end
|
||||
end
|
|
@ -1,14 +0,0 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.feature 'Registrar area sign-out', settings: false do
|
||||
background do
|
||||
sign_in_to_registrar_area(user: create(:api_user_with_unlimited_balance))
|
||||
end
|
||||
|
||||
scenario 'signs the user out' do
|
||||
visit registrar_root_path
|
||||
click_on t('registrar.base.current_user.sign_out')
|
||||
|
||||
expect(page).to have_text('Signed out successfully.')
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue