mirror of
https://github.com/internetee/registry.git
synced 2025-05-21 03:39:40 +02:00
Better flash messages, sessions spec
This commit is contained in:
parent
662806d8c9
commit
482d77c319
12 changed files with 77 additions and 8 deletions
47
spec/features/sessions_spec.rb
Normal file
47
spec/features/sessions_spec.rb
Normal file
|
@ -0,0 +1,47 @@
|
|||
require 'rails_helper'
|
||||
|
||||
feature 'Sessions', type: :feature do
|
||||
let(:elkdata) { Fabricate(:registrar, { name: 'Elkdata', reg_no: '123' }) }
|
||||
let(:zone) { Fabricate(:registrar) }
|
||||
|
||||
background do
|
||||
Fabricate(:user, registrar: zone)
|
||||
Fabricate(:user, registrar: zone, username: 'zone', admin: false)
|
||||
Fabricate(:domain_validation_setting_group)
|
||||
Fabricate.times(2, :domain, registrar: zone)
|
||||
Fabricate.times(2, :domain, registrar: elkdata)
|
||||
end
|
||||
|
||||
scenario 'Admin logs in' do
|
||||
visit root_path
|
||||
expect(page).to have_button('ID card (gitlab)')
|
||||
expect(page).to have_button('ID card (zone)')
|
||||
|
||||
click_on 'ID card (gitlab)'
|
||||
expect(page).to have_text('Welcome!')
|
||||
|
||||
uri = URI.parse(current_url)
|
||||
expect(uri.path).to eq(admin_root_path)
|
||||
|
||||
expect(page).to have_link('Elkdata', count: 2)
|
||||
expect(page).to have_link('Zone Media OÜ', count: 2)
|
||||
end
|
||||
|
||||
scenario 'Client logs in' do
|
||||
visit root_path
|
||||
|
||||
click_on 'ID card (zone)'
|
||||
expect(page).to have_text('Welcome!')
|
||||
|
||||
uri = URI.parse(current_url)
|
||||
expect(uri.path).to eq(client_root_path)
|
||||
|
||||
zone.domains.pluck(:name).each do |name|
|
||||
expect(page).to have_link(name)
|
||||
end
|
||||
|
||||
elkdata.domains.pluck(:name).each do |name|
|
||||
expect(page).to_not have_link(name)
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue