mirror of
https://github.com/discourse/discourse.git
synced 2025-06-02 04:08:41 +08:00
add specs for post ownership change without revision
This commit is contained in:
@ -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
|
||||
|
Reference in New Issue
Block a user