Skip to content

A platform for community discussion. Free, open, simple.

DEV: Fix random build error

Gerhard Schlager8cb5ed3a7c07
diff --git a/spec/models/post_mover_spec.rb b/spec/models/post_mover_spec.rb
index 45fc23f2bba..b4c6095e925 100644
--- a/spec/models/post_mover_spec.rb
+++ b/spec/models/post_mover_spec.rb
@@ -88,7 +88,8 @@ describe PostMover do
context "errors" do
it "raises an error when one of the posts doesn't exist" do
- expect { topic.move_posts(user, [1003], title: "new testing topic name") }.to raise_error(Discourse::InvalidParameters)
+ non_existent_post_id = Post.maximum(:id)&.next || 1
+ expect { topic.move_posts(user, [non_existent_post_id], title: "new testing topic name") }.to raise_error(Discourse::InvalidParameters)
end
it "raises an error and does not create a topic if no posts were moved" do