Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add simple send integration tests #139

Merged
merged 1 commit into from
Apr 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ RUN bundle install
# Copy over intergration test files
COPY test/mailers/ test/mailers/
COPY test/system/ test/system/
COPY test/integration test/integration
COPY test/application_system_test_case.rb /test/application_system_test_case.rb
COPY test/app/mailers/ app/mailers/
COPY test/app/views/ app/views/
Expand Down
36 changes: 36 additions & 0 deletions test/integration/notify_mailer_sending_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
require "test_helper"

class NotifyMailerSendingTest < ActionDispatch::IntegrationTest
# these tests are designed to run in our integration environment and make real
# requests to Notify, the API key we use WILL NOT actually send any email.
#
# Once this spec runs, you will see these email in the Notify 'API Integrations'
# log which requires an login for our integration test Notify account and only
# remain for 7 days.
#
test "can send a template email" do
result = NotifyMailer.with(
to: "template.email@notifications.service.gov.uk"
).template_email.deliver_now

assert result.instance_of? Mail::Message
end

test "can send a template email with personalisation" do
result = NotifyMailer.with(
to: "template.email@notifications.service.gov.uk",
name: "Test Name"
).template_with_personalisation.deliver_now

assert result.instance_of? Mail::Message
end

test "can send a view email" do
result = NotifyMailer.with(
to: "view.email@notifications.service.gov.uk",
subject: "View email subject"
).view_email.deliver_now

assert result.instance_of? Mail::Message
end
end
Loading