premailer 1.7.3 → 1.7.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,4 @@
1
+ class Premailer
2
+ # Premailer version.
3
+ VERSION = '1.7.8'.freeze
4
+ end
@@ -1,6 +1,13 @@
1
+ GEM_ROOT = File.dirname(__FILE__).freeze unless defined?(GEM_ROOT)
2
+
3
+ lib_path = File.expand_path('lib', GEM_ROOT)
4
+ $LOAD_PATH.unshift(lib_path) unless $LOAD_PATH.include? lib_path
5
+
6
+ require 'premailer/version'
7
+
1
8
  Gem::Specification.new do |s|
2
9
  s.name = "premailer"
3
- s.version = "1.7.3"
10
+ s.version = Premailer::VERSION.dup
4
11
  s.date = Time.now.strftime('%Y-%m-%d')
5
12
  s.summary = "Preflight for HTML e-mail."
6
13
  s.email = "code@dunae.ca"
@@ -8,15 +15,17 @@ Gem::Specification.new do |s|
8
15
  s.description = "Improve the rendering of HTML emails by making CSS inline, converting links and warning about unsupported code."
9
16
  s.has_rdoc = true
10
17
  s.author = "Alex Dunae"
11
- s.rdoc_options << '--all' << '--inline-source' << '--line-numbers' << '--charset' << 'utf-8'
12
- s.extra_rdoc_files = ["README.rdoc"]
13
18
  s.files = `git ls-files`.split("\n")
14
19
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
15
20
  s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
16
21
  s.add_dependency('css_parser', '>= 1.1.9')
17
22
  s.add_dependency('htmlentities', '>= 4.0.0')
23
+ s.add_development_dependency "bundler", "~> 1.3"
24
+ s.add_development_dependency('rake', ['~> 0.8', '!= 0.9.0'])
18
25
  s.add_development_dependency('hpricot', '>= 0.8.3')
19
26
  s.add_development_dependency('nokogiri', '>= 1.4.4')
20
- s.add_development_dependency('rake', ['~> 0.8', '!= 0.9.0'])
21
- s.add_development_dependency('rdoc', '>= 2.4.2')
27
+ s.add_development_dependency('yard', '~> 0.8.7')
28
+ s.add_development_dependency('redcarpet', '~> 3.0')
29
+ s.add_development_dependency "yard-redcarpet-ext", "~> 0.0.3"
22
30
  end
31
+
@@ -2,27 +2,20 @@ $:.unshift File.expand_path('../lib', __FILE__)
2
2
 
3
3
  require 'rake'
4
4
  require 'rake/testtask'
5
- require 'rdoc/task'
6
- require 'rubygems/package_task'
7
- require 'fileutils'
8
- require 'premailer'
5
+ require "bundler/gem_tasks"
6
+ require 'yard'
9
7
 
10
- def gemspec
11
- @gemspec ||= begin
12
- file = File.expand_path('../premailer.gemspec', __FILE__)
13
- eval(File.read(file), binding, file)
14
- end
15
- end
8
+ GEM_ROOT = File.dirname(__FILE__).freeze unless defined?(GEM_ROOT)
16
9
 
17
- Gem::PackageTask.new(gemspec) do |pkg|
18
- pkg.need_tar = true
19
- end
10
+ lib_path = File.expand_path('lib', GEM_ROOT)
11
+ $LOAD_PATH.unshift(lib_path) unless $LOAD_PATH.include? lib_path
20
12
 
21
- desc 'Default: parse a URL.'
22
- task :default => [:inline]
13
+ require 'premailer/version'
23
14
 
24
15
  desc 'Parse a URL and write out the output.'
25
16
  task :inline do
17
+ require 'premailer'
18
+
26
19
  url = ENV['url']
27
20
  output = ENV['output']
28
21
 
@@ -32,15 +25,17 @@ task :inline do
32
25
  end
33
26
 
34
27
  premailer = Premailer.new(url, :warn_level => Premailer::Warnings::SAFE, :verbose => true, :adapter => :nokogiri)
35
- fout = File.open(output, "w")
36
- fout.puts premailer.to_inline_css
37
- fout.close
28
+ File.open(output, "w") do |fout|
29
+ fout.puts premailer.to_inline_css
30
+ end
38
31
 
39
32
  puts "Succesfully parsed '#{url}' into '#{output}'"
40
33
  puts premailer.warnings.length.to_s + ' CSS warnings were found'
41
34
  end
42
35
 
43
36
  task :text do
37
+ require 'premailer'
38
+
44
39
  url = ENV['url']
45
40
  output = ENV['output']
46
41
 
@@ -50,9 +45,9 @@ task :text do
50
45
  end
51
46
 
52
47
  premailer = Premailer.new(url, :warn_level => Premailer::Warnings::SAFE)
53
- fout = File.open(output, "w")
54
- fout.puts premailer.to_plain_text
55
- fout.close
48
+ File.open(output, "w") do |fout|
49
+ fout.puts premailer.to_plain_text
50
+ end
56
51
 
57
52
  puts "Succesfully parsed '#{url}' into '#{output}'"
58
53
  end
@@ -62,8 +57,8 @@ Rake::TestTask.new do |t|
62
57
  t.verbose = false
63
58
  end
64
59
 
65
- RDoc::Task.new do |rd|
66
- rd.main = "README.rdoc"
67
- rd.rdoc_files.include("README.rdoc", "LICENSE.rdoc", "lib/**/*.rb")
68
- rd.title = 'Premailer Documentation'
60
+ YARD::Rake::YardocTask.new do |yard|
61
+ yard.options << "--title='Premailer #{Premailer::VERSION} Documentation'"
69
62
  end
63
+
64
+ task :default => [:test]
@@ -0,0 +1,9 @@
1
+ <html>
2
+ <link rel="stylesheet" type="text/css" href="styles.css">
3
+ <body>
4
+ <p>
5
+ The following line should not make this html be identified as a URI
6
+ http://foobar.com
7
+ </p>
8
+ </body>
9
+ </html>
@@ -1,7 +1,7 @@
1
1
  # encoding: UTF-8
2
2
  require File.expand_path(File.dirname(__FILE__)) + '/helper'
3
3
 
4
- class TestPremailer < Test::Unit::TestCase
4
+ class TestPremailer < Premailer::TestCase
5
5
  def test_related_attributes
6
6
  flunk 'Not implemented'
7
7
  local_setup
@@ -3,5 +3,38 @@ $:.unshift(File.expand_path(File.dirname(__FILE__) + '/../lib'))
3
3
  $:.unshift(File.expand_path(File.dirname(__FILE__) + '/../'))
4
4
  require 'rubygems'
5
5
  require 'test/unit'
6
- require 'webrick'
6
+ require 'webmock/test_unit'
7
7
  require 'premailer'
8
+
9
+ class Premailer::TestCase < Test::Unit::TestCase
10
+ BASE_URI = 'http://premailer.dev/'
11
+ BASE_PATH = File.expand_path(File.dirname(__FILE__)) + '/files'
12
+
13
+ def setup
14
+ stub_request(:any, /premailer\.dev\/*/).to_return do |request|
15
+ file_path = BASE_PATH + URI.parse(request.uri).path
16
+ if File.exists?(file_path)
17
+ { :status => 200, :body => File.open(file_path) }
18
+ else
19
+ { :status => 404, :body => "#{file_path} not found" }
20
+ end
21
+ end
22
+ end
23
+
24
+ def default_test; end
25
+
26
+ protected
27
+ def local_setup(f = 'base.html', opts = {})
28
+ base_file = BASE_PATH + '/' + f
29
+ premailer = Premailer.new(base_file, opts)
30
+ premailer.to_inline_css
31
+ @doc = premailer.processed_doc
32
+ end
33
+
34
+ def remote_setup(f = 'base.html', opts = {})
35
+ @premailer = Premailer.new(BASE_URI + "#{f}", opts)
36
+ @premailer.to_inline_css
37
+ @doc = @premailer.processed_doc
38
+ end
39
+
40
+ end
@@ -1,6 +1,6 @@
1
1
  require File.expand_path(File.dirname(__FILE__)) + '/helper'
2
2
 
3
- class TestAdapter < Test::Unit::TestCase
3
+ class TestAdapter < Premailer::TestCase
4
4
 
5
5
  def test_default_to_best_available
6
6
  require 'hpricot'
@@ -1,7 +1,7 @@
1
1
  # encoding: utf-8
2
2
  require File.expand_path(File.dirname(__FILE__)) + '/helper'
3
3
 
4
- class TestHtmlToPlainText < Test::Unit::TestCase
4
+ class TestHtmlToPlainText < Premailer::TestCase
5
5
  include HtmlToPlainText
6
6
 
7
7
  def test_to_plain_text_with_fragment
@@ -102,13 +102,33 @@ END_HTML
102
102
  assert lens.max <= 20
103
103
  end
104
104
 
105
+ def test_img_alt_tags
106
+ # ensure html imag tags that aren't self-closed are parsed,
107
+ # along with accepting both '' and "" as attribute quotes
108
+
109
+ # <img alt="" />
110
+ assert_plaintext 'Example ( http://example.com/ )', '<a href="http://example.com/"><img src="http://example.ru/hello.jpg" alt="Example"/></a>'
111
+ # <img alt="">
112
+ assert_plaintext 'Example ( http://example.com/ )', '<a href="http://example.com/"><img src="http://example.ru/hello.jpg" alt="Example"></a>'
113
+ # <img alt='' />
114
+ assert_plaintext 'Example ( http://example.com/ )', "<a href='http://example.com/'><img src='http://example.ru/hello.jpg' alt='Example'/></a>"
115
+ # <img alt=''>
116
+ assert_plaintext 'Example ( http://example.com/ )', "<a href='http://example.com/'><img src='http://example.ru/hello.jpg' alt='Example'></a>"
117
+ end
118
+
105
119
  def test_links
106
120
  # basic
107
121
  assert_plaintext 'Link ( http://example.com/ )', '<a href="http://example.com/">Link</a>'
108
122
 
109
123
  # nested html
110
124
  assert_plaintext 'Link ( http://example.com/ )', '<a href="http://example.com/"><span class="a">Link</span></a>'
111
-
125
+
126
+ # nested html with new line
127
+ assert_plaintext 'Link ( http://example.com/ )', "<a href='http://example.com/'>\n\t<span class='a'>Link</span>\n\t</a>"
128
+
129
+ # mailto
130
+ assert_plaintext 'Contact Us ( contact@example.org )', "<a href='mailto:contact@example.org'>Contact Us</a>"
131
+
112
132
  # complex link
113
133
  assert_plaintext 'Link ( http://example.com:80/~user?aaa=bb&c=d,e,f#foo )', '<a href="http://example.com:80/~user?aaa=bb&amp;c=d,e,f#foo">Link</a>'
114
134
 
@@ -128,6 +148,9 @@ END_HTML
128
148
 
129
149
  # unsubscribe
130
150
  assert_plaintext 'Link ( [[!unsubscribe]] )', '<a href="[[!unsubscribe]]">Link</a>'
151
+
152
+ # empty link gets dropped, and shouldn't run forever
153
+ assert_plaintext(("This is some more text\n\n" * 14 + "This is some more text"), "<a href=\"test\"></a>#{"\n<p>This is some more text</p>" * 15}")
131
154
  end
132
155
 
133
156
  # see https://github.com/alexdunae/premailer/issues/72
@@ -1,6 +1,7 @@
1
+ # encoding: UTF-8
1
2
  require File.expand_path(File.dirname(__FILE__)) + '/helper'
2
3
 
3
- class TestLinks < Test::Unit::TestCase
4
+ class TestLinks < Premailer::TestCase
4
5
  def test_empty_query_string
5
6
  assert_nothing_raised do
6
7
  premailer = Premailer.new('<p>Test</p>', :with_html_string => true, :link_query_string => ' ')
@@ -138,4 +139,47 @@ class TestLinks < Test::Unit::TestCase
138
139
  assert_equal 'https://my.example.com:8080/', pdoc.at('#l01').attributes['href'].to_s
139
140
  assert_equal 'https://my.example.com:8080/images/', pdoc.at('#l04').attributes['href'].to_s
140
141
  end
142
+
143
+ def test_convertable_inline_links
144
+ convertable = [
145
+ 'my/path/to',
146
+ 'other/path',
147
+ '/'
148
+ ]
149
+
150
+ html = convertable.collect {|url| "<a href='#{url}'>Link</a>" }
151
+ premailer = Premailer.new(html.to_s, :base_url => "http://example.com", :with_html_string => true)
152
+
153
+ premailer.processed_doc.search('a').each do |el|
154
+ href = el.attributes['href'].to_s
155
+ assert(href =~ /http:\/\/example.com/, "link #{href} is not absolute")
156
+ end
157
+ end
158
+
159
+ def test_non_convertable_inline_links
160
+ not_convertable = [
161
+ '%DONOTCONVERT%',
162
+ '{DONOTCONVERT}',
163
+ '[DONOTCONVERT]',
164
+ '<DONOTCONVERT>',
165
+ '{@msg-txturl}',
166
+ '[[!unsubscribe]]',
167
+ '#relative',
168
+ 'tel:5555551212',
169
+ 'mailto:premailer@example.com',
170
+ 'ftp://example.com',
171
+ 'gopher://gopher.floodgap.com/1/fun/twitpher',
172
+ 'cid:13443452066.10392logo.jpeg@inline_attachment'
173
+ ]
174
+
175
+ html = not_convertable.collect {|url| "<a href='#{url}'>Link</a>" }
176
+
177
+ premailer = Premailer.new(html.to_s, :base_url => "example.com", :with_html_string => true)
178
+ premailer.to_inline_css
179
+
180
+ premailer.processed_doc.search('a').each do |el|
181
+ href = el.attributes['href'].to_s
182
+ assert not_convertable.include?(href), "link #{href} should not be converted: see #{not_convertable.inspect}"
183
+ end
184
+ end
141
185
  end
@@ -4,7 +4,7 @@ require File.expand_path(File.dirname(__FILE__)) + '/helper'
4
4
  # Random tests for specific issues.
5
5
  #
6
6
  # The test suite will be cleaned up at some point soon.
7
- class TestMisc < Test::Unit::TestCase
7
+ class TestMisc < Premailer::TestCase
8
8
 
9
9
  # in response to http://github.com/alexdunae/premailer/issues#issue/4
10
10
  #
@@ -115,10 +115,10 @@ END_HTML
115
115
 
116
116
  premailer = Premailer.new(html, :with_html_string => true, :preserve_styles => false, :adapter => adapter)
117
117
  premailer.to_inline_css
118
- assert_nil premailer.processed_doc.at('head link')
118
+ assert_nil premailer.processed_doc.at('body link')
119
119
 
120
120
  # should be preserved as unmergeable
121
- assert_match /red !important/i, premailer.processed_doc.at('body style').inner_html
121
+ assert_match /red !important/i, premailer.processed_doc.at('head style').inner_html
122
122
  end
123
123
  end
124
124
 
@@ -131,7 +131,7 @@ END_HTML
131
131
 
132
132
  premailer = Premailer.new(html, :with_html_string => true, :verbose => true)
133
133
  premailer.to_inline_css
134
- assert_match /a\:hover[\s]*\{[\s]*color\:[\s]*red[\s]*!important;[\s]*\}/i, premailer.processed_doc.at('body style').inner_html
134
+ assert_match /a\:hover[\s]*\{[\s]*color\:[\s]*red[\s]*!important;[\s]*\}/i, premailer.processed_doc.at('head style').inner_html
135
135
  end
136
136
 
137
137
  def test_unmergable_rules_with_no_body
@@ -168,6 +168,8 @@ END_HTML
168
168
  end
169
169
 
170
170
  # in response to https://github.com/alexdunae/premailer/issues#issue/7
171
+ #
172
+ # fails sometimes in JRuby, see https://github.com/alexdunae/premailer/issues/79
171
173
  def test_parsing_bad_markup_around_tables
172
174
  html = <<END_HTML
173
175
  <html>
@@ -207,7 +209,7 @@ END_HTML
207
209
 
208
210
  premailer = Premailer.new(html, :with_html_string => true, :adapter => :nokogiri)
209
211
  premailer.to_inline_css
210
- assert_equal 'color: green !important;', premailer.processed_doc.search('p').first.attributes['style'].to_s
212
+ assert_equal 'color: green !important', premailer.processed_doc.search('p').first.attributes['style'].to_s
211
213
  end
212
214
 
213
215
  # in response to https://github.com/alexdunae/premailer/issues/28
@@ -230,4 +232,47 @@ END_HTML
230
232
  assert_match /margin: 0 auto;/, premailer.processed_doc.search('#page').first.attributes['style'].to_s
231
233
  assert_match /border-style: solid none solid solid;/, premailer.processed_doc.search('p').first.attributes['style'].to_s
232
234
  end
235
+
236
+ def test_sorting_style_attributes
237
+ html = <<END_HTML
238
+ <html>
239
+ <style type="text/css">
240
+ #page { right: 10px; left: 5px }
241
+ </style>
242
+ <body>
243
+ <div id='page'>test</div>
244
+ </body>
245
+ </html>
246
+ END_HTML
247
+
248
+ premailer = Premailer.new(html, :with_html_string => true)
249
+ premailer.to_inline_css
250
+ assert_equal "left: 5px; right: 10px", premailer.processed_doc.search('#page').first.attributes['style'].to_s
251
+ end
252
+
253
+ def test_removing_scripts
254
+ html = <<END_HTML
255
+ <html>
256
+ <head>
257
+ <script>script to be removed</script>
258
+ </head>
259
+ <body>
260
+ content
261
+ </body>
262
+ </html>
263
+ END_HTML
264
+
265
+ [:nokogiri, :hpricot].each do |adapter|
266
+ premailer = Premailer.new(html, :with_html_string => true, :remove_scripts => true, :adapter => adapter)
267
+ premailer.to_inline_css
268
+ assert_equal 0, premailer.processed_doc.search('script').length
269
+ end
270
+
271
+ [:nokogiri, :hpricot].each do |adapter|
272
+ premailer = Premailer.new(html, :with_html_string => true, :remove_scripts => false, :adapter => adapter)
273
+ premailer.to_inline_css
274
+ assert_equal 1, premailer.processed_doc.search('script').length
275
+ end
276
+ end
277
+
233
278
  end
@@ -1,25 +1,8 @@
1
- # encoding: UTF-8
2
- require File.expand_path(File.dirname(__FILE__)) + '/helper'
3
-
4
- class TestPremailer < Test::Unit::TestCase
5
- include WEBrick
6
-
7
- def setup
8
- # from http://nullref.se/blog/2006/5/17/testing-with-webrick
9
- @uri_base = "http://localhost:12000"
10
- www_root = File.expand_path(File.dirname(__FILE__)) + '/files/'
1
+ # -*- encoding: UTF-8 -*-
11
2
 
12
- @server_thread = Thread.new do
13
- s = WEBrick::HTTPServer.new(:Port => 12000, :DocumentRoot => www_root, :Logger => Log.new(nil, BasicLog::ERROR), :AccessLog => [])
14
- port = s.config[:Port]
15
- begin
16
- s.start
17
- ensure
18
- s.shutdown
19
- end
20
- end
21
- end
3
+ require File.expand_path(File.dirname(__FILE__)) + '/helper'
22
4
 
5
+ class TestPremailer < Premailer::TestCase
23
6
  def test_special_characters_nokogiri
24
7
  html = '<p>cédille c&eacute; & garçon gar&#231;on à &agrave; &nbsp; &amp; &copy;</p>'
25
8
  premailer = Premailer.new(html, :with_html_string => true, :adapter => :nokogiri)
@@ -49,7 +32,6 @@ class TestPremailer < Test::Unit::TestCase
49
32
  premailer.to_inline_css
50
33
  assert_equal 'c&eacute;dille c&eacute; &amp; gar&ccedil;on gar&ccedil;on &agrave; &agrave; &nbsp; &amp;', premailer.processed_doc.at('p').inner_html
51
34
  end
52
-
53
35
 
54
36
  def test_detecting_html
55
37
  [:nokogiri, :hpricot].each do |adapter|
@@ -105,7 +87,8 @@ END_HTML
105
87
  end
106
88
 
107
89
  def test_importing_local_css
108
- [:nokogiri, :hpricot].each do |adapter|
90
+ # , :hpricot
91
+ [:nokogiri].each do |adapter|
109
92
  local_setup('base.html', :adapter => adapter)
110
93
 
111
94
  # noimport.css (print stylesheet) sets body { background } to red
@@ -231,27 +214,65 @@ END_HTML
231
214
  end
232
215
  end
233
216
 
217
+ def test_include_link_tags_option
218
+ local_setup('base.html', :adapter => :nokogiri, :include_link_tags => true)
219
+ assert_match /1\.231/, @doc.at('body').attributes['style'].to_s
220
+ assert_match /display: none/, @doc.at('.hide').attributes['style'].to_s
234
221
 
235
- protected
236
- def local_setup(f = 'base.html', opts = {})
237
- base_file = File.expand_path(File.dirname(__FILE__)) + '/files/' + f
238
- premailer = Premailer.new(base_file, opts)
239
- premailer.to_inline_css
240
- @doc = premailer.processed_doc
222
+ local_setup('base.html', :adapter => :nokogiri, :include_link_tags => false)
223
+ assert_no_match /1\.231/, @doc.at('body').attributes['style'].to_s
224
+ assert_match /display: none/, @doc.at('.hide').attributes['style'].to_s
241
225
  end
242
-
243
- def remote_setup(f = 'base.html', opts = {})
244
- # increment the port number for testing multiple adapters
245
- @premailer = Premailer.new(@uri_base + "/#{f}", opts)
246
- @premailer.to_inline_css
247
- @doc = @premailer.processed_doc
226
+
227
+ def test_include_style_tags_option
228
+ local_setup('base.html', :adapter => :nokogiri, :include_style_tags => true)
229
+ assert_match /1\.231/, @doc.at('body').attributes['style'].to_s
230
+ assert_match /display: block/, @doc.at('#iphone').attributes['style'].to_s
231
+
232
+ local_setup('base.html', :adapter => :nokogiri, :include_style_tags => false)
233
+ assert_match /1\.231/, @doc.at('body').attributes['style'].to_s
234
+ assert_no_match /display: block/, @doc.at('#iphone').attributes['style'].to_s
248
235
  end
249
236
 
250
- def teardown
251
- if @server_thread
252
- @server_thread.kill
253
- @server_thread.join(5)
254
- @server_thread = nil
237
+ def test_input_encoding
238
+ html_special_characters = "Ää, Öö, Üü"
239
+ expected_html = "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\" \"http://www.w3.org/TR/REC-html40/loose.dtd\">\n<html><body><p>" + html_special_characters + "</p></body></html>\n"
240
+ pm = Premailer.new(html_special_characters, :with_html_string => true, :adapter => :nokogiri, :input_encoding => "UTF-8")
241
+ assert_equal expected_html, pm.to_inline_css
242
+ end
243
+
244
+ def test_meta_encoding_downcase
245
+ meta_encoding = '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">'
246
+ expected_html = Regexp.new(Regexp.escape('<meta http-equiv="Content-Type" content="text/html; charset=utf-8">'), Regexp::IGNORECASE)
247
+ pm = Premailer.new(meta_encoding, :with_html_string => true, :adapter => :nokogiri, :input_encoding => "utf-8")
248
+ assert_match expected_html, pm.to_inline_css
249
+ end
250
+
251
+ def test_meta_encoding_upcase
252
+ meta_encoding = '<meta http-equiv="Content-Type" content="text/html; charset=utf-8">'
253
+ expected_html = Regexp.new(Regexp.escape('<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">'), Regexp::IGNORECASE)
254
+ pm = Premailer.new(meta_encoding, :with_html_string => true, :adapter => :nokogiri, :input_encoding => "UTF-8")
255
+ assert_match expected_html, pm.to_inline_css
256
+ end
257
+
258
+ def test_htmlentities
259
+ html_entities = "&#8217;"
260
+ expected_html = "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\" \"http://www.w3.org/TR/REC-html40/loose.dtd\">\n<html><body><p>'</p></body></html>\n"
261
+ pm = Premailer.new(html_entities, :with_html_string => true, :adapter => :nokogiri, :replace_html_entities => true)
262
+ assert_equal expected_html, pm.to_inline_css
263
+ end
264
+
265
+ # If a line other than the first line in the html string begins with a URI
266
+ # Premailer should not identify the html string as a URI. Otherwise the following
267
+ # exception would be raised: ActionView::Template::Error: bad URI(is not URI?)
268
+ def test_line_starting_with_uri_in_html_with_linked_css
269
+ files_base = File.expand_path(File.dirname(__FILE__)) + '/files/'
270
+ html_string = IO.read(File.join(files_base, 'html_with_uri.html'))
271
+
272
+ assert_nothing_raised do
273
+ premailer = Premailer.new(html_string, :with_html_string => true)
274
+ premailer.to_inline_css
255
275
  end
256
276
  end
277
+
257
278
  end