Sha256: ce10b840dd26b05706f0d4015d93a95a18af7f6c61820743b5b382671d44a8ec

Contents?: true

Size: 1.04 KB

Versions: 14

Compression:

Stored size: 1.04 KB

Contents

# frozen_string_literal: true
##############################################################################
#                               Email Plugin
##############################################################################
#
# The approach to this plugin is twofold. First it uses the excellent email_spec
# gem to add helpers and matchers to any spec file with :email => true set.
# Secondly, it will also clear all deliveries from ActionMailer if it is loaded.
#
# https://github.com/bmabey/email-spec/
#
begin
  require 'email_spec'

  RSpec.configure do |config|
    config.include EmailSpec::Helpers,          :email => true
    config.include EmailSpec::Matchers,         :email => true
    config.include EmailSpec::MailerDeliveries, :email => true
  end
rescue LoadError
end

if defined? ActionMailer
  RSpec.configure do |config|
    config.before(:each, :email => true) do
      if defined?(ActionMailer) && ActionMailer::Base.delivery_method == :cache
        mailer.clear_cache
      else
        deliveries.clear
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
rspeckled-0.0.30 lib/rspeckled/plugins/email.rb
rspeckled-0.0.29 lib/rspeckled/plugins/email.rb
rspeckled-0.0.28 lib/rspeckled/plugins/email.rb
rspeckled-0.0.27 lib/rspeckled/plugins/email.rb
rspeckled-0.0.26 lib/rspeckled/plugins/email.rb
rspeckled-0.0.25 lib/rspeckled/plugins/email.rb
rspeckled-0.0.24 lib/rspeckled/plugins/email.rb
rspeckled-0.0.23 lib/rspeckled/plugins/email.rb
rspeckled-0.0.22 lib/rspeckled/plugins/email.rb
rspeckled-0.0.21 lib/rspeckled/plugins/email.rb
rspeckled-0.0.20 lib/rspeckled/plugins/email.rb
rspeckled-0.0.19 lib/rspeckled/plugins/email.rb
rspeckled-0.0.18 lib/rspeckled/plugins/email.rb
rspeckled-0.0.17 lib/rspeckled/plugins/email.rb