Sha256: 7579d00337dbd40e313d6ac6b4e6776257b93974853824693d3694e7144e7707

Contents?: true

Size: 1.16 KB

Versions: 10

Compression:

Stored size: 1.16 KB

Contents

require 'spec_helper'
require 'email_spec'

describe Spree::TestMailer, :type => :mailer do
  include EmailSpec::Helpers
  include EmailSpec::Matchers

  before { create(:store) }

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

  context ":from not set explicitly" do
    it "falls back to spree config" do
      message = Spree::TestMailer.test_email('test@example.com')
      expect(message.from).to eq([Spree::Store.current.mail_from_address])
    end
  end

  it "confirm_email accepts a user id as an alternative to a User object" do
    expect {
      Spree::TestMailer.test_email('test@example.com')
    }.not_to raise_error
  end

  context "action mailer host" do
    it "falls back to spree store url" do
      ActionMailer::Base.default_url_options = {}
      Spree::TestMailer.test_email('test@example.com').deliver_now
      expect(ActionMailer::Base.default_url_options[:host]).to eq(Spree::Store.current.url)
    end

    it "uses developer set host" do
      ActionMailer::Base.default_url_options[:host] = 'test.test'
      Spree::TestMailer.test_email('test@example.com').deliver_now
      expect(ActionMailer::Base.default_url_options[:host]).to eq('test.test')
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
spree_core-3.1.5 spec/mailers/test_mailer_spec.rb
spree_core-3.1.4 spec/mailers/test_mailer_spec.rb
spree_core-3.1.3 spec/mailers/test_mailer_spec.rb
spree_core-3.1.2 spec/mailers/test_mailer_spec.rb
spree_core-3.1.1 spec/mailers/test_mailer_spec.rb
spree_core-3.1.0 spec/mailers/test_mailer_spec.rb
spree_core-3.1.0.rc4 spec/mailers/test_mailer_spec.rb
spree_core-3.1.0.rc3 spec/mailers/test_mailer_spec.rb
spree_core-3.1.0.rc2 spec/mailers/test_mailer_spec.rb
spree_core-3.1.0.rc1 spec/mailers/test_mailer_spec.rb