A platform for community discussion. Free, open, simple.
Brought prefabrication of another_user to the top level
Daniel Waterworth30676e8a56eb
diff --git a/spec/components/guardian_spec.rb b/spec/components/guardian_spec.rbindex 3a0bde447e1..ed5bd35daa8 100644--- a/spec/components/guardian_spec.rb+++ b/spec/components/guardian_spec.rb@@ -9,6 +9,7 @@ require_dependency 'post_locker'describe Guardian dofab!(:user) { Fabricate(:user) }+ fab!(:another_user) { Fabricate(:user) }fab!(:moderator) { Fabricate(:moderator) }fab!(:admin) { Fabricate(:admin) }fab!(:anonymous_user) { Fabricate(:anonymous) }@@ -251,7 +252,6 @@ describe Guardian dodescribe 'can_send_private_message' dofab!(:user) { Fabricate(:user) }- fab!(:another_user) { Fabricate(:user) }fab!(:suspended_user) { Fabricate(:user, suspended_till: 1.week.from_now, suspended_at: 1.day.ago) }it "returns false when the user is nil" do@@ -2720,8 +2720,6 @@ describe Guardian doendcontext "when ignored user is a normal user" do- let!(:another_user) { Fabricate(:user) }-it 'allows ignoring user' doexpect(guardian.can_ignore_user?(another_user.id)).to eq(true)end@@ -2729,7 +2727,6 @@ describe Guardian docontext "when ignorer's trust level is below tl2" dolet(:guardian) { Guardian.new(trust_level_1) }- let!(:another_user) { Fabricate(:user) }let!(:trust_level_1) { build(:user, trust_level: 1) }it 'does not allow ignoring user' do@@ -2739,7 +2736,6 @@ describe Guardian docontext "when ignorer is staff" dolet(:guardian) { Guardian.new(admin) }- let!(:another_user) { Fabricate(:user) }it 'allows ignoring user' doexpect(guardian.can_ignore_user?(another_user.id)).to eq(true)@@ -2748,7 +2744,6 @@ describe Guardian docontext "when ignorer's trust level is tl2" dolet(:guardian) { Guardian.new(trust_level_2) }- let!(:another_user) { Fabricate(:user) }it 'allows ignoring user' doexpect(guardian.can_ignore_user?(another_user.id)).to eq(true)@@ -2775,8 +2770,6 @@ describe Guardian doendcontext "when muted user is a normal user" do- let!(:another_user) { Fabricate(:user) }-it 'allows muting user' doexpect(guardian.can_mute_user?(another_user.id)).to eq(true)end@@ -2784,7 +2777,6 @@ describe Guardian docontext "when muter's trust level is below tl1" dolet(:guardian) { Guardian.new(trust_level_0) }- let!(:another_user) { Fabricate(:user) }let!(:trust_level_0) { build(:user, trust_level: 0) }it 'does not allow muting user' do@@ -2794,7 +2786,6 @@ describe Guardian docontext "when muter is staff" dolet(:guardian) { Guardian.new(admin) }- let!(:another_user) { Fabricate(:user) }it 'allows muting user' doexpect(guardian.can_mute_user?(another_user.id)).to eq(true)@@ -2803,7 +2794,6 @@ describe Guardian docontext "when muters's trust level is tl1" dolet(:guardian) { Guardian.new(trust_level_1) }- let!(:another_user) { Fabricate(:user) }it 'allows muting user' doexpect(guardian.can_mute_user?(another_user.id)).to eq(true)@@ -3133,7 +3123,6 @@ describe Guardian docontext 'normal user' dofab!(:topic) { Fabricate(:topic, user: Fabricate(:user)) }- fab!(:another_user) { Fabricate(:user) }before dotopic.allowed_users << user