Add spec for translated budget poll name
This spec fails if we remove the attribute `name` from `poll_params` in the `Admin::Poll::PollsController`, which we would usually remove because it's a translatable attribute.
This commit is contained in:
@@ -27,6 +27,24 @@ describe "Admin Budgets" do
|
|||||||
expect(Poll.last.budget).to eq(budget)
|
expect(Poll.last.budget).to eq(budget)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
scenario "Create poll in current locale if the budget does not have a poll associated", :js do
|
||||||
|
budget = create(:budget,
|
||||||
|
name_en: "Budget for climate change",
|
||||||
|
name_fr: "Budget pour le changement climatique")
|
||||||
|
|
||||||
|
|
||||||
|
visit admin_budgets_path
|
||||||
|
select("Français", from: "locale-switcher")
|
||||||
|
|
||||||
|
click_link "Bulletins de l’admin"
|
||||||
|
|
||||||
|
expect(current_path).to match(/admin\/polls\/\d+/)
|
||||||
|
expect(page).to have_content("Budget pour le changement climatique")
|
||||||
|
|
||||||
|
expect(Poll.count).to eq(1)
|
||||||
|
expect(Poll.last.budget).to eq(budget)
|
||||||
|
end
|
||||||
|
|
||||||
scenario "Display link to poll if the budget has a poll associated" do
|
scenario "Display link to poll if the budget has a poll associated" do
|
||||||
budget = create(:budget)
|
budget = create(:budget)
|
||||||
poll = create(:poll, budget: budget)
|
poll = create(:poll, budget: budget)
|
||||||
|
|||||||
Reference in New Issue
Block a user