diff options
Diffstat (limited to 'spec/controllers')
-rw-r--r-- | spec/controllers/admin_general_controller_spec.rb | 7 | ||||
-rw-r--r-- | spec/controllers/admin_public_body_change_requests_controller_spec.rb | 35 |
2 files changed, 26 insertions, 16 deletions
diff --git a/spec/controllers/admin_general_controller_spec.rb b/spec/controllers/admin_general_controller_spec.rb index 971960762..cc2ec41b4 100644 --- a/spec/controllers/admin_general_controller_spec.rb +++ b/spec/controllers/admin_general_controller_spec.rb @@ -8,13 +8,8 @@ describe AdminGeneralController do before { basic_auth_login @request } it "should render the front page" do - get :index, :suppress_redirect => 1 - response.should render_template('index') - end - - it "should redirect to include trailing slash" do get :index - response.should redirect_to admin_general_index_url(:trailing_slash => true) + response.should render_template('index') end end diff --git a/spec/controllers/admin_public_body_change_requests_controller_spec.rb b/spec/controllers/admin_public_body_change_requests_controller_spec.rb index b478e851d..003510e60 100644 --- a/spec/controllers/admin_public_body_change_requests_controller_spec.rb +++ b/spec/controllers/admin_public_body_change_requests_controller_spec.rb @@ -15,21 +15,36 @@ 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 + post :update, { :id => @change_request.id } 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/ + context 'when a response and subject are passed' do + + it 'should send a response email to the user who requested the change' do + post :update, { :id => @change_request.id, + :response => 'Thanks but no', + :subject => 'Your request' } + 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 + + context 'when no response or subject are passed' do + + it 'should send a response email to the user who requested the change' do + post :update, { :id => @change_request.id } + deliveries = ActionMailer::Base.deliveries + deliveries.size.should == 0 + end end + end |