From d44aa29e7df2facb48bbec1535d429a901873709 Mon Sep 17 00:00:00 2001 From: Adam Bachman Date: Sat, 13 Sep 2025 15:06:00 -0400 Subject: [PATCH] chore: remove extra test setup code from view specs --- spec/views/all_casa_admins/casa_orgs/show.html.erb_spec.rb | 1 - spec/views/banners/new.html.erb_spec.rb | 3 --- spec/views/casa_admins/admins_table.html.erb_spec.rb | 1 - spec/views/casa_cases/new.html.erb_spec.rb | 4 ---- spec/views/court_dates/edit.html.erb_spec.rb | 1 - spec/views/court_dates/show.html.erb_spec.rb | 3 --- spec/views/mileage_rates/index.html.erb_spec.rb | 1 - spec/views/placements/edit.html.erb_spec.rb | 1 - spec/views/reimbursements/index.html.erb_spec.rb | 1 - spec/views/volunteers/index.html.erb_spec.rb | 1 - 10 files changed, 17 deletions(-) diff --git a/spec/views/all_casa_admins/casa_orgs/show.html.erb_spec.rb b/spec/views/all_casa_admins/casa_orgs/show.html.erb_spec.rb index 8f261c19c8..fcc0f51032 100644 --- a/spec/views/all_casa_admins/casa_orgs/show.html.erb_spec.rb +++ b/spec/views/all_casa_admins/casa_orgs/show.html.erb_spec.rb @@ -12,7 +12,6 @@ } before do - allow(view).to receive(:current_user).and_return(user) allow(view).to receive(:selected_organization).and_return(organization) assign :casa_org_metrics, metrics render diff --git a/spec/views/banners/new.html.erb_spec.rb b/spec/views/banners/new.html.erb_spec.rb index f77738e99b..1d99893d57 100644 --- a/spec/views/banners/new.html.erb_spec.rb +++ b/spec/views/banners/new.html.erb_spec.rb @@ -7,7 +7,6 @@ current_organization = user.casa_org current_organization_banner = build(:banner, active: true, casa_org: current_organization) - allow(view).to receive(:current_user).and_return(user) allow(view).to receive(:current_organization).and_return(current_organization) without_partial_double_verification do allow(view).to receive(:browser_time_zone).and_return("America/New_York") @@ -31,7 +30,6 @@ current_organization = user.casa_org current_organization_banner = build(:banner, active: true, casa_org: current_organization) - allow(view).to receive(:current_user).and_return(user) allow(view).to receive(:current_organization).and_return(current_organization) without_partial_double_verification do allow(view).to receive(:browser_time_zone).and_return("America/New_York") @@ -55,7 +53,6 @@ user = build_stubbed(:casa_admin) current_organization = user.casa_org - allow(view).to receive(:current_user).and_return(user) allow(view).to receive(:current_organization).and_return(current_organization) without_partial_double_verification do allow(view).to receive(:browser_time_zone).and_return("America/New_York") diff --git a/spec/views/casa_admins/admins_table.html.erb_spec.rb b/spec/views/casa_admins/admins_table.html.erb_spec.rb index ac53f4d8f8..2829bdd654 100644 --- a/spec/views/casa_admins/admins_table.html.erb_spec.rb +++ b/spec/views/casa_admins/admins_table.html.erb_spec.rb @@ -4,7 +4,6 @@ it "allows editing admin users" do admin = build_stubbed :casa_admin enable_pundit(view, admin) - allow(view).to receive(:current_user).and_return(admin) assign :admins, [admin.decorate] diff --git a/spec/views/casa_cases/new.html.erb_spec.rb b/spec/views/casa_cases/new.html.erb_spec.rb index 43edf33f2b..6dc33efde7 100644 --- a/spec/views/casa_cases/new.html.erb_spec.rb +++ b/spec/views/casa_cases/new.html.erb_spec.rb @@ -9,8 +9,6 @@ context "while signed in as admin" do it "has youth birth month and year" do enable_pundit(view, user) - allow(view).to receive(:current_user).and_return(user) - allow(view).to receive(:current_organization).and_return(casa_org) assign :casa_case, build(:casa_case, casa_org: casa_org) assign :contact_types, casa_org.contact_types @@ -24,8 +22,6 @@ context "when trying to assign a volunteer to a case" do it "is able to assign volunteers" do enable_pundit(view, user) - allow(view).to receive(:current_user).and_return(user) - allow(view).to receive(:current_organization).and_return(user.casa_org) assign :casa_case, build(:casa_case, casa_org: user.casa_org) assign :contact_types, casa_org.contact_types diff --git a/spec/views/court_dates/edit.html.erb_spec.rb b/spec/views/court_dates/edit.html.erb_spec.rb index c2f4c0c95e..82a45c776a 100644 --- a/spec/views/court_dates/edit.html.erb_spec.rb +++ b/spec/views/court_dates/edit.html.erb_spec.rb @@ -20,7 +20,6 @@ assign :court_date, court_date enable_pundit(view, user) - allow(view).to receive(:current_user).and_return(user) allow(view).to receive(:current_organization).and_return(user.casa_org) end diff --git a/spec/views/court_dates/show.html.erb_spec.rb b/spec/views/court_dates/show.html.erb_spec.rb index e7c0dc2cf7..387c9a8dd0 100644 --- a/spec/views/court_dates/show.html.erb_spec.rb +++ b/spec/views/court_dates/show.html.erb_spec.rb @@ -52,9 +52,6 @@ assign :casa_case, court_date.casa_case assign :court_date, court_date - - allow(view).to receive(:current_user).and_return(user) - allow(view).to receive(:current_organization).and_return(user.casa_org) end context "with court details" do diff --git a/spec/views/mileage_rates/index.html.erb_spec.rb b/spec/views/mileage_rates/index.html.erb_spec.rb index 306bc745fe..149d2b0bbf 100644 --- a/spec/views/mileage_rates/index.html.erb_spec.rb +++ b/spec/views/mileage_rates/index.html.erb_spec.rb @@ -6,7 +6,6 @@ before do enable_pundit(view, admin) - allow(view).to receive(:current_user).and_return(admin) sign_in admin end diff --git a/spec/views/placements/edit.html.erb_spec.rb b/spec/views/placements/edit.html.erb_spec.rb index 8e433c767d..aef2d4e8ed 100644 --- a/spec/views/placements/edit.html.erb_spec.rb +++ b/spec/views/placements/edit.html.erb_spec.rb @@ -14,7 +14,6 @@ assign :placement, placement enable_pundit(view, user) - allow(view).to receive(:current_user).and_return(user) allow(view).to receive(:current_organization).and_return(user.casa_org) render end diff --git a/spec/views/reimbursements/index.html.erb_spec.rb b/spec/views/reimbursements/index.html.erb_spec.rb index 6812b5ae42..e86affd9b4 100644 --- a/spec/views/reimbursements/index.html.erb_spec.rb +++ b/spec/views/reimbursements/index.html.erb_spec.rb @@ -4,7 +4,6 @@ before do admin = build_stubbed :casa_admin enable_pundit(view, admin) - allow(view).to receive(:current_user).and_return(admin) end it "does not have any translation missing classes" do diff --git a/spec/views/volunteers/index.html.erb_spec.rb b/spec/views/volunteers/index.html.erb_spec.rb index 4e9d917352..0d02dea2ee 100644 --- a/spec/views/volunteers/index.html.erb_spec.rb +++ b/spec/views/volunteers/index.html.erb_spec.rb @@ -8,7 +8,6 @@ before do enable_pundit(view, user) - allow(view).to receive(:current_user).and_return(user) allow(view).to receive(:current_organization).and_return user.casa_org assign :volunteers, [volunteer] sign_in user