diff options
author | francis <francis> | 2008-09-13 11:54:00 +0000 |
---|---|---|
committer | francis <francis> | 2008-09-13 11:54:00 +0000 |
commit | cef675330195bb7b01213d953e1f96c4c758e810 (patch) | |
tree | afac903bd5b5ea08fdcee4b9a9a1f185c60241a7 /spec/controllers/request_controller_spec.rb | |
parent | e062b700e107a32ccd86a6c65381dffd5fb6d87e (diff) |
Fix tests for comment alerts
Diffstat (limited to 'spec/controllers/request_controller_spec.rb')
-rw-r--r-- | spec/controllers/request_controller_spec.rb | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/spec/controllers/request_controller_spec.rb b/spec/controllers/request_controller_spec.rb index f60e8e88d..a66ec7eaf 100644 --- a/spec/controllers/request_controller_spec.rb +++ b/spec/controllers/request_controller_spec.rb @@ -398,11 +398,13 @@ describe RequestController, "comment alerts" do fixtures :info_requests, :info_request_events, :public_bodies, :users, :incoming_messages, :outgoing_messages, :comments # all needed as integrating views it "should send an alert" do - # updated created_at timestamp, so is in last month (as alerts are only - # for comments in last month, see RequestMailer.alert_comment_on_request + # 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.created_at = Time.now() - 2.weeks - existing_comment.save! + 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)) # send comment alert RequestMailer.alert_comment_on_request @@ -422,6 +424,9 @@ describe RequestController, "comment alerts" do 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)) RequestMailer.alert_comment_on_request |