From 1ba18318acc99ef5fe15c1113bbaf0c9265fb852 Mon Sep 17 00:00:00 2001 From: Chris Hunt Date: Sat, 25 May 2013 17:39:05 -0700 Subject: [PATCH] Add test to verify posts are moved in transaction --- spec/models/topic_spec.rb | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/spec/models/topic_spec.rb b/spec/models/topic_spec.rb index 27e9e127a79..262a0064d1c 100644 --- a/spec/models/topic_spec.rb +++ b/spec/models/topic_spec.rb @@ -204,10 +204,15 @@ describe Topic do lambda { topic.move_posts(user, [1003], title: "new testing topic name") }.should raise_error(Discourse::InvalidParameters) end - it "raises an error if no posts were moved" do - lambda { topic.move_posts(user, [], title: "new testing topic name") }.should raise_error(Discourse::InvalidParameters) - end + it "raises an error and does not create a topic if no posts were moved" do + Topic.count.tap do |original_topic_count| + lambda { + topic.move_posts(user, [], title: "new testing topic name") + }.should raise_error(Discourse::InvalidParameters) + expect(Topic.count).to eq original_topic_count + end + end end context "successfully moved" do