mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 06:04:11 +08:00
DEV: Guardians aren't active record objects, so shouldn't use fab! (#17789)
This commit is contained in:
parent
7cab189b1e
commit
83d3543e33
|
@ -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: "/")
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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) }
|
||||
|
|
|
@ -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) }
|
||||
|
|
Loading…
Reference in New Issue
Block a user