Skip to content

Commit

Permalink
Merge pull request #139 from dxw/add-simple-send-integration-tests
Browse files Browse the repository at this point in the history
Add simple send integration tests
  • Loading branch information
mec authored Apr 5, 2024
2 parents 0d8e020 + 91f0143 commit b5b17fe
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
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: "[email protected]"
).template_email.deliver_now

assert result.instance_of? Mail::Message
end

test "can send a template email with personalisation" do
result = NotifyMailer.with(
to: "[email protected]",
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: "[email protected]",
subject: "View email subject"
).view_email.deliver_now

assert result.instance_of? Mail::Message
end
end

0 comments on commit b5b17fe

Please sign in to comment.