From cbcfc89fac50a7def4d0d191b32c9f04af3e4bcd Mon Sep 17 00:00:00 2001 From: Daniel Waterworth Date: Mon, 6 May 2019 09:40:33 +0100 Subject: [PATCH] prefabrication of users in flag_query_spec.rb --- spec/components/flag_query_spec.rb | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/spec/components/flag_query_spec.rb b/spec/components/flag_query_spec.rb index bb532efc88d..6e37008265e 100644 --- a/spec/components/flag_query_spec.rb +++ b/spec/components/flag_query_spec.rb @@ -4,16 +4,14 @@ require 'rails_helper' require_dependency 'flag_query' describe FlagQuery do - + fab!(:admin) { Fabricate(:admin) } + fab!(:moderator) { Fabricate(:moderator) } fab!(:codinghorror) { Fabricate(:coding_horror) } describe "flagged_topics" do it "respects `reviewable_default_visibility`" do Reviewable.set_priorities(medium: 10.0) - admin = Fabricate(:admin) - moderator = Fabricate(:moderator) - post = create_post SiteSetting.reviewable_default_visibility = 'low' @@ -45,7 +43,6 @@ describe FlagQuery do describe "flagged_post_actions" do it "returns the proper count" do - moderator = Fabricate(:moderator) post = create_post PostActionCreator.spam(moderator, post) expect(FlagQuery.flagged_post_actions(topic_id: post.topic_id).count).to eq(1) @@ -55,7 +52,6 @@ describe FlagQuery do describe "flagged_posts_report" do it "does not return flags on system posts" do - admin = Fabricate(:admin) post = create_post(user: Discourse.system_user) PostActionCreator.create(codinghorror, post, :spam) posts, topics, users = FlagQuery.flagged_posts_report(admin) @@ -66,9 +62,6 @@ describe FlagQuery do end it "operates correctly" do - admin = Fabricate(:admin) - moderator = Fabricate(:moderator) - post = create_post post2 = create_post @@ -136,7 +129,6 @@ describe FlagQuery do Reviewable.set_priorities(medium: 3.0) SiteSetting.reviewable_default_visibility = 'medium' - admin = Fabricate(:admin) flagger = Fabricate(:user) post = create_post