diff --git a/spec/system/admin/budget_groups_spec.rb b/spec/system/admin/budget_groups_spec.rb index 626af9503..139a6c103 100644 --- a/spec/system/admin/budget_groups_spec.rb +++ b/spec/system/admin/budget_groups_spec.rb @@ -123,8 +123,7 @@ describe "Admin budget groups", :admin do end scenario "Changing name for current locale will update the slug if budget is in draft phase" do - group = create(:budget_group, budget: budget) - old_slug = group.slug + group = create(:budget_group, budget: budget, name: "Old English Name") visit edit_admin_budget_group_path(budget, group) @@ -133,7 +132,10 @@ describe "Admin budget groups", :admin do click_button "Save group" expect(page).to have_content "Group updated successfully" - expect(group.reload.slug).to eq old_slug + + visit budget_group_path(budget, id: "old-english-name") + + expect(page).to have_content "Select an option" visit edit_admin_budget_group_path(budget, group) @@ -142,8 +144,10 @@ describe "Admin budget groups", :admin do click_button "Save group" expect(page).to have_content "Group updated successfully" - expect(group.reload.slug).not_to eq old_slug - expect(group.slug).to eq "new-english-name" + + visit budget_group_path(budget, id: "new-english-name") + + expect(page).to have_content "Select an option" end end diff --git a/spec/system/admin/budget_headings_spec.rb b/spec/system/admin/budget_headings_spec.rb index 2f166a413..710770ed5 100644 --- a/spec/system/admin/budget_headings_spec.rb +++ b/spec/system/admin/budget_headings_spec.rb @@ -160,8 +160,7 @@ describe "Admin budget headings", :admin do end scenario "Changing name for current locale will update the slug if budget is in draft phase" do - heading = create(:budget_heading, group: group) - old_slug = heading.slug + heading = create(:budget_heading, group: group, name: "Old English Name") visit edit_admin_budget_group_heading_path(budget, group, heading) @@ -170,7 +169,10 @@ describe "Admin budget headings", :admin do click_button "Save heading" expect(page).to have_content "Heading updated successfully" - expect(heading.reload.slug).to eq old_slug + + visit budget_investments_path(budget, heading_id: "old-english-name") + + expect(page).to have_content "Old English Name" visit edit_admin_budget_group_heading_path(budget, group, heading) @@ -179,8 +181,10 @@ describe "Admin budget headings", :admin do click_button "Save heading" expect(page).to have_content "Heading updated successfully" - expect(heading.reload.slug).not_to eq old_slug - expect(heading.slug).to eq "new-english-name" + + visit budget_investments_path(budget, heading_id: "new-english-name") + + expect(page).to have_content "New English Name" end end diff --git a/spec/system/admin/budgets_spec.rb b/spec/system/admin/budgets_spec.rb index eaae7dbd1..24249fd1b 100644 --- a/spec/system/admin/budgets_spec.rb +++ b/spec/system/admin/budgets_spec.rb @@ -286,8 +286,7 @@ describe "Admin budgets", :admin do end scenario "Changing name for current locale will update the slug if budget is in draft phase" do - budget.update!(published: false) - old_slug = budget.slug + budget.update!(published: false, name: "Old English Name") visit edit_admin_budget_path(budget) @@ -296,7 +295,10 @@ describe "Admin budgets", :admin do click_button "Update Budget" expect(page).to have_content "Participatory budget updated successfully" - expect(budget.reload.slug).to eq old_slug + + visit budget_path(id: "old-english-name") + + expect(page).to have_content "Old English Name" visit edit_admin_budget_path(budget) @@ -305,8 +307,10 @@ describe "Admin budgets", :admin do click_button "Update Budget" expect(page).to have_content "Participatory budget updated successfully" - expect(budget.reload.slug).not_to eq old_slug - expect(budget.slug).to eq "new-english-name" + + visit budget_path(id: "new-english-name") + + expect(page).to have_content "New English Name" end end diff --git a/spec/system/admin/poll/polls_spec.rb b/spec/system/admin/poll/polls_spec.rb index 8848fa96e..15f0efc94 100644 --- a/spec/system/admin/poll/polls_spec.rb +++ b/spec/system/admin/poll/polls_spec.rb @@ -75,7 +75,10 @@ describe "Admin polls", :admin do expect(page).to have_content "Upcoming poll" expect(page).to have_content I18n.l(start_date) expect(page).to have_content I18n.l(end_date) - expect(Poll.last.slug).to eq "#{Poll.last.name.to_s.parameterize}" + + visit poll_path(id: "upcoming-poll") + + expect(page).to have_content "Upcoming poll" end scenario "Edit" do