DEV: correct spec to meet new design

approved
#1

DEV: correct spec to meet new design

We now allow self assigns unlimited, but limit other people once you reach limit

diff --git a/spec/lib/topic_assigner_spec.rb b/spec/lib/topic_assigner_spec.rb
index 0ffb4be..1e0db91 100644
--- a/spec/lib/topic_assigner_spec.rb
+++ b/spec/lib/topic_assigner_spec.rb
@@ -156,11 +156,18 @@ RSpec.describe TopicAssigner do
     it "doesn't count self-assigns when enforcing the limit" do
       SiteSetting.max_assigned_topics = 1
       another_post = Fabricate(:post)
-      TopicAssigner.new(another_post.topic, moderator).assign(moderator)
 
-      second_assign = assigner.assign(moderator)
+      first_assign = assigner.assign(moderator)
 
-      expect(second_assign[:success]).to eq(true)
+      # reached limit so stop
+      second_assign = TopicAssigner.new(Fabricate(:topic), moderator2).assign(moderator)
+
+      # self assign has a bypass
+      third_assign = TopicAssigner.new(another_post.topic, moderator).assign(moderator)
+
+      expect(first_assign[:success]).to eq(true)
+      expect(second_assign[:success]).to eq(false)
+      expect(third_assign[:success]).to eq(true)
     end
   end

GitHub sha: f5a19501

1 Like
Approved #2