html_email_creator 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -5,5 +5,9 @@ module HtmlEmailCreator
5
5
  def photo(input, alt)
6
6
  "<img src=\"#{HtmlEmailCreator.settings.cdn_url}/#{input}\" alt=\"#{alt}\" border=\"0\" />"
7
7
  end
8
+
9
+ def download(input, text)
10
+ "<a href=\"#{HtmlEmailCreator.settings.cdn_url}/#{input}\">#{text}</a>"
11
+ end
8
12
  end
9
13
  end
@@ -1,3 +1,3 @@
1
1
  module HtmlEmailCreator
2
- VERSION = "1.0.1" unless defined?(::HtmlEmailCreator::VERSION)
2
+ VERSION = "1.0.2" unless defined?(::HtmlEmailCreator::VERSION)
3
3
  end
@@ -1,24 +1,24 @@
1
1
  require File.join(File.dirname(__FILE__), '..', 'spec_helper')
2
2
 
3
3
  describe HtmlEmailCreator::Layout do
4
-
4
+
5
5
  describe "with custom variables" do
6
6
  it "should replace variables" do
7
7
  HtmlEmailCreator::Layout.new("foo {{ bar }}").to_html("bar" => "great bar").should eql("foo great bar")
8
8
  end
9
-
9
+
10
10
  it "should just ignore the variable if the variable was not found" do
11
11
  HtmlEmailCreator::Layout.new("foo {{ bar }}").to_html.should eql("foo ")
12
12
  end
13
13
  end
14
-
14
+
15
15
  describe "with built-in extensions" do
16
-
16
+
17
17
  describe "aweber" do
18
18
  let(:aweber) { HtmlEmailCreator::Extensions.new.built_in("aweber") }
19
19
  let(:none) { {} }
20
-
21
- it "should replace Aweber extension keys correctly if aweber extension is being used" do
20
+
21
+ it "should replace Aweber extension keys correctly if aweber extension is being used" do
22
22
  HtmlEmailCreator::Layout.new("{{ after_7_days }}", aweber).to_html.should eql('{!date dayname+7}')
23
23
  HtmlEmailCreator::Layout.new("{{ after_7_days }}", none).to_html.should eql('')
24
24
  end
@@ -30,20 +30,19 @@ describe HtmlEmailCreator::Layout do
30
30
  end
31
31
  end
32
32
  end
33
-
33
+
34
34
  describe "with custom extensions" do
35
-
35
+
36
36
  it "should replace custom extension keys correctly use custom extensions from configuration to render the layout" do
37
37
  run_in_fixture_dir("with_config") do
38
38
  HtmlEmailCreator::Layout.new("{{ foobar }}").to_html.should eql('Hi, this is foobar.')
39
39
  HtmlEmailCreator::Layout.new("{{ great }}").to_html.should eql('Hi, this is **great**')
40
40
  end
41
41
  end
42
-
43
- end
44
-
42
+ end
43
+
45
44
  describe "with built-in filters" do
46
-
45
+
47
46
  it "should generate photo url correctly" do
48
47
  run_in_fixture_dir("with_config") do
49
48
  markdown = '{{ "hello/world.jpg" | photo: "Custom alt text" }}'
@@ -51,5 +50,13 @@ describe HtmlEmailCreator::Layout do
51
50
  HtmlEmailCreator::Layout.new(markdown).to_html.should eql(output)
52
51
  end
53
52
  end
53
+
54
+ it "should generate download url correctly" do
55
+ run_in_fixture_dir("with_config") do
56
+ markdown = '{{ "book.pdf" | download: "Download cool book" }}'
57
+ output = '<a href="http://cdn.example.com/book.pdf">Download cool book</a>'
58
+ HtmlEmailCreator::Layout.new(markdown).to_html.should eql(output)
59
+ end
60
+ end
54
61
  end
55
62
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 1
7
7
  - 0
8
- - 1
9
- version: 1.0.1
8
+ - 2
9
+ version: 1.0.2
10
10
  platform: ruby
11
11
  authors:
12
12
  - Pekka Mattila
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2011-11-03 00:00:00 +02:00
17
+ date: 2011-11-04 00:00:00 +02:00
18
18
  default_executable: html_email_creator
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency