forked from rspec/rspec-rails
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Only define MailerExampleGroup if ActionMailer is loaded
Closes #117.
- Loading branch information
1 parent
c830981
commit 199b1a2
Showing
1 changed file
with
19 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,26 @@ | ||
module RSpec::Rails | ||
module MailerExampleGroup | ||
extend ActiveSupport::Concern | ||
extend RSpec::Rails::ModuleInclusion | ||
if defined?(ActionMailer) | ||
module RSpec::Rails | ||
module MailerExampleGroup | ||
extend ActiveSupport::Concern | ||
extend RSpec::Rails::ModuleInclusion | ||
|
||
include ActionMailer::TestCase::Behavior | ||
include Webrat::Matchers | ||
include RSpec::Matchers | ||
include ActionMailer::TestCase::Behavior | ||
include Webrat::Matchers | ||
include RSpec::Matchers | ||
|
||
included do | ||
include ::Rails.application.routes.url_helpers | ||
options = ::Rails.configuration.action_mailer.default_url_options | ||
options.each { |key, value| default_url_options[key] = value } if options | ||
end | ||
included do | ||
include ::Rails.application.routes.url_helpers | ||
options = ::Rails.configuration.action_mailer.default_url_options | ||
options.each { |key, value| default_url_options[key] = value } if options | ||
end | ||
|
||
module ClassMethods | ||
def mailer_class | ||
describes | ||
module ClassMethods | ||
def mailer_class | ||
describes | ||
end | ||
end | ||
end | ||
|
||
RSpec.configure &include_self_when_dir_matches('spec','mailers') | ||
RSpec.configure &include_self_when_dir_matches('spec','mailers') | ||
end | ||
end | ||
end |