FIX: Toggling post's wiki status should not create a new version.

This commit is contained in:
Guo Xiang Tan
2017-01-20 14:37:22 +08:00
parent 521ced38c5
commit 32846aad2a
8 changed files with 53 additions and 9 deletions

View File

@ -465,6 +465,20 @@ describe PostsController do
expect(response).to be_forbidden
end
it "toggle wiki status should not create a new version" do
admin = log_in(:admin)
another_user = Fabricate(:user)
another_post = Fabricate(:post, user: another_user)
expect { xhr :put, :wiki, post_id: another_post.id, wiki: 'true' }
.to_not change { another_post.reload.version }
another_admin = log_in(:admin)
expect { xhr :put, :wiki, post_id: another_post.id, wiki: 'false' }
.to_not change { another_post.reload.version }
end
it "can wiki a post" do
Guardian.any_instance.expects(:can_wiki?).with(post).returns(true)