diff options
author | francis <francis> | 2008-09-21 23:21:50 +0000 |
---|---|---|
committer | francis <francis> | 2008-09-21 23:21:50 +0000 |
commit | 93b96516fdcac8f0f2884631e1475e1784ec1327 (patch) | |
tree | 884d44fabc7dd9e2202dd55fad5cbc1bb8dbb395 /spec/controllers/request_controller_spec.rb | |
parent | af36ec43e4b6062e604c74ef1aae9f88b9ad0b8e (diff) |
Test for requires admin email.
Diffstat (limited to 'spec/controllers/request_controller_spec.rb')
-rw-r--r-- | spec/controllers/request_controller_spec.rb | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/spec/controllers/request_controller_spec.rb b/spec/controllers/request_controller_spec.rb index a66ec7eaf..72abd89ae 100644 --- a/spec/controllers/request_controller_spec.rb +++ b/spec/controllers/request_controller_spec.rb @@ -247,8 +247,23 @@ describe RequestController, "when classifying an individual response" do info_requests(:fancy_dog_request).get_last_response_event.calculated_state.should == 'rejected' end - #response.should redirect_to(:action => 'show', :id => info_requests(:fancy_dog_request)) - #incoming_messages(:useless_incoming_message).user_classified.should == true + it "should send email when classified as requires_admin" do + info_requests(:fancy_dog_request).awaiting_description.should == true + session[:user_id] = users(:bob_smith_user).id + post :describe_state, :incoming_message => { :described_state => "requires_admin" }, :id => info_requests(:fancy_dog_request).id, :incoming_message_id => incoming_messages(:useless_incoming_message), :last_info_request_event_id => info_request_events(:silly_comment_event).id, :submitted_describe_state => 1 + response.should redirect_to(:action => 'show', :url_title => info_requests(:fancy_dog_request).url_title) + + info_requests(:fancy_dog_request).reload + info_requests(:fancy_dog_request).awaiting_description.should == false + info_requests(:fancy_dog_request).described_state.should == 'requires_admin' + info_requests(:fancy_dog_request).get_last_response_event.calculated_state.should == 'requires_admin' + + deliveries = ActionMailer::Base.deliveries + deliveries.size.should == 1 + mail = deliveries[0] + mail.body.should =~ /as being unusual/ + mail.from_addrs.to_s.should == users(:bob_smith_user).name_and_email + end end describe RequestController, "when sending a followup message" do |