diff options
-rw-r--r-- | app/controllers/request_controller.rb | 3 | ||||
-rw-r--r-- | app/views/request_mailer/requires_admin.rhtml | 2 | ||||
-rw-r--r-- | spec/controllers/request_controller_spec.rb | 24 |
3 files changed, 24 insertions, 5 deletions
diff --git a/app/controllers/request_controller.rb b/app/controllers/request_controller.rb index f2b9150e0..c5788d131 100644 --- a/app/controllers/request_controller.rb +++ b/app/controllers/request_controller.rb @@ -407,7 +407,8 @@ class RequestController < ApplicationController end # Make the state change - info_request.set_described_state(params[:incoming_message][:described_state], authenticated_user) + info_request.set_described_state(params[:incoming_message][:described_state], authenticated_user, + params[:incoming_message][:message]) # If you're not the *actual* requester. e.g. you are playing the # classification game, or you're doing this just because you are an diff --git a/app/views/request_mailer/requires_admin.rhtml b/app/views/request_mailer/requires_admin.rhtml index cc056799b..9989f051e 100644 --- a/app/views/request_mailer/requires_admin.rhtml +++ b/app/views/request_mailer/requires_admin.rhtml @@ -1,4 +1,4 @@ -<%= raw @message.strip %> +<%= raw @message %> --------------------------------------------------------------------- <%=@reported_by.name%> <%= _('has reported an')%> <%=@info_request.law_used_short%> diff --git a/spec/controllers/request_controller_spec.rb b/spec/controllers/request_controller_spec.rb index 219c04c4a..c42a3a3f2 100644 --- a/spec/controllers/request_controller_spec.rb +++ b/spec/controllers/request_controller_spec.rb @@ -1318,7 +1318,7 @@ describe RequestController, "when classifying an information request" do it 'should classify the request' do @dog_request.stub!(:calculate_status).and_return('rejected') - @dog_request.should_receive(:set_described_state).with('rejected', users(:silly_name_user)) + @dog_request.should_receive(:set_described_state).with('rejected', users(:silly_name_user), nil) post_status('rejected') end @@ -1381,7 +1381,7 @@ describe RequestController, "when classifying an information request" do it 'should update the status of the request' do @dog_request.stub!(:calculate_status).and_return('rejected') - @dog_request.should_receive(:set_described_state).with('rejected', @admin_user) + @dog_request.should_receive(:set_described_state).with('rejected', @admin_user, nil) post_status('rejected') end @@ -1432,7 +1432,7 @@ describe RequestController, "when classifying an information request" do it 'should update the status of the request' do @dog_request.stub!(:calculate_status).and_return('rejected') - @dog_request.should_receive(:set_described_state).with('rejected', @admin_user) + @dog_request.should_receive(:set_described_state).with('rejected', @admin_user, nil) post_status('rejected') end @@ -1519,6 +1519,24 @@ describe RequestController, "when classifying an information request" do mail.from_addrs.first.to_s.should == @request_owner.name_and_email end + context "message is included when classifying as requires_admin" do + it "should send an email including the message" do + post :describe_state, + :incoming_message => { + :described_state => "requires_admin", + :message => "Something weird happened" }, + :id => @dog_request.id, + :last_info_request_event_id => @dog_request.last_event_id_needing_description + + deliveries = ActionMailer::Base.deliveries + deliveries.size.should == 1 + mail = deliveries[0] + mail.body.should =~ /as needing admin/ + mail.body.should =~ /Something weird happened/ + end + end + + it 'should say it is showing advice as to what to do next' do post_status('rejected') flash[:notice].should match(/Here is what to do now/) |