From bc4748571e5c1b9c4aea21a340318dff20b3f9e8 Mon Sep 17 00:00:00 2001 From: Daniel Waterworth Date: Mon, 6 May 2019 10:01:18 +0100 Subject: [PATCH] Moved fabrication of topic to top level in topics_bulk_action_spec.rb --- spec/components/topics_bulk_action_spec.rb | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/spec/components/topics_bulk_action_spec.rb b/spec/components/topics_bulk_action_spec.rb index f722264ba8b..a88fcc60f01 100644 --- a/spec/components/topics_bulk_action_spec.rb +++ b/spec/components/topics_bulk_action_spec.rb @@ -4,6 +4,7 @@ require 'rails_helper' require_dependency 'topics_bulk_action' describe TopicsBulkAction do + fab!(:topic) { Fabricate(:topic) } describe "dismiss_posts" do it "dismisses posts" do @@ -32,7 +33,6 @@ describe TopicsBulkAction do end describe "change_category" do - fab!(:topic) { Fabricate(:topic) } fab!(:category) { Fabricate(:category) } context "when the user can edit the topic" do @@ -58,8 +58,6 @@ describe TopicsBulkAction do end describe "reset_read" do - fab!(:topic) { Fabricate(:topic) } - it "delegates to PostTiming.destroy_for" do tba = TopicsBulkAction.new(topic.user, [topic.id], type: 'reset_read') PostTiming.expects(:destroy_for).with(topic.user_id, [topic.id]) @@ -80,8 +78,6 @@ describe TopicsBulkAction do end describe "change_notification_level" do - fab!(:topic) { Fabricate(:topic) } - context "when the user can see the topic" do it "updates the notification level" do tba = TopicsBulkAction.new(topic.user, [topic.id], type: 'change_notification_level', notification_level_id: 2) @@ -103,8 +99,6 @@ describe TopicsBulkAction do end describe "close" do - fab!(:topic) { Fabricate(:topic) } - context "when the user can moderate the topic" do it "closes the topic and returns the topic_id" do Guardian.any_instance.expects(:can_moderate?).returns(true) @@ -130,8 +124,6 @@ describe TopicsBulkAction do end describe "archive" do - fab!(:topic) { Fabricate(:topic) } - context "when the user can moderate the topic" do it "archives the topic and returns the topic_id" do Guardian.any_instance.expects(:can_moderate?).returns(true) @@ -157,8 +149,6 @@ describe TopicsBulkAction do end describe "unlist" do - fab!(:topic) { Fabricate(:topic) } - context "when the user can moderate the topic" do it "unlists the topic and returns the topic_id" do Guardian.any_instance.expects(:can_moderate?).returns(true) @@ -184,7 +174,6 @@ describe TopicsBulkAction do end describe "change_tags" do - fab!(:topic) { Fabricate(:topic) } fab!(:tag1) { Fabricate(:tag) } fab!(:tag2) { Fabricate(:tag) } @@ -236,7 +225,6 @@ describe TopicsBulkAction do end describe "append tags" do - fab!(:topic) { Fabricate(:topic) } fab!(:tag1) { Fabricate(:tag) } fab!(:tag2) { Fabricate(:tag) } fab!(:tag3) { Fabricate(:tag) }