aboutsummaryrefslogtreecommitdiffstats
path: root/spec/controllers
diff options
context:
space:
mode:
authorMatthew Landauer <matthew@openaustralia.org>2013-03-04 09:38:07 +1100
committerMatthew Landauer <matthew@openaustralia.org>2013-03-04 09:38:07 +1100
commit28e65f615c24b96225d24f3f1e0c03f229f8fe4e (patch)
tree25386c570ea3ff7a98ef0a3b322889c1e51ee75a /spec/controllers
parentd16f5b29e106d6f5f8191b7f881386f281f98691 (diff)
Fix bug when user not owner of request changing state to requires_admin email should come from user making the change
Diffstat (limited to 'spec/controllers')
-rw-r--r--spec/controllers/request_controller_spec.rb15
1 files changed, 12 insertions, 3 deletions
diff --git a/spec/controllers/request_controller_spec.rb b/spec/controllers/request_controller_spec.rb
index 0f39d01ce..567add473 100644
--- a/spec/controllers/request_controller_spec.rb
+++ b/spec/controllers/request_controller_spec.rb
@@ -1366,7 +1366,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')
+ @dog_request.should_receive(:set_described_state).with('rejected', users(:silly_name_user))
post_status('rejected')
end
@@ -1405,6 +1405,15 @@ describe RequestController, "when classifying an information request" do
response.should redirect_to play_url
end
end
+
+ it "should send a mail from the user who changed the state to requires_admin" do
+ post :describe_state, :incoming_message => { :described_state => "requires_admin" }, :id => @dog_request.id, :incoming_message_id => incoming_messages(:useless_incoming_message), :last_info_request_event_id => @dog_request.last_event_id_needing_description
+
+ deliveries = ActionMailer::Base.deliveries
+ deliveries.size.should == 1
+ mail = deliveries[0]
+ mail.from_addrs.first.to_s.should == users(:silly_name_user).name_and_email
+ end
end
end
@@ -1420,7 +1429,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')
+ @dog_request.should_receive(:set_described_state).with('rejected', @admin_user)
post_status('rejected')
end
@@ -1471,7 +1480,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')
+ @dog_request.should_receive(:set_described_state).with('rejected', @admin_user)
post_status('rejected')
end