FIX: 'disable_edit_notifications' will only disable revisions made by the system user

This commit is contained in:
Régis Hanol
2014-09-09 18:56:04 +02:00
parent eb34ecfc0c
commit 598a3f3e10
2 changed files with 18 additions and 6 deletions

View File

@ -40,11 +40,23 @@ describe PostAlertObserver do
}.should change(post.user.notifications, :count).by(1)
end
it 'does not notifiy a user of the revision when edit notifications are disabled' do
SiteSetting.stubs(:disable_edit_notifications).returns(true)
lambda {
post.revise(evil_trout, "world is the new body of the message")
}.should_not change(post.user.notifications, :count).by(1)
context "edit notifications are disabled" do
before { SiteSetting.stubs(:disable_edit_notifications).returns(true) }
it 'notifies a user of the revision made by another user' do
lambda {
post.revise(evil_trout, "world is the new body of the message")
}.should change(post.user.notifications, :count).by(1)
end
it 'does not notifiy a user of the revision made by the system user' do
lambda {
post.revise(Discourse.system_user, "world is the new body of the message")
}.should_not change(post.user.notifications, :count)
end
end
end