From 83d3543e33e50008048056d5a83cde693b1baa5f Mon Sep 17 00:00:00 2001 From: Daniel Waterworth Date: Wed, 3 Aug 2022 19:17:40 -0500 Subject: [PATCH] DEV: Guardians aren't active record objects, so shouldn't use fab! (#17789) --- spec/lib/second_factor/auth_manager_spec.rb | 2 +- spec/models/site_spec.rb | 2 +- spec/models/user_spec.rb | 2 +- spec/services/post_bookmarkable_spec.rb | 2 +- spec/services/topic_bookmarkable_spec.rb | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/spec/lib/second_factor/auth_manager_spec.rb b/spec/lib/second_factor/auth_manager_spec.rb index 198d021c494..4e08ea1ae0e 100644 --- a/spec/lib/second_factor/auth_manager_spec.rb +++ b/spec/lib/second_factor/auth_manager_spec.rb @@ -2,7 +2,7 @@ RSpec.describe SecondFactor::AuthManager do fab!(:user) { Fabricate(:user) } - fab!(:guardian) { Guardian.new(user) } + let(:guardian) { Guardian.new(user) } fab!(:user_totp) { Fabricate(:user_second_factor_totp, user: user) } def create_request(request_method: "GET", path: "/") diff --git a/spec/models/site_spec.rb b/spec/models/site_spec.rb index 0dada96328a..612642704f2 100644 --- a/spec/models/site_spec.rb +++ b/spec/models/site_spec.rb @@ -62,7 +62,7 @@ RSpec.describe Site do describe '#categories' do fab!(:category) { Fabricate(:category) } fab!(:user) { Fabricate(:user) } - fab!(:guardian) { Guardian.new(user) } + let(:guardian) { Guardian.new(user) } it "omits read restricted categories" do expect(Site.new(guardian).categories.map { |c| c[:id] }).to contain_exactly( diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 2d0d6d937fd..e2c00facf33 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -405,7 +405,7 @@ RSpec.describe User do fab!(:post3) { Fabricate(:post, user: user) } fab!(:posts) { [post1, post2, post3] } fab!(:post_ids) { [post1.id, post2.id, post3.id] } - fab!(:guardian) { Guardian.new(Fabricate(:admin)) } + let(:guardian) { Guardian.new(Fabricate(:admin)) } fab!(:reviewable_queued_post) { Fabricate(:reviewable_queued_post, created_by: user) } it 'deletes only one batch of posts' do diff --git a/spec/services/post_bookmarkable_spec.rb b/spec/services/post_bookmarkable_spec.rb index aa8674ed3d2..ecba854e04b 100644 --- a/spec/services/post_bookmarkable_spec.rb +++ b/spec/services/post_bookmarkable_spec.rb @@ -4,7 +4,7 @@ require 'rails_helper' RSpec.describe PostBookmarkable do fab!(:user) { Fabricate(:user) } - fab!(:guardian) { Guardian.new(user) } + let(:guardian) { Guardian.new(user) } fab!(:private_category) { Fabricate(:private_category, group: Fabricate(:group)) } let!(:post1) { Fabricate(:post) } diff --git a/spec/services/topic_bookmarkable_spec.rb b/spec/services/topic_bookmarkable_spec.rb index 165f2cad33d..c254d0fb444 100644 --- a/spec/services/topic_bookmarkable_spec.rb +++ b/spec/services/topic_bookmarkable_spec.rb @@ -4,7 +4,7 @@ require 'rails_helper' RSpec.describe TopicBookmarkable do fab!(:user) { Fabricate(:user) } - fab!(:guardian) { Guardian.new(user) } + let(:guardian) { Guardian.new(user) } fab!(:private_category) { Fabricate(:private_category, group: Fabricate(:group)) } let!(:topic1) { Fabricate(:topic) }