DEV: correct flaky test

DEV: correct flaky test

Hardcoding the number 1 into a test means that the test may fail if topic_id 1 is somehow seeded

This ensures we are always talking about a topic that does not exist

diff --git a/spec/requests/topics_controller_spec.rb b/spec/requests/topics_controller_spec.rb
index e59ba7b..7ac9e68 100644
--- a/spec/requests/topics_controller_spec.rb
+++ b/spec/requests/topics_controller_spec.rb
@@ -2745,8 +2745,9 @@ RSpec.describe TopicsController do
       end
 
       it "should fail for non-existend topic" do
+        max_id = Topic.maximum(:id)
         sign_in(Fabricate(:admin))
-        put "/t/1/reset-bump-date.json"
+        put "/t/#{max_id + 1}/reset-bump-date.json"
         expect(response.status).to eq(404)
       end
     end

GitHub sha: 77f9fff4

1 Like