aboutsummaryrefslogtreecommitdiffstats
path: root/spec/mailers
diff options
context:
space:
mode:
authorLouise Crow <louise.crow@gmail.com>2013-09-24 11:29:31 +0100
committerLouise Crow <louise.crow@gmail.com>2013-09-24 11:29:31 +0100
commitd8deb8418b4cd26c68eb1301959e156c19b111e2 (patch)
tree99c346db95d17be9c5105ce47d5f3ac8e943e952 /spec/mailers
parent8459314b691f5b02277035219cd58f510d100a77 (diff)
parent75542416a1cc36b353ade557b1bc4f729b02423a (diff)
Merge branch 'release/0.14'0.14
Conflicts: locale/bg/app.po locale/fr/app.po locale/fr_CA/app.po locale/he_IL/app.po locale/hr/app.po locale/it/app.po locale/nb_NO/app.po locale/pl/app.po locale/sv/app.po locale/vi/app.po
Diffstat (limited to 'spec/mailers')
-rw-r--r--spec/mailers/request_mailer_spec.rb20
1 files changed, 11 insertions, 9 deletions
diff --git a/spec/mailers/request_mailer_spec.rb b/spec/mailers/request_mailer_spec.rb
index 23806b35b..4e0765921 100644
--- a/spec/mailers/request_mailer_spec.rb
+++ b/spec/mailers/request_mailer_spec.rb
@@ -204,10 +204,10 @@ describe RequestMailer, "when sending reminders to requesters to classify a resp
before do
Time.stub!(:now).and_return(Time.utc(2007, 11, 12, 23, 59))
@mock_event = mock_model(InfoRequestEvent)
- @mock_response = mock_model(IncomingMessage)
+ @mock_response = mock_model(IncomingMessage, :user_can_view? => true)
@mock_user = mock_model(User)
- @mock_request = mock_model(InfoRequest, :get_last_response_event_id => @mock_event.id,
- :get_last_response => @mock_response,
+ @mock_request = mock_model(InfoRequest, :get_last_public_response_event_id => @mock_event.id,
+ :get_last_public_response => @mock_response,
:user_id => 2,
:url_title => 'test_title',
:user => @mock_user)
@@ -230,10 +230,12 @@ describe RequestMailer, "when sending reminders to requesters to classify a resp
it 'should ask for all requests that are awaiting description and whose latest response is older
than the number of days given and that are not the holding pen' do
expected_conditions = [ "awaiting_description = ?
- AND (SELECT created_at
- FROM info_request_events
- WHERE info_request_events.info_request_id = info_requests.id
- AND info_request_events.event_type = 'response'
+ AND (SELECT info_request_events.created_at
+ FROM info_request_events, incoming_messages
+ WHERE info_request_events.info_request_id = info_requests.id
+ AND info_request_events.event_type = 'response'
+ AND incoming_messages.id = info_request_events.incoming_message_id
+ AND incoming_messages.prominence = 'normal'
ORDER BY created_at desc LIMIT 1) < ?
AND url_title != 'holding_pen'
AND user_id IS NOT NULL".split(' ').join(' '),
@@ -252,7 +254,7 @@ describe RequestMailer, "when sending reminders to requesters to classify a resp
end
it 'should raise an error if a request does not have a last response event id' do
- @mock_request.stub!(:get_last_response_event_id).and_return(nil)
+ @mock_request.stub!(:get_last_public_response_event_id).and_return(nil)
expected_message = "internal error, no last response while making alert new response reminder, request id #{@mock_request.id}"
lambda{ send_alerts }.should raise_error(expected_message)
end
@@ -289,7 +291,7 @@ describe RequestMailer, "when sending reminders to requesters to classify a resp
mock_sent_alert.should_receive(:info_request=).with(@mock_request)
mock_sent_alert.should_receive(:user=).with(@mock_user)
mock_sent_alert.should_receive(:alert_type=).with('new_response_reminder_1')
- mock_sent_alert.should_receive(:info_request_event_id=).with(@mock_request.get_last_response_event_id)
+ mock_sent_alert.should_receive(:info_request_event_id=).with(@mock_request.get_last_public_response_event_id)
mock_sent_alert.should_receive(:save!)
send_alerts
end