aboutsummaryrefslogtreecommitdiffstats
path: root/spec/controllers/request_controller_spec.rb
diff options
context:
space:
mode:
authorfrancis <francis>2008-05-21 22:37:32 +0000
committerfrancis <francis>2008-05-21 22:37:32 +0000
commit7fd83d90dc8b867e098b82d7c72d2d8029bfd479 (patch)
tree9db3b9d825f6f2bb75af3fb2f8b983eceaef5b01 /spec/controllers/request_controller_spec.rb
parentc0951f93e5d33fd7158f433730fe535ad20182f4 (diff)
Show people tracking same query, when you are on search page.
Put name of admin user rather than import_csv. Send automated email to remind people to clarify their request. Send response overdue alerts multiple times for one request (if it becomes overdue again after a clarification etc.) Overdue response alert email click through shows how many days overdue it is near where you write your reply.
Diffstat (limited to 'spec/controllers/request_controller_spec.rb')
-rw-r--r--spec/controllers/request_controller_spec.rb35
1 files changed, 35 insertions, 0 deletions
diff --git a/spec/controllers/request_controller_spec.rb b/spec/controllers/request_controller_spec.rb
index d7a199a96..cd3160ddb 100644
--- a/spec/controllers/request_controller_spec.rb
+++ b/spec/controllers/request_controller_spec.rb
@@ -342,6 +342,41 @@ describe RequestController, "sending unclassified new response reminder alerts"
end
+describe RequestController, "clarification required alerts" do
+ integrate_views
+ fixtures :info_requests, :info_request_events, :public_bodies, :users, :incoming_messages, :outgoing_messages # all needed as integrating views
+
+ it "should send an alert" do
+ ir = info_requests(:fancy_dog_request)
+ ir.set_described_state('waiting_clarification')
+ # this is pretty horrid, but will do :) need to make it waiting
+ # clarification more than 3 days ago for the alerts to go out.
+ ActiveRecord::Base.connection.update "update info_requests set updated_at = now() - '5 day'::interval where id = " + ir.id.to_s
+ ir.reload
+
+ RequestMailer.alert_not_clarified_request
+
+ deliveries = ActionMailer::Base.deliveries
+ deliveries.size.should == 1
+ mail = deliveries[0]
+ mail.body.should =~ /asked you to explain/
+ mail.to_addrs.to_s.should == info_requests(:fancy_dog_request).user.name_and_email
+ mail.body =~ /(http:\/\/.*\/c\/(.*))/
+ mail_url = $1
+ mail_token = $2
+
+ session[:user_id].should be_nil
+ controller.test_code_redirect_by_email_token(mail_token, self) # XXX hack to avoid having to call User controller for email link
+ session[:user_id].should == info_requests(:fancy_dog_request).user.id
+
+ response.should render_template('show_response')
+ assigns[:info_request].should == info_requests(:fancy_dog_request)
+ end
+
+end
+
+
+