diff --git a/spec/fixtures/files/notification_mailer/daily-summary.txt b/spec/fixtures/files/notification_mailer/daily-summary.txt index b34f2ba69f9..0ea9ab04502 100644 --- a/spec/fixtures/files/notification_mailer/daily-summary.txt +++ b/spec/fixtures/files/notification_mailer/daily-summary.txt @@ -41,7 +41,7 @@ Late expenses claims What's happened: Ministry of fact keeping have not replied to your FOI request Late expenses claims promptly, as normally required by law. Click on the link below to remind them to reply. -http://test.host/en/profile/sign_in?r=%2Fen%2Frequest%2F$LATE_EXPENSES_CLAIMS_MOF_ID$%2Ffollowups%2Fnew +http://test.host/en/profile/sign_in?r=%2Fen%2Frequest%2F$LATE_EXPENSES_CLAIMS_MOF_URL_TITLE$%2Ffollowups%2Fnew Extremely late expenses claims @@ -50,7 +50,7 @@ Extremely late expenses claims What's happened: Ministry of fact keeping have still not replied to your FOI request Extremely late expenses claims, as normally required by law. Click on the link below to tell them to reply. You might like to ask for an internal review, asking them to find out why their response to the request has been so slow. -http://test.host/en/profile/sign_in?r=%2Fen%2Frequest%2F$EXTREMELY_LATE_EXPENSES_CLAIMS_MOF_ID$%2Ffollowups%2Fnew +http://test.host/en/profile/sign_in?r=%2Fen%2Frequest%2F$EXTREMELY_LATE_EXPENSES_CLAIMS_MOF_URL_TITLE$%2Ffollowups%2Fnew Misdelivered letters @@ -114,8 +114,8 @@ What's happened: You can see the requests and remind the bodies to respond with the following links: - Ministry of fact keeping: http://test.host/en/profile/sign_in?r=%2Fen%2Frequest%2F$LATE_FOI_REQUESTS_MOF_ID$%2Ffollowups%2Fnew - Minor infractions quango: http://test.host/en/profile/sign_in?r=%2Fen%2Frequest%2F$LATE_FOI_REQUESTS_2_MIQ_ID$%2Ffollowups%2Fnew + Ministry of fact keeping: http://test.host/en/profile/sign_in?r=%2Fen%2Frequest%2F$LATE_FOI_REQUESTS_MOF_URL_TITLE$%2Ffollowups%2Fnew + Minor infractions quango: http://test.host/en/profile/sign_in?r=%2Fen%2Frequest%2F$LATE_FOI_REQUESTS_2_MIQ_URL_TITLE$%2Ffollowups%2Fnew Ignored FOI requests @@ -130,8 +130,8 @@ What's happened: You can see the requests and tell the bodies to respond with the following links. You might like to ask for internal reviews, asking the bodies to find out why responses to the requests have been so slow. - Ministry of fact keeping: http://test.host/en/profile/sign_in?r=%2Fen%2Frequest%2F$IGNORED_FOI_REQUESTS_MOF_ID$%2Ffollowups%2Fnew - Minor infractions quango: http://test.host/en/profile/sign_in?r=%2Fen%2Frequest%2F$IGNORED_FOI_REQUESTS_2_MIQ_ID$%2Ffollowups%2Fnew + Ministry of fact keeping: http://test.host/en/profile/sign_in?r=%2Fen%2Frequest%2F$IGNORED_FOI_REQUESTS_MOF_URL_TITLE$%2Ffollowups%2Fnew + Minor infractions quango: http://test.host/en/profile/sign_in?r=%2Fen%2Frequest%2F$IGNORED_FOI_REQUESTS_2_MIQ_URL_TITLE$%2Ffollowups%2Fnew diff --git a/spec/fixtures/files/notification_mailer/overdue.txt b/spec/fixtures/files/notification_mailer/overdue.txt index 2ad08008cb7..d849554ab1b 100644 --- a/spec/fixtures/files/notification_mailer/overdue.txt +++ b/spec/fixtures/files/notification_mailer/overdue.txt @@ -4,7 +4,7 @@ They have not replied to your FOI request Here is a character that needs quoting Click on the link below to send a message to Test public body reminding them to reply to your request. -http://test.host/en/profile/sign_in?r=%2Fen%2Frequest%2FINFO_REQUEST_ID%2Ffollowups%2Fnew +http://test.host/en/profile/sign_in?r=%2Fen%2Frequest%2FINFO_REQUEST_URL_TITLE%2Ffollowups%2Fnew -- the Alaveteli team diff --git a/spec/fixtures/files/notification_mailer/very_overdue.txt b/spec/fixtures/files/notification_mailer/very_overdue.txt index 43a11522ed9..2df84ef4b8c 100644 --- a/spec/fixtures/files/notification_mailer/very_overdue.txt +++ b/spec/fixtures/files/notification_mailer/very_overdue.txt @@ -4,6 +4,6 @@ They have still not replied to your FOI request Here is a character that needs q Click on the link below to send a message to Test public body telling them to reply to your request. You might like to ask for an internal review, asking them to find out why their response to the request has been so slow. -http://test.host/en/profile/sign_in?r=%2Fen%2Frequest%2FINFO_REQUEST_ID%2Ffollowups%2Fnew +http://test.host/en/profile/sign_in?r=%2Fen%2Frequest%2FINFO_REQUEST_URL_TITLE%2Ffollowups%2Fnew -- the Alaveteli team diff --git a/spec/mailers/notification_mailer_spec.rb b/spec/mailers/notification_mailer_spec.rb index 06dc28f7ec9..5070fa0a7ff 100644 --- a/spec/mailers/notification_mailer_spec.rb +++ b/spec/mailers/notification_mailer_spec.rb @@ -351,7 +351,7 @@ # HACK: We can't control the IDs of the requests or incoming messages create # a data structure of mappings here so that we can replace keys in fixture # files with the ID that will end up in the URL. - let(:id_mappings) do + let(:url_id_mappings) do all_notifications.each_with_object({}) do |notification, data| event = notification.info_request_event case event.event_type @@ -362,7 +362,7 @@ else request = event.info_request key = "#{request.url_title}_#{request.public_body.url_name}".upcase - data["#{key}_ID"] = request.id + data["#{key}_URL_TITLE"] = request.url_title end end end @@ -387,7 +387,7 @@ mail = NotificationMailer.daily_summary(user, all_notifications) expected_message = load_file_fixture( "notification_mailer/daily-summary.txt", 'r:utf-8') - id_mappings.each do |key, id| + url_id_mappings.each do |key, id| expected_message.gsub!("$#{key}$", id.to_s) end expect(mail.body.encoded).to eq(expected_message) @@ -722,7 +722,7 @@ mail = NotificationMailer.overdue_notification(notification) expected_message = load_file_fixture( "notification_mailer/overdue.txt", 'r:utf-8') - expected_message.gsub!(/INFO_REQUEST_ID/, info_request.id.to_s) + expected_message.gsub!(/INFO_REQUEST_URL_TITLE/, info_request.url_title) expect(mail.body.encoded).to eq(expected_message) end end @@ -793,7 +793,7 @@ mail = NotificationMailer.very_overdue_notification(notification) expected_message = load_file_fixture( "notification_mailer/very_overdue.txt", 'r:utf-8') - expected_message.gsub!(/INFO_REQUEST_ID/, info_request.id.to_s) + expected_message.gsub!(/INFO_REQUEST_URL_TITLE/, info_request.url_title) expect(mail.body.encoded).to eq(expected_message) end end