Skip to content

Commit

Permalink
Only define MailerExampleGroup if ActionMailer is loaded
Browse files Browse the repository at this point in the history
Closes #117.
  • Loading branch information
dchelimsky committed Jul 5, 2010
1 parent c830981 commit 199b1a2
Showing 1 changed file with 19 additions and 17 deletions.
36 changes: 19 additions & 17 deletions lib/rspec/rails/example/mailer_example_group.rb
@@ -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

0 comments on commit 199b1a2

Please sign in to comment.