Module: MandrillMailer

Defined in:
lib/mandrill_mailer/rspec_helper.rb,
lib/mandrill_mailer.rb,
lib/mandrill_mailer/mock.rb,
lib/mandrill_mailer/offline.rb,
lib/mandrill_mailer/railtie.rb,
lib/mandrill_mailer/version.rb,
lib/mandrill_mailer/core_mailer.rb,
lib/mandrill_mailer/arg_formatter.rb,
lib/mandrill_mailer/message_mailer.rb,
lib/mandrill_mailer/template_mailer.rb,
lib/mandrill_mailer/mandrill_message_later.rb,
lib/mandrill_mailer/mandrill_template_later.rb

Overview

MandrilMailer helper module that requires custom matchers for use in RSpec specs. Example usage:

In spec/spec_helper.rb):

RSpec.configure do |config|

# ...
require "mandrill_mailer/rspec_helper"
config.include MandrillMailer::RSpecHelper

end

In spec/mailers/user_mailer_spec.rb):

require “rails_helper” s RSpec.describe UserMailer do

let(:user) { create(:user) }

context ".welcome" do
  let(:mailer) { described_class.welcome(user) }

  subject { mailer }

  it 'has the correct data' do
    expect(mailer).to use_template('Welcome')
  end
end

end

Defined Under Namespace

Modules: RSpecHelper Classes: ArgFormatter, CoreMailer, MandrillMessageJob, MandrillTemplateJob, MessageMailer, Mock, Railtie, TemplateMailer

Constant Summary collapse

VERSION =
"1.8.0"

Class Method Summary collapse

Class Method Details

.configObject



21
22
23
# File 'lib/mandrill_mailer.rb', line 21

def self.config
  MandrillMailer::Railtie.config.mandrill_mailer
end

.configure(&block) ⇒ Object



13
14
15
16
17
18
19
# File 'lib/mandrill_mailer.rb', line 13

def self.configure(&block)
  if block_given?
    block.call(MandrillMailer::Railtie.config.mandrill_mailer)
  else
    MandrillMailer::Railtie.config.mandrill_mailer
  end
end

.deliveriesObject



24
25
26
# File 'lib/mandrill_mailer/offline.rb', line 24

def self.deliveries
  @deliveries ||= []
end