add specs for post ownership change without revision

This commit is contained in:
Arpit Jalan
2016-08-20 00:57:12 +05:30
parent 03ce370d5e
commit 4a2f0e772c
3 changed files with 42 additions and 0 deletions

View File

@ -874,6 +874,27 @@ describe Post do
end
end
describe "#set_owner" do
let(:post) { Fabricate(:post) }
let(:coding_horror) { Fabricate(:coding_horror) }
it "will change owner of a post correctly" do
post.set_owner(coding_horror, Discourse.system_user)
post.reload
expect(post.user).to eq(coding_horror)
expect(post.revisions.size).to eq(1)
end
it "skips creating new post revision if skip_revision is true" do
post.set_owner(coding_horror, Discourse.system_user, true)
post.reload
expect(post.user).to eq(coding_horror)
expect(post.revisions.size).to eq(0)
end
end
describe ".rebake_old" do
it "will catch posts it needs to rebake" do
post = create_post