Make process creation tests more readable

We created fieldsets in commit 6172dd0a5 but forgot to simplify the
tests as well.
This commit is contained in:
Javi Martín
2021-03-27 18:54:01 +01:00
parent 2036b3d44e
commit fda61daa03

View File

@@ -64,17 +64,29 @@ describe "Admin collaborative legislation", :admin do
fill_in "Description", with: "Describing the process" fill_in "Description", with: "Describing the process"
base_date = Date.current base_date = Date.current
fill_in "legislation_process[start_date]", with: base_date
fill_in "legislation_process[end_date]", with: base_date + 5.days
fill_in "legislation_process[debate_start_date]", with: base_date within_fieldset text: "Draft phase" do
fill_in "legislation_process[debate_end_date]", with: base_date + 2.days fill_in "Start", with: base_date - 3.days
fill_in "legislation_process[draft_start_date]", with: base_date - 3.days fill_in "End", with: base_date - 1.day
fill_in "legislation_process[draft_end_date]", with: base_date - 1.day end
fill_in "legislation_process[draft_publication_date]", with: base_date + 3.days
fill_in "legislation_process[allegations_start_date]", with: base_date + 3.days within_fieldset "Process" do
fill_in "legislation_process[allegations_end_date]", with: base_date + 5.days fill_in "Start", with: base_date
fill_in "legislation_process[result_publication_date]", with: base_date + 7.days fill_in "End", with: base_date + 5.days
end
within_fieldset "Debate phase" do
fill_in "Start", with: base_date
fill_in "End", with: base_date + 2.days
end
within_fieldset "Comments phase" do
fill_in "Start", with: base_date + 3.days
fill_in "End", with: base_date + 5.days
end
fill_in "Draft publication date", with: base_date + 3.days
fill_in "Final result publication date", with: base_date + 7.days
click_button "Create process" click_button "Create process"
@@ -110,12 +122,17 @@ describe "Admin collaborative legislation", :admin do
fill_in "Description", with: "Describing the process" fill_in "Description", with: "Describing the process"
base_date = Date.current - 2.days base_date = Date.current - 2.days
fill_in "legislation_process[start_date]", with: base_date
fill_in "legislation_process[end_date]", with: base_date + 5.days
fill_in "legislation_process[draft_start_date]", with: base_date within_fieldset text: "Draft phase" do
fill_in "legislation_process[draft_end_date]", with: base_date + 3.days check "Enabled"
check "legislation_process[draft_phase_enabled]" fill_in "Start", with: base_date
fill_in "End", with: base_date + 3.days
end
within_fieldset "Process" do
fill_in "Start", with: base_date
fill_in "End", with: base_date + 5.days
end
click_button "Create process" click_button "Create process"
@@ -141,8 +158,12 @@ describe "Admin collaborative legislation", :admin do
fill_in "Summary", with: "Summary of the process" fill_in "Summary", with: "Summary of the process"
base_date = Date.current base_date = Date.current
fill_in "legislation_process[start_date]", with: base_date
fill_in "legislation_process[end_date]", with: base_date + 5.days within_fieldset "Process" do
fill_in "Start", with: base_date
fill_in "End", with: base_date + 5.days
end
imageable_attach_new_file(create(:image), Rails.root.join("spec/fixtures/files/clippy.jpg")) imageable_attach_new_file(create(:image), Rails.root.join("spec/fixtures/files/clippy.jpg"))
click_button "Create process" click_button "Create process"