Skip to content

Commit

Permalink
Check for ActionMailer before adding mailer hook
Browse files Browse the repository at this point in the history
ActionMailer is optional on Rails and should also be optional here.

By checking for the presence of the class, we allow apps that don't use action mailer to use the gem.
  • Loading branch information
Draiken authored Oct 6, 2020
1 parent 8ebf772 commit 68f73c8
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/cucumber/rails/hooks/mail.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# frozen_string_literal: true

Before do
ActionMailer::Base.deliveries = []
if defined?(::ActionMailer)
Before do
ActionMailer::Base.deliveries = []
end
end

0 comments on commit 68f73c8

Please sign in to comment.