Added officing tests
Added new tests to officing section to ensure that multiple sessions (different users) can be initialized at the same time without crashing.
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
require 'rails_helper'
|
require 'rails_helper'
|
||||||
|
require 'sessions_helper'
|
||||||
|
|
||||||
feature 'Poll Officing' do
|
feature 'Poll Officing' do
|
||||||
let(:user) { create(:user) }
|
let(:user) { create(:user) }
|
||||||
@@ -106,4 +107,40 @@ feature 'Poll Officing' do
|
|||||||
expect(page).to_not have_css('#moderation_menu')
|
expect(page).to_not have_css('#moderation_menu')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
scenario 'Officing dashboard available for multiple sessions' do
|
||||||
|
user1 = create(:user)
|
||||||
|
user2 = create(:user)
|
||||||
|
officer1 = create(:poll_officer, user: user1)
|
||||||
|
officer2 = create(:poll_officer, user: user2)
|
||||||
|
|
||||||
|
in_browser(:one) do
|
||||||
|
login_as user1
|
||||||
|
visit officing_root_path
|
||||||
|
end
|
||||||
|
|
||||||
|
in_browser(:two) do
|
||||||
|
login_as user2
|
||||||
|
visit officing_root_path
|
||||||
|
end
|
||||||
|
|
||||||
|
in_browser(:one) do
|
||||||
|
page.should have_content("Here you can validate user documents and store voting results")
|
||||||
|
|
||||||
|
visit new_officing_residence_path
|
||||||
|
page.should have_content("Validate document")
|
||||||
|
|
||||||
|
visit final_officing_polls_path
|
||||||
|
page.should have_content("Polls ready for final recounting")
|
||||||
|
end
|
||||||
|
|
||||||
|
in_browser(:two) do
|
||||||
|
page.should have_content("Here you can validate user documents and store voting results")
|
||||||
|
|
||||||
|
visit new_officing_residence_path
|
||||||
|
page.should have_content("Validate document")
|
||||||
|
|
||||||
|
visit final_officing_polls_path
|
||||||
|
page.should have_content("Polls ready for final recounting")
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
8
spec/sessions_helper.rb
Normal file
8
spec/sessions_helper.rb
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
def in_browser(name)
|
||||||
|
old_session = Capybara.session_name
|
||||||
|
|
||||||
|
Capybara.session_name = name
|
||||||
|
yield
|
||||||
|
|
||||||
|
Capybara.session_name = old_session
|
||||||
|
end
|
||||||
Reference in New Issue
Block a user