From ec08e59f9b9e84a0efbc9caa5a7d5ee4b8ca64b7 Mon Sep 17 00:00:00 2001 From: louise Date: Wed, 15 Apr 2009 18:15:30 +0000 Subject: Log when anyone other than the request owner updates its status --- spec/controllers/request_controller_spec.rb | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'spec/controllers/request_controller_spec.rb') diff --git a/spec/controllers/request_controller_spec.rb b/spec/controllers/request_controller_spec.rb index e3b1ebc5a..57d092afb 100644 --- a/spec/controllers/request_controller_spec.rb +++ b/spec/controllers/request_controller_spec.rb @@ -365,6 +365,14 @@ describe RequestController, "when classifying an information request" do post_status('rejected') end + it 'should log a status update event' do + expected_params = {:user_id => users(:silly_name_user).id, + :old_described_state => 'waiting_response', + :described_state => 'rejected'} + @dog_request.should_receive(:log_event).with("status_update", expected_params) + post_status('rejected') + end + it 'should send an email to the requester letting them know someone has updated the status of their request' do RequestMailer.should_receive(:deliver_old_unclassified_updated) post_status('rejected') @@ -398,6 +406,14 @@ describe RequestController, "when classifying an information request" do post_status('rejected') end + it 'should log a status update event' do + expected_params = {:user_id => @admin_user.id, + :old_described_state => 'waiting_response', + :described_state => 'rejected'} + @dog_request.should_receive(:log_event).with("status_update", expected_params) + post_status('rejected') + end + it 'should show the message "The request status has been updated"' do post_status('rejected') flash[:notice].should == '

The request status has been updated

' @@ -428,6 +444,11 @@ describe RequestController, "when classifying an information request" do @dog_request.get_last_response_event.calculated_state.should == 'rejected' end + it 'should not log a status update event' do + @dog_request.should_not_receive(:log_event) + post_status('rejected') + end + it 'should not send an email to the requester letting them know someone has updated the status of their request' do RequestMailer.should_not_receive(:deliver_old_unclassified_updated) post_status('rejected') -- cgit v1.2.3