Unify related tests in wizard phases spec

This commit is contained in:
taitus
2025-07-09 14:27:27 +02:00
parent 3dc0de34bc
commit 873968ee0a

View File

@@ -64,21 +64,7 @@ describe "Budgets wizard, phases step", :admin do
end
describe "Edit" do
scenario "update phase" do
visit admin_budgets_wizard_budget_budget_phases_path(budget)
expect(page).to have_css ".creation-timeline"
within("tr", text: "Selecting projects") { click_link "Edit" }
fill_in "Name", with: "Choosing projects"
click_button "Save changes"
expect(page).to have_content "Changes saved"
expect(page).to have_css ".creation-timeline"
within_table("Phases") { expect(page).to have_content "Choosing projects" }
end
scenario "submit the form with errors and then without errors" do
scenario "update phase with errors and then without errors" do
phase = budget.phases.accepting
visit edit_admin_budgets_wizard_budget_budget_phase_path(budget, phase)
@@ -88,17 +74,19 @@ describe "Budgets wizard, phases step", :admin do
expect(page).to have_css "#error_explanation"
expect(page).to have_css ".creation-timeline"
fill_in "Name", with: "Welcoming projects"
fill_in "Name", with: "Choosing projects"
click_button "Save changes"
expect(page).to have_content "Changes saved"
expect(page).to have_css ".creation-timeline"
within_table("Phases") { expect(page).to have_content "Welcoming projects" }
within_table("Phases") { expect(page).to have_content "Choosing projects" }
end
scenario "update phase in single heading budget" do
visit admin_budgets_wizard_budget_budget_phases_path(budget, mode: "single")
expect(page).to have_css ".creation-timeline"
within("tr", text: "Selecting projects") { click_link "Edit" }
fill_in "Name", with: "Choosing projects"
click_button "Save changes"