diff options
author | Louise Crow <louise.crow@gmail.com> | 2013-03-13 09:16:48 -0700 |
---|---|---|
committer | Louise Crow <louise.crow@gmail.com> | 2013-03-13 09:16:48 -0700 |
commit | d5045bf83cff620545b93c185e411216f814ffdd (patch) | |
tree | 04f9a953cbfcdeba9c3d1affd6cd40dc6b61dd33 /spec/models | |
parent | bf6fc976fb29adbc8d46336d3d010c99effcaef0 (diff) | |
parent | 20ec9b49f3407223b7cbcb25a636ba44a4b6967c (diff) |
Merge remote-tracking branch 'openaustralia_github/one_support_email_on_admin_attention_state' into develop
Conflicts:
Gemfile.lock
app/controllers/request_controller.rb
app/models/request_mailer.rb
app/views/admin_general/index.rhtml
spec/models/request_mailer_spec.rb
Diffstat (limited to 'spec/models')
-rw-r--r-- | spec/models/info_request_spec.rb | 4 | ||||
-rw-r--r-- | spec/models/request_mailer_spec.rb | 14 |
2 files changed, 12 insertions, 6 deletions
diff --git a/spec/models/info_request_spec.rb b/spec/models/info_request_spec.rb index 544852f91..728a538f9 100644 --- a/spec/models/info_request_spec.rb +++ b/spec/models/info_request_spec.rb @@ -426,8 +426,8 @@ describe InfoRequest do before do Time.stub!(:now).and_return(Time.utc(2007, 11, 9, 23, 59)) - @mock_comment_event = safe_mock_model(InfoRequestEvent, :created_at => Time.now - 23.days, :event_type => 'comment') - @mock_response_event = safe_mock_model(InfoRequestEvent, :created_at => Time.now - 22.days, :event_type => 'response') + @mock_comment_event = safe_mock_model(InfoRequestEvent, :created_at => Time.now - 23.days, :event_type => 'comment', :response? => false) + @mock_response_event = safe_mock_model(InfoRequestEvent, :created_at => Time.now - 22.days, :event_type => 'response', :response? => true) @info_request = InfoRequest.new(:prominence => 'normal', :awaiting_description => true, :info_request_events => [@mock_response_event, @mock_comment_event]) diff --git a/spec/models/request_mailer_spec.rb b/spec/models/request_mailer_spec.rb index dd5a322fb..40133eedc 100644 --- a/spec/models/request_mailer_spec.rb +++ b/spec/models/request_mailer_spec.rb @@ -28,7 +28,7 @@ describe RequestMailer, " when receiving incoming mail" do receive_incoming_mail('incoming-request-plain.email', 'dummy@localhost') ir.incoming_messages.size.should == 1 InfoRequest.holding_pen_request.incoming_messages.size.should == 1 - last_event = InfoRequest.holding_pen_request.incoming_messages[0].info_request.get_last_event + last_event = InfoRequest.holding_pen_request.incoming_messages[0].info_request.info_request_events.last last_event.params[:rejected_reason].should == "Could not identify the request from the email address" deliveries = ActionMailer::Base.deliveries @@ -48,7 +48,7 @@ describe RequestMailer, " when receiving incoming mail" do receive_incoming_mail('incoming-request-plain.email', ir.incoming_email, "") ir.incoming_messages.size.should == 1 InfoRequest.holding_pen_request.incoming_messages.size.should == 1 - last_event = InfoRequest.holding_pen_request.incoming_messages[0].info_request.get_last_event + last_event = InfoRequest.holding_pen_request.incoming_messages[0].info_request.info_request_events.last last_event.params[:rejected_reason].should =~ /there is no "From" address/ deliveries = ActionMailer::Base.deliveries @@ -68,7 +68,7 @@ describe RequestMailer, " when receiving incoming mail" do receive_incoming_mail('incoming-request-plain.email', ir.incoming_email, "frob@nowhere.com") ir.incoming_messages.size.should == 1 InfoRequest.holding_pen_request.incoming_messages.size.should == 1 - last_event = InfoRequest.holding_pen_request.incoming_messages[0].info_request.get_last_event + last_event = InfoRequest.holding_pen_request.incoming_messages[0].info_request.info_request_events.last last_event.params[:rejected_reason].should =~ /Only the authority can reply/ deliveries = ActionMailer::Base.deliveries @@ -153,7 +153,7 @@ describe RequestMailer, " when receiving incoming mail" do receive_incoming_mail('incoming-request-plain.email', ir.incoming_email) ir.incoming_messages.size.should == 1 InfoRequest.holding_pen_request.incoming_messages.size.should == 1 # arrives in holding pen - last_event = InfoRequest.holding_pen_request.incoming_messages[0].info_request.get_last_event + last_event = InfoRequest.holding_pen_request.incoming_messages[0].info_request.info_request_events.last last_event.params[:rejected_reason].should =~ /allow new responses from nobody/ # should be a message to admin regarding holding pen @@ -366,4 +366,10 @@ describe RequestMailer, 'requires_admin' do mail.body.should include('http://test.host/en/admin/request/show/123') end + + it "body should contain the message from the user" do + mail = RequestMailer.deliver_requires_admin(@info_request, nil, "Something has gone wrong") + mail.body.should include 'Something has gone wrong' + end + end |