Skip to content

Commit

Permalink
Fix: Notification mailer specs
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-griffen committed Oct 27, 2023
1 parent 40b899e commit afe49e5
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
12 changes: 6 additions & 6 deletions spec/fixtures/files/notification_mailer/daily-summary.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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



Expand Down
2 changes: 1 addition & 1 deletion spec/fixtures/files/notification_mailer/overdue.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion spec/fixtures/files/notification_mailer/very_overdue.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
10 changes: 5 additions & 5 deletions spec/mailers/notification_mailer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit afe49e5

Please sign in to comment.