diff options
author | Francis Irving <francis@mysociety.org> | 2010-06-09 22:30:08 +0100 |
---|---|---|
committer | Francis Irving <francis@mysociety.org> | 2010-06-09 22:30:08 +0100 |
commit | 5d0a94f0186fcb86798945268855a3af2f90532f (patch) | |
tree | a7fe2189d40cac529dcd6841fc886d8bfb8d0d54 /spec/controllers/track_controller_spec.rb | |
parent | 2a21e7e3a15a6f76c17c11469bf032ca57201dfd (diff) |
Need to set time now in test.
Diffstat (limited to 'spec/controllers/track_controller_spec.rb')
-rw-r--r-- | spec/controllers/track_controller_spec.rb | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/spec/controllers/track_controller_spec.rb b/spec/controllers/track_controller_spec.rb index af508e78b..5959c2bc1 100644 --- a/spec/controllers/track_controller_spec.rb +++ b/spec/controllers/track_controller_spec.rb @@ -31,6 +31,11 @@ describe TrackController, "when sending alerts for a track" do include LinkToHelper # for main_url it "should send alerts" do + # set the time the comment event happened at to within the last week + ire = info_request_events(:silly_comment_event) + ire.created_at = Time.now - 3.days + ire.save! + TrackMailer.alert_tracks deliveries = ActionMailer::Base.deliveries @@ -41,9 +46,15 @@ describe TrackController, "when sending alerts for a track" do mail.body =~ /(http:\/\/.*\/c\/(.*))/ mail_url = $1 mail_token = $2 - + mail.body.should_not =~ /&/ + mail.body.should_not include('sent a request') # request not included + mail.body.should_not include('sent a response') # response not included + mail.body.should include('added an annotation') # comment included + + mail.body.should =~ /This a the daftest comment the world has ever seen/ # comment text included + # Check subscription managing link # XXX We can't do this, as it is redirecting to another controller. I'm # apparently meant to be writing controller unit tests here, not functional |