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:
voodoorai2000
2019-06-01 20:44:30 +02:00
parent 53b4c12439
commit 875ae1f487

View File

@@ -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 ladmin"
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)