Simplify tests requiring admin login

We were repeating the same code over and over (with a few variants) to
setup tests which require an administrator. We can use a tag and
simplify the code.
This commit is contained in:
Javi Martín
2020-11-20 21:54:18 +01:00
parent 64205ab15f
commit 3da4ee00b8
82 changed files with 110 additions and 468 deletions

View File

@@ -3,12 +3,7 @@ require "rails_helper"
describe "Admin budget phases" do
let(:budget) { create(:budget) }
context "Edit" do
before do
admin = create(:administrator)
login_as(admin.user)
end
context "Edit", :admin do
scenario "Update phase", :js do
visit edit_admin_budget_budget_phase_path(budget, budget.current_phase)