Sha256: f6706990665bf0cbe16145fc867fefb4cd29be4e93123553193c0e496a779aa4
Contents?: true
Size: 1.49 KB
Versions: 1
Compression:
Stored size: 1.49 KB
Contents
require 'spec_helper' require 'effective_email_templates/template_importer' describe EffectiveEmailTemplates::TemplateImporter do describe 'well formatted template files' do it 'imports templates from view files' do Effective::EmailTemplate.delete_all expect{ EffectiveEmailTemplates::TemplateImporter.invoke }.to change { Effective::EmailTemplate.count } end it 'does not import templates if a template already exists in the database' do Effective::EmailTemplate.delete_all expect{ EffectiveEmailTemplates::TemplateImporter.invoke }.to change { Effective::EmailTemplate.count } expect{ EffectiveEmailTemplates::TemplateImporter.invoke }.to_not change { Effective::EmailTemplate.count } end it 'does not print errors' do importer = EffectiveEmailTemplates::TemplateImporter.new expect(importer).to_not receive(:print_errors) EffectiveEmailTemplates::TemplateImporter.invoke(importer) end end describe 'poorly formatted template files' do let(:filepath) { Rails.root.join('app', 'views', 'user_liquid', 'some_template.liquid') } before do File.open(filepath, 'w') do |f| f.write("--\n---\nbody") end end after do File.delete(filepath) end it 'prints errors if there is a problem with a template' do importer = EffectiveEmailTemplates::TemplateImporter.new expect(importer).to receive(:print_errors) EffectiveEmailTemplates::TemplateImporter.invoke(importer) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
effective_email_templates-0.3.3 | spec/lib/effective_email_templates/template_importer_spec.rb~ |