A platform for community discussion. Free, open, simple.
Use prefabricated admin instead of creating new ones
Daniel Waterworth2c7ed7b8480c
diff --git a/spec/components/guardian_spec.rb b/spec/components/guardian_spec.rbindex 0703e833d60..3a0bde447e1 100644--- a/spec/components/guardian_spec.rb+++ b/spec/components/guardian_spec.rb@@ -202,7 +202,7 @@ describe Guardian doendit "returns true for a new user flagging a private message as spam" do- post = Fabricate(:private_message_post, user: Fabricate(:admin))+ post = Fabricate(:private_message_post, user: admin)user.trust_level = TrustLevel[0]post.topic.allowed_users << userexpect(Guardian.new(user).post_can_act?(post, :spam)).to be_truthy@@ -340,8 +340,6 @@ describe Guardian doexpect(Guardian.new(user).can_send_private_message?(group)).to eq(output)end- admin = Fabricate(:admin)-Group::ALIAS_LEVELS.each do |level, _|group.update!(messageable_level: Group::ALIAS_LEVELS[level])expect(Guardian.new(admin).can_send_private_message?(group)).to eq(true)@@ -490,7 +488,7 @@ describe Guardian doit 'returns false when user is not allowed to edit a group' doexpect(Guardian.new(user).can_invite_to_forum?(groups)).to eq(false)- expect(Guardian.new(Fabricate(:admin)).can_invite_to_forum?(groups))+ expect(Guardian.new(admin).can_invite_to_forum?(groups)).to eq(true)end@@ -862,7 +860,7 @@ describe Guardian dobefore { SiteSetting.edit_history_visible_to_public = false }it 'is true for staff' do- expect(Guardian.new(Fabricate(:admin)).can_see?(post_revision)).to be_truthy+ expect(Guardian.new(admin).can_see?(post_revision)).to be_truthyexpect(Guardian.new(moderator).can_see?(post_revision)).to be_truthyend