DEV: Guardians aren't active record objects, so shouldn't use fab! (#17789)

This commit is contained in:
Daniel Waterworth 2022-08-03 19:17:40 -05:00 committed by GitHub
parent 7cab189b1e
commit 83d3543e33
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 5 additions and 5 deletions

View File

@ -2,7 +2,7 @@
RSpec.describe SecondFactor::AuthManager do RSpec.describe SecondFactor::AuthManager do
fab!(:user) { Fabricate(:user) } fab!(:user) { Fabricate(:user) }
fab!(:guardian) { Guardian.new(user) } let(:guardian) { Guardian.new(user) }
fab!(:user_totp) { Fabricate(:user_second_factor_totp, user: user) } fab!(:user_totp) { Fabricate(:user_second_factor_totp, user: user) }
def create_request(request_method: "GET", path: "/") def create_request(request_method: "GET", path: "/")

View File

@ -62,7 +62,7 @@ RSpec.describe Site do
describe '#categories' do describe '#categories' do
fab!(:category) { Fabricate(:category) } fab!(:category) { Fabricate(:category) }
fab!(:user) { Fabricate(:user) } fab!(:user) { Fabricate(:user) }
fab!(:guardian) { Guardian.new(user) } let(:guardian) { Guardian.new(user) }
it "omits read restricted categories" do it "omits read restricted categories" do
expect(Site.new(guardian).categories.map { |c| c[:id] }).to contain_exactly( expect(Site.new(guardian).categories.map { |c| c[:id] }).to contain_exactly(

View File

@ -405,7 +405,7 @@ RSpec.describe User do
fab!(:post3) { Fabricate(:post, user: user) } fab!(:post3) { Fabricate(:post, user: user) }
fab!(:posts) { [post1, post2, post3] } fab!(:posts) { [post1, post2, post3] }
fab!(:post_ids) { [post1.id, post2.id, post3.id] } 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) } fab!(:reviewable_queued_post) { Fabricate(:reviewable_queued_post, created_by: user) }
it 'deletes only one batch of posts' do it 'deletes only one batch of posts' do

View File

@ -4,7 +4,7 @@ require 'rails_helper'
RSpec.describe PostBookmarkable do RSpec.describe PostBookmarkable do
fab!(:user) { Fabricate(:user) } fab!(:user) { Fabricate(:user) }
fab!(:guardian) { Guardian.new(user) } let(:guardian) { Guardian.new(user) }
fab!(:private_category) { Fabricate(:private_category, group: Fabricate(:group)) } fab!(:private_category) { Fabricate(:private_category, group: Fabricate(:group)) }
let!(:post1) { Fabricate(:post) } let!(:post1) { Fabricate(:post) }

View File

@ -4,7 +4,7 @@ require 'rails_helper'
RSpec.describe TopicBookmarkable do RSpec.describe TopicBookmarkable do
fab!(:user) { Fabricate(:user) } fab!(:user) { Fabricate(:user) }
fab!(:guardian) { Guardian.new(user) } let(:guardian) { Guardian.new(user) }
fab!(:private_category) { Fabricate(:private_category, group: Fabricate(:group)) } fab!(:private_category) { Fabricate(:private_category, group: Fabricate(:group)) }
let!(:topic1) { Fabricate(:topic) } let!(:topic1) { Fabricate(:topic) }