From 8cb5ed3a7c0793925248b08e89ba10f388693e56 Mon Sep 17 00:00:00 2001 From: Gerhard Schlager Date: Wed, 2 Jan 2019 17:27:08 +0100 Subject: [PATCH] DEV: Fix random build error --- spec/models/post_mover_spec.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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