add spec for public edit history

This commit is contained in:
Ben Lubar 2014-07-28 10:49:42 -05:00
parent ac8c2e1e07
commit 93ea940a4d
1 changed files with 12 additions and 0 deletions

View File

@ -395,6 +395,12 @@ describe Guardian do
it 'is true when logged in' do
Guardian.new(Fabricate(:user)).can_see?(post_revision).should == true
end
it 'is true if the author has public edit history' do
public_post_revision = Fabricate(:post_revision)
public_post_revision.post.user.edit_history_public = true
Guardian.new.can_see?(public_post_revision).should == true
end
end
context 'edit_history_visible_to_public is false' do
@ -412,6 +418,12 @@ describe Guardian do
it 'is false for trust level lower than 4' do
Guardian.new(Fabricate(:leader)).can_see?(post_revision).should == false
end
it 'is true if the author has public edit history' do
public_post_revision = Fabricate(:post_revision)
public_post_revision.post.user.edit_history_public = true
Guardian.new.can_see?(public_post_revision).should == true
end
end
end
end