diff options
author | francis <francis> | 2009-08-18 21:32:23 +0000 |
---|---|---|
committer | francis <francis> | 2009-08-18 21:32:23 +0000 |
commit | 91b817de64dc16d7b06c79a96e0deeb21c71e045 (patch) | |
tree | 9dfa81a6bd72ce424e6dcba858691b9afa60e35b /spec/controllers/request_controller_spec.rb | |
parent | 32c1fe80dc3fefc85d27a8465b67084fbd4fe60e (diff) |
Don't send alert for annotation on your own request.
Diffstat (limited to 'spec/controllers/request_controller_spec.rb')
-rw-r--r-- | spec/controllers/request_controller_spec.rb | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/spec/controllers/request_controller_spec.rb b/spec/controllers/request_controller_spec.rb index e8bf5c1fc..f40c2770f 100644 --- a/spec/controllers/request_controller_spec.rb +++ b/spec/controllers/request_controller_spec.rb @@ -797,7 +797,7 @@ describe RequestController, "comment alerts" do existing_comment = info_requests(:fancy_dog_request).comments[0] existing_comment.info_request_events[0].destroy existing_comment.destroy - new_comment = info_requests(:fancy_dog_request).add_comment('I love making annotations.', users(:bob_smith_user)) + new_comment = info_requests(:fancy_dog_request).add_comment('I really love making annotations.', users(:silly_name_user)) # send comment alert RequestMailer.alert_comment_on_request @@ -816,11 +816,27 @@ describe RequestController, "comment alerts" do #STDERR.puts mail.body end + it "should not send an alert when you comment on your own request" do + # delete ficture comment and make new one, so is in last month (as + # alerts are only for comments in last month, see + # RequestMailer.alert_comment_on_request) + existing_comment = info_requests(:fancy_dog_request).comments[0] + existing_comment.info_request_events[0].destroy + existing_comment.destroy + new_comment = info_requests(:fancy_dog_request).add_comment('I also love making annotations.', users(:bob_smith_user)) + + # try to send comment alert + RequestMailer.alert_comment_on_request + + deliveries = ActionMailer::Base.deliveries + deliveries.size.should == 0 + end + it "should send an alert when there are two new comments" do - # add second comment - that one being new will be enough for - # RequestMailer.alert_comment_on_request to also find the one in the - # fixture. - new_comment = info_requests(:fancy_dog_request).add_comment('Not as daft as this one', users(:bob_smith_user)) + # add two comments - the second one sould be ignored, as is by the user who made the request. + # the new comment here, will cause the one in the fixture to be picked up as a new comment by alert_comment_on_request also. + new_comment = info_requests(:fancy_dog_request).add_comment('Not as daft as this one', users(:silly_name_user)) + new_comment = info_requests(:fancy_dog_request).add_comment('Or this one!!!', users(:bob_smith_user)) RequestMailer.alert_comment_on_request |