aboutsummaryrefslogtreecommitdiffstats
path: root/spec/controllers
diff options
context:
space:
mode:
authorLouise Crow <louise.crow@gmail.com>2012-10-22 17:54:41 +0100
committerLouise Crow <louise.crow@gmail.com>2012-10-23 15:31:29 +0100
commit34ba3d82d16f28c9c670c7979854e57b4b0fcab9 (patch)
tree3976e37e0db703dcb633983127194a0822a8eb7e /spec/controllers
parent1245985c8df4b5d3fbb1438a12a482db8ccb0f27 (diff)
Adding new spec from https://github.com/mysociety/alaveteli/commit/cdb1c9420169ed6eafdd4e57ca21e1809c95e5cb
Diffstat (limited to 'spec/controllers')
-rw-r--r--spec/controllers/request_controller_spec.rb15
1 files changed, 13 insertions, 2 deletions
diff --git a/spec/controllers/request_controller_spec.rb b/spec/controllers/request_controller_spec.rb
index 77f43b618..5867c994f 100644
--- a/spec/controllers/request_controller_spec.rb
+++ b/spec/controllers/request_controller_spec.rb
@@ -245,7 +245,7 @@ describe RequestController, "when showing one request" do
response.should have_tag('#anyone_actions', /Add an annotation/)
end
end
-
+
describe 'when the request does not allow comments' do
it 'should not have a comment link' do
get :show, { :url_title => 'spam_1' },
@@ -253,7 +253,7 @@ describe RequestController, "when showing one request" do
response.should_not have_tag('#anyone_actions', /Add an annotation/)
end
end
-
+
describe 'when the request is being viewed by an admin' do
describe 'if the request is awaiting description' do
@@ -1746,6 +1746,17 @@ describe RequestController, "sending overdue request alerts" do
assigns[:info_request].should == info_requests(:naughty_chicken_request)
end
+ it "should not resend alerts to people who've already received them" do
+ chicken_request = info_requests(:naughty_chicken_request)
+ chicken_request.outgoing_messages[0].last_sent_at = Time.now() - 60.days
+ chicken_request.outgoing_messages[0].save!
+ RequestMailer.alert_overdue_requests
+ chicken_mails = ActionMailer::Base.deliveries.select{|x| x.body =~ /chickens/}
+ chicken_mails.size.should == 1
+ RequestMailer.alert_overdue_requests
+ chicken_mails = ActionMailer::Base.deliveries.select{|x| x.body =~ /chickens/}
+ chicken_mails.size.should == 1
+ end
end
describe RequestController, "sending unclassified new response reminder alerts" do