From 93ea940a4db10be39031c374fbb6b906853a5a81 Mon Sep 17 00:00:00 2001 From: Ben Lubar Date: Mon, 28 Jul 2014 10:49:42 -0500 Subject: [PATCH] add spec for public edit history --- spec/components/guardian_spec.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/spec/components/guardian_spec.rb b/spec/components/guardian_spec.rb index 639dd5b6310..42e21e95528 100644 --- a/spec/components/guardian_spec.rb +++ b/spec/components/guardian_spec.rb @@ -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