From 89b8e51a93646bf851d54014428d7606d3412e4a Mon Sep 17 00:00:00 2001 From: Bertocq Date: Tue, 31 Oct 2017 19:27:47 +0100 Subject: [PATCH] Add helper function to get legislation proposals list order on feature spec --- spec/features/legislation/proposals_spec.rb | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/spec/features/legislation/proposals_spec.rb b/spec/features/legislation/proposals_spec.rb index 17d3eb28c..c579c352a 100644 --- a/spec/features/legislation/proposals_spec.rb +++ b/spec/features/legislation/proposals_spec.rb @@ -26,28 +26,32 @@ feature 'Legislation Proposals' do in_browser(:one) do login_as user visit legislation_process_proposals_path(process) - @first_user_proposals_order = all("[id^='legislation_proposal_']").collect { |e| e[:id] } + @first_user_proposals_order = legislation_proposals_order end in_browser(:two) do login_as user2 visit legislation_process_proposals_path(process) - @second_user_proposals_order = all("[id^='legislation_proposal_']").collect { |e| e[:id] } + @second_user_proposals_order = legislation_proposals_order end expect(@first_user_proposals_order).not_to eq(@second_user_proposals_order) in_browser(:one) do visit legislation_process_proposals_path(process) - expect(all("[id^='legislation_proposal_']").collect { |e| e[:id] }).to eq(@first_user_proposals_order) + expect(legislation_proposals_order).to eq(@first_user_proposals_order) end in_browser(:two) do visit legislation_process_proposals_path(process) - expect(all("[id^='legislation_proposal_']").collect { |e| e[:id] }).to eq(@second_user_proposals_order) + expect(legislation_proposals_order).to eq(@second_user_proposals_order) end end + def legislation_proposals_order + all("[id^='legislation_proposal_']").collect { |e| e[:id] } + end + scenario "Create a legislation proposal with an image", :js do create(:legislation_proposal, process: process)