diff --git a/Dockerfile b/Dockerfile index 6391a48..08b5e46 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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/ diff --git a/test/integration/notify_mailer_sending_test.rb b/test/integration/notify_mailer_sending_test.rb new file mode 100644 index 0000000..9e599fc --- /dev/null +++ b/test/integration/notify_mailer_sending_test.rb @@ -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