require File.join(File.dirname(__FILE__), '..', 'spec_helper')
describe HtmlEmailCreator::Processor do
let(:processor) {
html = <<-eos
Title
Header 1
col1 | col2 |
row 1 col 1 | row 1 col 2 |
row 2 col 1 | row 2 col 2 |
This is simple email with link


Header 2
eos
HtmlEmailCreator::Processor.new(html)
}
describe "#to_html" do
let(:html) { processor.to_html }
it "should wrap headers with divs" do
html.should include('')
end
it "should inline styles" do
html.should include('')
end
end
describe "#to_plain_text" do
let(:text) { processor.to_plain_text }
it "format plain text message in a nice way" do
expected_output = <<-eos
=============================================================================
Header 1
col1
* row 1 col 1
* row 2 col 1
col2
* row 1 col 2
* row 2 col 2
This is simple email with link (http://link1.com)
Great image (http://cdn.example.com/foo/bar)
Signup (http://signup)
-----------------------------------------------------------------------------
Header 2
- list 1
- list 2
eos
text.should eq(expected_output.strip)
end
end
describe "aweber escaping" do
it "should not escape aweber markup if using aweber extension" do
html = <<-eos
{!date dayname+7}
eos
run_in_fixture_dir("with_config") do
processor = HtmlEmailCreator::Processor.new(html)
processor.to_html.should include("{!date dayname+7}
")
processor.to_plain_text.should include("{!date dayname+7}")
end
end
end
end