Sha256: f65587fa91a2491299e482d875993e4d1f10838f51fa2413c3a56cd5699038ee

Contents?: true

Size: 773 Bytes

Versions: 23

Compression:

Stored size: 773 Bytes

Contents

# frozen_string_literal: true

require "spec_helper"

shared_examples "localised email" do
  let(:user) { build(:user, locale: locale) }

  context "when the user has a custom locale" do
    let(:locale) { "ca" }

    it "uses the user's locale" do
      expect(mail.subject).to eq(subject)
      expect(mail.body.encoded).to match(body)
    end
  end

  context "when the user does not have a custom locale" do
    let(:locale) { nil }

    it "uses the default locale" do
      expect(mail.subject).to eq(default_subject)
      expect(mail.body.encoded).to match(default_body)
    end
  end

  context "when the user doesn't have an email" do
    let(:user) { create(:user, :deleted) }

    it "does nothing" do
      expect(mail.deliver_now).to be_nil
    end
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
decidim-core-0.26.10 lib/decidim/core/test/shared_examples/localised_email.rb
decidim-core-0.26.9 lib/decidim/core/test/shared_examples/localised_email.rb
decidim-core-0.26.8 lib/decidim/core/test/shared_examples/localised_email.rb
decidim-core-0.26.7 lib/decidim/core/test/shared_examples/localised_email.rb
decidim-core-0.26.5 lib/decidim/core/test/shared_examples/localised_email.rb
decidim-core-0.26.4 lib/decidim/core/test/shared_examples/localised_email.rb
decidim-core-0.26.3 lib/decidim/core/test/shared_examples/localised_email.rb
decidim-core-0.26.2 lib/decidim/core/test/shared_examples/localised_email.rb
decidim-core-0.26.1 lib/decidim/core/test/shared_examples/localised_email.rb
decidim-core-0.26.0 lib/decidim/core/test/shared_examples/localised_email.rb
decidim-core-0.26.0.rc2 lib/decidim/core/test/shared_examples/localised_email.rb
decidim-core-0.26.0.rc1 lib/decidim/core/test/shared_examples/localised_email.rb
decidim-core-0.25.2 lib/decidim/core/test/shared_examples/localised_email.rb
decidim-core-0.25.1 lib/decidim/core/test/shared_examples/localised_email.rb
decidim-core-0.25.0 lib/decidim/core/test/shared_examples/localised_email.rb
decidim-core-0.25.0.rc4 lib/decidim/core/test/shared_examples/localised_email.rb
decidim-core-0.25.0.rc3 lib/decidim/core/test/shared_examples/localised_email.rb
decidim-core-0.25.0.rc2 lib/decidim/core/test/shared_examples/localised_email.rb
decidim-core-0.25.0.rc1 lib/decidim/core/test/shared_examples/localised_email.rb
decidim-core-0.24.3 lib/decidim/core/test/shared_examples/localised_email.rb