diff --git a/spec/features/officing_spec.rb b/spec/features/officing_spec.rb index aff3eac4e..897a26107 100644 --- a/spec/features/officing_spec.rb +++ b/spec/features/officing_spec.rb @@ -1,4 +1,5 @@ require 'rails_helper' +require 'sessions_helper' feature 'Poll Officing' do let(:user) { create(:user) } @@ -106,4 +107,40 @@ feature 'Poll Officing' do expect(page).to_not have_css('#moderation_menu') end -end \ No newline at end of file + 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 diff --git a/spec/sessions_helper.rb b/spec/sessions_helper.rb new file mode 100644 index 000000000..fc3fcc2f0 --- /dev/null +++ b/spec/sessions_helper.rb @@ -0,0 +1,8 @@ +def in_browser(name) + old_session = Capybara.session_name + + Capybara.session_name = name + yield + + Capybara.session_name = old_session +end