From b6abafec125f91bc3d04d1624c2cba98e650a28a Mon Sep 17 00:00:00 2001 From: "Salvador Fuentes Jr." <9240+fuentesjr@users.noreply.github.com> Date: Fri, 10 Jul 2026 08:21:04 -0700 Subject: [PATCH 1/4] test: replace NotePolicy spec stub with real tests (#5563) --- spec/policies/note_policy_spec.rb | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/spec/policies/note_policy_spec.rb b/spec/policies/note_policy_spec.rb index a78b604cc2..174b22e23c 100644 --- a/spec/policies/note_policy_spec.rb +++ b/spec/policies/note_policy_spec.rb @@ -1,7 +1,23 @@ require "rails_helper" RSpec.describe NotePolicy, type: :policy do - # TODO: Add tests for NotePolicy + subject { described_class } - pending "add some tests for NotePolicy" + let(:casa_admin) { build_stubbed(:casa_admin) } + let(:supervisor) { build_stubbed(:supervisor) } + let(:volunteer) { build_stubbed(:volunteer) } + + permissions :create?, :edit?, :update?, :destroy? do + it "permits casa_admins" do + expect(subject).to permit(casa_admin) + end + + it "permits supervisors" do + expect(subject).to permit(supervisor) + end + + it "does not permit volunteers" do + expect(subject).not_to permit(volunteer) + end + end end From d919f363b13b8c932d4cf2172860032f9994b6d6 Mon Sep 17 00:00:00 2001 From: "Salvador Fuentes Jr." <9240+fuentesjr@users.noreply.github.com> Date: Fri, 10 Jul 2026 08:21:04 -0700 Subject: [PATCH 2/4] test: replace FundRequestPolicy spec stub with real tests (#5563) --- spec/policies/fund_request_policy_spec.rb | 27 +++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/spec/policies/fund_request_policy_spec.rb b/spec/policies/fund_request_policy_spec.rb index 798945b339..09a075159d 100644 --- a/spec/policies/fund_request_policy_spec.rb +++ b/spec/policies/fund_request_policy_spec.rb @@ -1,7 +1,30 @@ require "rails_helper" RSpec.describe FundRequestPolicy, type: :policy do - # TODO: Add tests for FundRequestPolicy + subject { described_class } - pending "add some tests for FundRequestPolicy" + let(:casa_admin) { build_stubbed(:casa_admin) } + let(:supervisor) { build_stubbed(:supervisor) } + let(:volunteer) { build_stubbed(:volunteer) } + + # NOTE: this policy is intentionally open - new?/create? are unconditionally + # true, so there is no denied role. Access is constrained upstream by the + # controller (FundRequestsController#verify_casa_case). + permissions :new?, :create? do + it "permits casa_admins" do + expect(subject).to permit(casa_admin) + end + + it "permits supervisors" do + expect(subject).to permit(supervisor) + end + + it "permits volunteers" do + expect(subject).to permit(volunteer) + end + + it "permits a nil user" do + expect(subject).to permit(nil) + end + end end From 979cba55417394b8c5969b84c84072e0bb0ae012 Mon Sep 17 00:00:00 2001 From: "Salvador Fuentes Jr." <9240+fuentesjr@users.noreply.github.com> Date: Fri, 10 Jul 2026 08:21:04 -0700 Subject: [PATCH 3/4] test: replace LearningHourTopicPolicy spec stub with real tests (#5563) --- .../learning_hour_topic_policy_spec.rb | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/spec/policies/learning_hour_topic_policy_spec.rb b/spec/policies/learning_hour_topic_policy_spec.rb index 576f4f702d..68a075cec5 100644 --- a/spec/policies/learning_hour_topic_policy_spec.rb +++ b/spec/policies/learning_hour_topic_policy_spec.rb @@ -1,7 +1,23 @@ require "rails_helper" RSpec.describe LearningHourTopicPolicy, type: :policy do - # TODO: Add tests for LearningHourTopicPolicy + subject { described_class } - pending "add some tests for LearningHourTopicPolicy" + let(:casa_admin) { build_stubbed(:casa_admin) } + let(:supervisor) { build_stubbed(:supervisor) } + let(:volunteer) { build_stubbed(:volunteer) } + + permissions :new?, :create?, :edit?, :update? do + it "permits casa_admins" do + expect(subject).to permit(casa_admin) + end + + it "does not permit supervisors" do + expect(subject).not_to permit(supervisor) + end + + it "does not permit volunteers" do + expect(subject).not_to permit(volunteer) + end + end end From 62a73c280d1d9bef4e682433b2ae37d39aba433f Mon Sep 17 00:00:00 2001 From: "Salvador Fuentes Jr." <9240+fuentesjr@users.noreply.github.com> Date: Fri, 10 Jul 2026 08:21:04 -0700 Subject: [PATCH 4/4] test: replace LearningHourTypePolicy spec stub with real tests (#5563) --- .../learning_hour_type_policy_spec.rb | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/spec/policies/learning_hour_type_policy_spec.rb b/spec/policies/learning_hour_type_policy_spec.rb index c0cc05c51c..84423f6baf 100644 --- a/spec/policies/learning_hour_type_policy_spec.rb +++ b/spec/policies/learning_hour_type_policy_spec.rb @@ -1,7 +1,23 @@ require "rails_helper" RSpec.describe LearningHourTypePolicy, type: :policy do - # TODO: Add tests for LearningHourTypePolicy + subject { described_class } - pending "add some tests for LearningHourTypePolicy" + let(:casa_admin) { build_stubbed(:casa_admin) } + let(:supervisor) { build_stubbed(:supervisor) } + let(:volunteer) { build_stubbed(:volunteer) } + + permissions :new?, :create?, :edit?, :update? do + it "permits casa_admins" do + expect(subject).to permit(casa_admin) + end + + it "does not permit supervisors" do + expect(subject).not_to permit(supervisor) + end + + it "does not permit volunteers" do + expect(subject).not_to permit(volunteer) + end + end end