Sha256: 45250325ab69c35a39726cfd517c82da92cd6b92e473e76d80e34bec4f63e58a

Contents?: true

Size: 1.15 KB

Versions: 6

Compression:

Stored size: 1.15 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

6 entries across 6 versions & 1 rubygems

Version Path
spree_core-3.3.0.rc1 spec/mailers/test_mailer_spec.rb
spree_core-3.2.1 spec/mailers/test_mailer_spec.rb
spree_core-3.2.0 spec/mailers/test_mailer_spec.rb
spree_core-3.2.0.rc3 spec/mailers/test_mailer_spec.rb
spree_core-3.2.0.rc2 spec/mailers/test_mailer_spec.rb
spree_core-3.2.0.rc1 spec/mailers/test_mailer_spec.rb