From 77f9fff41ea07b43cec30b963c619a3a136da7ff Mon Sep 17 00:00:00 2001 From: Sam Saffron Date: Wed, 8 May 2019 09:31:47 +1000 Subject: [PATCH] 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 --- spec/requests/topics_controller_spec.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/spec/requests/topics_controller_spec.rb b/spec/requests/topics_controller_spec.rb index e59ba7b6711..7ac9e6878af 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