From abcb96ffda3bb64cbfca4a2bb453f71b6e0ee654 Mon Sep 17 00:00:00 2001 From: Manu Date: Tue, 22 Jan 2019 16:32:05 -0500 Subject: [PATCH] added test spec for creation of legislative process with image --- .../admin/legislation/processes_spec.rb | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/spec/features/admin/legislation/processes_spec.rb b/spec/features/admin/legislation/processes_spec.rb index af97d0e1c..e56bca81b 100644 --- a/spec/features/admin/legislation/processes_spec.rb +++ b/spec/features/admin/legislation/processes_spec.rb @@ -131,6 +131,28 @@ feature 'Admin legislation processes' do expect(page).not_to have_content 'Summary of the process' expect(page).not_to have_content 'Describing the process' end + + scenario "Create a legislation process with an image", :js do + visit new_admin_legislation_process_path() + fill_in 'Process Title', with: 'An example legislation process' + fill_in 'Summary', with: 'Summary of the process' + + base_date = Date.current + fill_in 'legislation_process[start_date]', with: base_date.strftime("%d/%m/%Y") + fill_in 'legislation_process[end_date]', with: (base_date + 5.days).strftime("%d/%m/%Y") + imageable_attach_new_file(create(:image), Rails.root.join('spec/fixtures/files/clippy.jpg')) + + 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_css("img[alt='#{Legislation::Process.last.title}']") + end end context 'Update' do