Remove unnecessary in_browser clause

We only need to define one `in_browser`, which is the one opening the
session as an administrator.

This change is done to simplify the code, although there's a small
chance it might also make the test stop failing in our CI. Sometimes in
our CI the first `visit` in the `in_browser(:admin)` block fails for
unknown reasons, rendering a blank page.
This commit is contained in:
Javi Martín
2021-04-15 18:55:00 +02:00
parent 9890571091
commit 3345dd67d9

View File

@@ -629,12 +629,10 @@ describe "Ballots" do
investment1 = create(:budget_investment, :selected, heading: new_york, price: 10000)
admin_user = create(:administrator).user
in_browser(:user) do
login_as user
visit budget_investments_path(budget, heading_id: new_york)
login_as user
visit budget_investments_path(budget, heading_id: new_york)
expect(page).to have_css(".in-favor a")
end
expect(page).to have_css(".in-favor a")
in_browser(:admin) do
login_as admin_user
@@ -649,18 +647,16 @@ describe "Ballots" do
end
end
in_browser(:user) do
within("#budget_investment_#{investment1.id}") do
find(".in-favor a").click
within("#budget_investment_#{investment1.id}") do
find(".in-favor a").click
expect(page).not_to have_content "Remove"
expect(page).not_to have_selector(".participation-not-allowed")
expect(page).not_to have_content "Remove"
expect(page).not_to have_selector(".participation-not-allowed")
hover_over_ballot
hover_over_ballot
expect(page).to have_selector(".participation-not-allowed")
expect(page).to have_selector(".in-favor a", obscured: true)
end
expect(page).to have_selector(".participation-not-allowed")
expect(page).to have_selector(".in-favor a", obscured: true)
end
end