Sha256: ba9d51c3a2735ef11e75647d8ef6084d3322853ecf77a4dfc10a057410c475a6

Contents?: true

Size: 1.23 KB

Versions: 7

Compression:

Stored size: 1.23 KB

Contents

require 'spec_helper'
require 'email_spec'

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

  let(:reimbursement) { create(:reimbursement) }

  it "accepts a reimbursement id as an alternative to a Reimbursement object" do
    expect(Spree::Reimbursement).to receive(:find).with(reimbursement.id).and_return(reimbursement)

    Spree::ReimbursementMailer.reimbursement_email(reimbursement.id).body
  end

  context "emails must be translatable" do
    context "reimbursement_email" do
      context "pt-BR locale" do
        before do
          I18n.enforce_available_locales = false
          pt_br_shipped_email = { :spree => { :reimbursement_mailer => { :reimbursement_email => { :dear_customer => 'Caro Cliente,' } } } }
          I18n.backend.store_translations :'pt-BR', pt_br_shipped_email
          I18n.locale = :'pt-BR'
        end

        after do
          I18n.locale = I18n.default_locale
          I18n.enforce_available_locales = true
        end

        specify do
          reimbursement_email = Spree::ReimbursementMailer.reimbursement_email(reimbursement)
          expect(reimbursement_email.body).to include("Caro Cliente,")
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
solidus_core-1.2.3 spec/mailers/reimbursement_mailer_spec.rb
solidus_core-1.2.2 spec/mailers/reimbursement_mailer_spec.rb
solidus_core-1.2.1 spec/mailers/reimbursement_mailer_spec.rb
solidus_core-1.2.0 spec/mailers/reimbursement_mailer_spec.rb
solidus_core-1.2.0.rc2 spec/mailers/reimbursement_mailer_spec.rb
solidus_core-1.2.0.rc1 spec/mailers/reimbursement_mailer_spec.rb
solidus_core-1.2.0.beta1 spec/mailers/reimbursement_mailer_spec.rb