From a33341ec52fa50062518859b19bbfe16b26d6eb8 Mon Sep 17 00:00:00 2001 From: Bertocq Date: Fri, 2 Jun 2017 19:17:49 +0200 Subject: [PATCH] Increase admin legislative process feature spec to also check detail and list views --- .../admin/legislation/processes_spec.rb | 28 +++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/spec/features/admin/legislation/processes_spec.rb b/spec/features/admin/legislation/processes_spec.rb index 72937a787..f34e93d3d 100644 --- a/spec/features/admin/legislation/processes_spec.rb +++ b/spec/features/admin/legislation/processes_spec.rb @@ -39,6 +39,7 @@ feature 'Admin legislation processes' do click_link "New process" fill_in 'legislation_process_title', with: 'An example legislation process' + fill_in 'legislation_process_summary', with: 'Summary of the process' fill_in 'legislation_process_description', with: 'Describing the process' fill_in 'legislation_process_target', with: 'This thing affects people' fill_in 'legislation_process_how_to_participate', with: 'You can partipate in this thing by doing...' @@ -57,12 +58,30 @@ feature 'Admin legislation processes' do click_button 'Create process' expect(page).to have_content 'An example legislation process' + expect(page).to have_content 'Process created successfully' + + click_link 'Click to visit' + + expect(page).to have_content 'An example legislation process' + expect(page).not_to have_content 'Summary of the process' + expect(page).to have_content 'Describing the process' + expect(page).to have_content 'This thing affects people' + + visit legislation_processes_path + + expect(page).to have_content 'An example legislation process' + expect(page).to have_content 'Summary of the process' + expect(page).not_to have_content 'Describing the process' + expect(page).not_to have_content 'This thing affects people' end end context 'Update' do - scenario 'Deactivate debate phase', :js do - process = create(:legislation_process, title: 'An example legislation process') + scenario 'Deactivate debate phase', js: true do + process = create(:legislation_process, + title: 'An example legislation process', + summary: 'Summarizing the process', + description: 'Description of the process') visit admin_root_path within('#side_menu') do @@ -75,11 +94,16 @@ feature 'Admin legislation processes' do expect(find("#debate_phase_active")).to be_checked uncheck "debate_phase_active" + fill_in 'legislation_process_summary', with: '' click_button "Save changes" expect(page).to have_content "Process updated successfully" expect(find("#debate_start_date").value).to be_blank expect(find("#debate_end_date").value).to be_blank + + visit legislation_processes_path + expect(page).not_to have_content 'Summarizing the process' + expect(page).to have_content 'Description of the process' end end end