Adds draft phase functionality in legislation processes

This commit is contained in:
João Lutz
2018-10-19 15:27:18 -03:00
parent fb4b12c2d4
commit 34b58a5208
15 changed files with 209 additions and 23 deletions

View File

@@ -53,6 +53,8 @@ feature 'Admin legislation processes' do
fill_in 'legislation_process[debate_start_date]', with: base_date.strftime("%d/%m/%Y")
fill_in 'legislation_process[debate_end_date]', with: (base_date + 2.days).strftime("%d/%m/%Y")
fill_in 'legislation_process[draft_start_date]', with: (base_date - 3.days).strftime("%d/%m/%Y")
fill_in 'legislation_process[draft_end_date]', with: (base_date - 1.days).strftime("%d/%m/%Y")
fill_in 'legislation_process[draft_publication_date]', with: (base_date + 3.days).strftime("%d/%m/%Y")
fill_in 'legislation_process[allegations_start_date]', with: (base_date + 3.days).strftime("%d/%m/%Y")
fill_in 'legislation_process[allegations_end_date]', with: (base_date + 5.days).strftime("%d/%m/%Y")
@@ -75,6 +77,47 @@ feature 'Admin legislation processes' do
expect(page).to have_content 'Summary of the process'
expect(page).not_to have_content 'Describing the process'
end
scenario 'Legislation process in draft phase' do
visit admin_root_path
within('#side_menu') do
click_link "Collaborative Legislation"
end
expect(page).not_to have_content 'An example legislation process'
click_link "New process"
fill_in 'Process Title', with: 'An example legislation process in draft phase'
fill_in 'Summary', with: 'Summary of the process'
fill_in 'Description', with: 'Describing the process'
base_date = Date.current - 2.days
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")
fill_in 'legislation_process[draft_start_date]', with: base_date.strftime("%d/%m/%Y")
fill_in 'legislation_process[draft_end_date]', with: (base_date + 3.days).strftime("%d/%m/%Y")
check 'legislation_process[draft_phase_enabled]'
click_button 'Create process'
expect(page).to have_content 'An example legislation process in draft phase'
expect(page).to have_content 'Process created successfully'
click_link 'Click to visit'
expect(page).to have_content 'An example legislation process in draft phase'
expect(page).not_to have_content 'Summary of the process'
expect(page).to have_content 'Describing the process'
visit legislation_processes_path
expect(page).not_to have_content 'An example legislation process in draft phase'
expect(page).not_to have_content 'Summary of the process'
expect(page).not_to have_content 'Describing the process'
end
end
context 'Update' do

View File

@@ -66,11 +66,13 @@ feature 'Legislation' do
create(:legislation_process, title: "Process open")
create(:legislation_process, :next, title: "Process next")
create(:legislation_process, :past, title: "Process past")
create(:legislation_process, :in_draft_phase, title: "Process in draft phase")
visit legislation_processes_path
expect(page).to have_content('Process open')
expect(page).not_to have_content('Process next')
expect(page).not_to have_content('Process past')
expect(page).not_to have_content('Process in draft phase')
visit legislation_processes_path(filter: 'next')
expect(page).not_to have_content('Process open')