Skip to content

Commit

Permalink
Add test to verify posts are moved in transaction
Browse files Browse the repository at this point in the history
  • Loading branch information
chrishunt committed May 26, 2013
1 parent b8fbac5 commit 1ba1831
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions spec/models/topic_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -204,10 +204,15 @@ def build_topic_with_title(title)
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
Expand Down

0 comments on commit 1ba1831

Please sign in to comment.