aboutsummaryrefslogtreecommitdiffstats
path: root/spec/controllers
diff options
context:
space:
mode:
authorLouise Crow <louise.crow@gmail.com>2013-12-18 19:31:04 +0000
committerLouise Crow <louise.crow@gmail.com>2014-01-13 12:36:43 +0000
commitafbc8370d78fc4a453e0a768139f4bc7dd35d348 (patch)
treef6361d76462e5248bfb4ce82adb812700eb0eff4 /spec/controllers
parent2c4421b1b65065b4c81d5d3c45f67875e20f810e (diff)
Add form for closing change request without action
For cases where we don't want to make the change suggested. There doesn't seem to be any obvious default text to use in the response to the person who requested the change.
Diffstat (limited to 'spec/controllers')
-rw-r--r--spec/controllers/admin_public_body_change_requests_controller_spec.rb35
1 files changed, 35 insertions, 0 deletions
diff --git a/spec/controllers/admin_public_body_change_requests_controller_spec.rb b/spec/controllers/admin_public_body_change_requests_controller_spec.rb
new file mode 100644
index 000000000..b478e851d
--- /dev/null
+++ b/spec/controllers/admin_public_body_change_requests_controller_spec.rb
@@ -0,0 +1,35 @@
+# -*- coding: utf-8 -*-
+require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
+
+describe AdminPublicBodyChangeRequestsController, "editing a change request" do
+
+ it "should render the edit template" do
+ change_request = FactoryGirl.create(:add_body_request)
+ get :edit, :id => change_request.id
+ response.should render_template("edit")
+ end
+
+end
+
+describe AdminPublicBodyChangeRequestsController, 'updating a change request' do
+
+ before do
+ @change_request = FactoryGirl.create(:add_body_request)
+ post :update, { :id => @change_request.id,
+ :response => 'Thanks but no',
+ :subject => 'Your request' }
+ end
+
+ it 'should close the change request' do
+ PublicBodyChangeRequest.find(@change_request.id).is_open.should == false
+ end
+
+ it 'should send a response email to the user who requested the change' do
+ deliveries = ActionMailer::Base.deliveries
+ deliveries.size.should == 1
+ mail = deliveries[0]
+ mail.subject.should == 'Your request'
+ mail.to.should == [@change_request.get_user_email]
+ mail.body.should =~ /Thanks but no/
+ end
+end