Sha256: b86e662f19d3992d7fae0c8d607a6c97062dfc41a53b051d4f6670e6298ce6aa

Contents?: true

Size: 1.11 KB

Versions: 17

Compression:

Stored size: 1.11 KB

Contents

require 'spec_helper'

describe EffectiveEmailTemplates do
  describe '::get' do
    it 'finds templates by their slug' do
      template = create(:email_template, slug: 'a_unique_email_template_identifier')
      expect(
        EffectiveEmailTemplates.get(:a_unique_email_template_identifier)
      ).to eq( template )
    end

    context 'when the template does not exist' do
      before :each do
        @template = EffectiveEmailTemplates.get(:this_doesnt_exist)
      end

      it "returns a template object" do
        expect(@template).to be_a(Effective::EmailTemplate)
      end

      it 'returns a template object with a slug' do
        expect(@template.slug).to eq(:this_doesnt_exist)
      end

      it 'returns a template object without other attributes' do
        # The template automatically gets generated by Rail's ::serialize method but its an empty template
        expect(@template.template.render('')).to eq ''
        attributes = @template.attributes
        attributes.delete("slug")
        attributes.delete("template")
        expect(attributes.values.compact).to be_empty
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
effective_email_templates-0.6.1 spec/effective_email_templates_spec.rb
effective_email_templates-0.6.0 spec/effective_email_templates_spec.rb
effective_email_templates-0.5.1 spec/effective_email_templates_spec.rb
effective_email_templates-0.5.0 spec/effective_email_templates_spec.rb
effective_email_templates-0.4.6 spec/effective_email_templates_spec.rb
effective_email_templates-0.4.5 spec/effective_email_templates_spec.rb
effective_email_templates-0.4.4 spec/effective_email_templates_spec.rb
effective_email_templates-0.4.3 spec/effective_email_templates_spec.rb
effective_email_templates-0.4.2 spec/effective_email_templates_spec.rb
effective_email_templates-0.4.1 spec/effective_email_templates_spec.rb
effective_email_templates-0.4.0 spec/effective_email_templates_spec.rb
effective_email_templates-0.3.5 spec/effective_email_templates_spec.rb
effective_email_templates-0.3.4 spec/effective_email_templates_spec.rb
effective_email_templates-0.3.3 spec/effective_email_templates_spec.rb
effective_email_templates-0.3.1 spec/effective_email_templates_spec.rb
effective_email_templates-0.3.0 spec/effective_email_templates_spec.rb
effective_email_templates-0.2.8 spec/effective_email_templates_spec.rb