awesomemailer 0.0.3 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,7 @@
1
+ 0.1.0
2
+ * Full test coverage and moved to Nokogiri from Hpricot. Also
3
+ added autoload so the gem is there when you need it but won't
4
+ bog down your app startup anymore. Yay!
1
5
  0.0.3
2
6
  * Added Sprockets-based loading for local files. Now your mailers
3
7
  work with local assets written with something other than CSS!
data/Gemfile CHANGED
@@ -1,9 +1,13 @@
1
1
  source 'http://rubygems.org'
2
2
 
3
- gem 'css_parser', '>= 1.2.5'#, :git => 'https://github.com/alexdunae/css_parser.git'
4
- gem 'hpricot', '>= 0.8'
3
+ gem 'actionmailer', '>= 3.2'
4
+ gem 'addressable'
5
+ gem 'css_parser', '>= 1.2.5'
6
+ gem 'nokogiri', '>= 1.5.6'
5
7
 
6
8
  group :test do
7
- gem 'actionmailer', '>= 3.0'
8
- gem 'jeweler'
9
+ gem 'guard-rspec', require: false
10
+ gem 'jeweler', require: false
11
+ gem 'rspec', require: false
12
+ gem 'simplecov', require: false
9
13
  end
data/Gemfile.lock CHANGED
@@ -1,61 +1,95 @@
1
1
  GEM
2
2
  remote: http://rubygems.org/
3
3
  specs:
4
- abstract (1.0.0)
5
- actionmailer (3.0.2)
6
- actionpack (= 3.0.2)
7
- mail (~> 2.2.9)
8
- actionpack (3.0.2)
9
- activemodel (= 3.0.2)
10
- activesupport (= 3.0.2)
11
- builder (~> 2.1.2)
12
- erubis (~> 2.6.6)
13
- i18n (~> 0.4.1)
14
- rack (~> 1.2.1)
15
- rack-mount (~> 0.6.13)
16
- rack-test (~> 0.5.6)
17
- tzinfo (~> 0.3.23)
18
- activemodel (3.0.2)
19
- activesupport (= 3.0.2)
20
- builder (~> 2.1.2)
21
- i18n (~> 0.4.1)
22
- activesupport (3.0.2)
23
- addressable (2.2.6)
24
- builder (2.1.2)
25
- css_parser (1.2.5)
4
+ actionmailer (3.2.8)
5
+ actionpack (= 3.2.8)
6
+ mail (~> 2.4.4)
7
+ actionpack (3.2.8)
8
+ activemodel (= 3.2.8)
9
+ activesupport (= 3.2.8)
10
+ builder (~> 3.0.0)
11
+ erubis (~> 2.7.0)
12
+ journey (~> 1.0.4)
13
+ rack (~> 1.4.0)
14
+ rack-cache (~> 1.2)
15
+ rack-test (~> 0.6.1)
16
+ sprockets (~> 2.1.3)
17
+ activemodel (3.2.8)
18
+ activesupport (= 3.2.8)
19
+ builder (~> 3.0.0)
20
+ activesupport (3.2.8)
21
+ i18n (~> 0.6)
22
+ multi_json (~> 1.0)
23
+ addressable (2.3.2)
24
+ builder (3.0.4)
25
+ css_parser (1.2.6)
26
26
  addressable
27
- erubis (2.6.6)
28
- abstract (>= 1.0.0)
27
+ rdoc
28
+ diff-lcs (1.1.3)
29
+ erubis (2.7.0)
29
30
  git (1.2.5)
30
- hpricot (0.8.5)
31
- i18n (0.4.2)
32
- jeweler (1.6.4)
31
+ guard (1.4.0)
32
+ listen (>= 0.4.2)
33
+ thor (>= 0.14.6)
34
+ guard-rspec (1.2.1)
35
+ guard (>= 1.1)
36
+ hike (1.2.1)
37
+ i18n (0.6.1)
38
+ jeweler (1.8.4)
33
39
  bundler (~> 1.0)
34
40
  git (>= 1.2.5)
35
41
  rake
36
- mail (2.2.19)
37
- activesupport (>= 2.3.6)
42
+ rdoc
43
+ journey (1.0.4)
44
+ json (1.7.5)
45
+ listen (0.5.2)
46
+ mail (2.4.4)
38
47
  i18n (>= 0.4.0)
39
48
  mime-types (~> 1.16)
40
49
  treetop (~> 1.4.8)
41
- mime-types (1.17.2)
50
+ mime-types (1.19)
51
+ multi_json (1.3.7)
52
+ nokogiri (1.5.6)
42
53
  polyglot (0.3.3)
43
- rack (1.2.5)
44
- rack-mount (0.6.14)
45
- rack (>= 1.0.0)
46
- rack-test (0.5.7)
54
+ rack (1.4.1)
55
+ rack-cache (1.2)
56
+ rack (>= 0.4)
57
+ rack-test (0.6.2)
47
58
  rack (>= 1.0)
48
59
  rake (0.9.2.2)
49
- treetop (1.4.10)
60
+ rdoc (3.12)
61
+ json (~> 1.4)
62
+ rspec (2.11.0)
63
+ rspec-core (~> 2.11.0)
64
+ rspec-expectations (~> 2.11.0)
65
+ rspec-mocks (~> 2.11.0)
66
+ rspec-core (2.11.1)
67
+ rspec-expectations (2.11.3)
68
+ diff-lcs (~> 1.1.3)
69
+ rspec-mocks (2.11.2)
70
+ simplecov (0.7.1)
71
+ multi_json (~> 1.0)
72
+ simplecov-html (~> 0.7.1)
73
+ simplecov-html (0.7.1)
74
+ sprockets (2.1.3)
75
+ hike (~> 1.2)
76
+ rack (~> 1.0)
77
+ tilt (~> 1.1, != 1.3.0)
78
+ thor (0.16.0)
79
+ tilt (1.3.3)
80
+ treetop (1.4.12)
50
81
  polyglot
51
82
  polyglot (>= 0.3.1)
52
- tzinfo (0.3.31)
53
83
 
54
84
  PLATFORMS
55
85
  ruby
56
86
 
57
87
  DEPENDENCIES
58
- actionmailer (>= 3.0)
88
+ actionmailer (>= 3.2)
89
+ addressable
59
90
  css_parser (>= 1.2.5)
60
- hpricot (>= 0.8)
91
+ guard-rspec
61
92
  jeweler
93
+ nokogiri (>= 1.5.6)
94
+ rspec
95
+ simplecov
data/Guardfile ADDED
@@ -0,0 +1,8 @@
1
+ # A sample Guardfile
2
+ # More info at https://github.com/guard/guard#readme
3
+
4
+ guard 'rspec', :version => 2 do
5
+ watch(%r{^spec/.+_spec\.rb$})
6
+ watch(%r{^lib/(.+)\.rb$}) { "spec" }
7
+ watch('spec/spec_helper.rb') { "spec" }
8
+ end
data/Rakefile CHANGED
@@ -1,14 +1,15 @@
1
1
  begin
2
2
  require 'jeweler'
3
- Jeweler::Tasks.new do |gemspec|
4
- gemspec.name = "awesomemailer"
5
- gemspec.summary = "An ActionMailer extension that embeds CSS inline in e-mails"
6
- gemspec.description = %{
3
+ Jeweler::Tasks.new do |gem|
4
+ gem.name = "awesomemailer"
5
+ gem.summary = "An ActionMailer extension that embeds CSS inline in e-mails"
6
+ gem.description = %{
7
7
  AwesomeMailer embeds your e-mail CSS inline, allowing you to write e-mail templates without worrying too much about stylesheets
8
8
  }
9
- gemspec.email = "flip@x451.com"
10
- gemspec.homepage = "http://github.com/Plinq/awesome_mailer"
11
- gemspec.authors = ["Flip Sasser"]
9
+ gem.email = "flip@x451.com"
10
+ gem.homepage = "http://github.com/Plinq/awesome_mailer"
11
+ gem.authors = ["Flip Sasser"]
12
+ gem.files.exclude '.rspec', '.rvmrc', 'spec/**/*'
12
13
  end
13
14
  rescue LoadError
14
15
  end
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.3
1
+ 0.1.0
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "awesomemailer"
8
- s.version = "0.0.3"
8
+ s.version = "0.1.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Flip Sasser"]
12
- s.date = "2012-08-27"
12
+ s.date = "2013-02-03"
13
13
  s.description = "\n AwesomeMailer embeds your e-mail CSS inline, allowing you to write e-mail templates without worrying too much about stylesheets\n "
14
14
  s.email = "flip@x451.com"
15
15
  s.extra_rdoc_files = [
@@ -19,18 +19,15 @@ Gem::Specification.new do |s|
19
19
  "CHANGELOG",
20
20
  "Gemfile",
21
21
  "Gemfile.lock",
22
+ "Guardfile",
22
23
  "README.md",
23
24
  "Rakefile",
24
25
  "VERSION",
25
26
  "awesomemailer.gemspec",
26
27
  "lib/awesome_mailer.rb",
27
28
  "lib/awesome_mailer/base.rb",
28
- "lib/awesomemailer.rb",
29
- "spec/lib/awesome_mailer_spec.rb",
30
- "spec/spec.opts",
31
- "spec/spec_helper.rb",
32
- "spec/support/test_mailer/test_email.html.erb",
33
- "spec/support/test_mailer/test_email.text.erb"
29
+ "lib/awesome_mailer/renderer.rb",
30
+ "lib/awesomemailer.rb"
34
31
  ]
35
32
  s.homepage = "http://github.com/Plinq/awesome_mailer"
36
33
  s.require_paths = ["lib"]
@@ -41,15 +38,21 @@ Gem::Specification.new do |s|
41
38
  s.specification_version = 3
42
39
 
43
40
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
41
+ s.add_runtime_dependency(%q<actionmailer>, [">= 3.2"])
42
+ s.add_runtime_dependency(%q<addressable>, [">= 0"])
44
43
  s.add_runtime_dependency(%q<css_parser>, [">= 1.2.5"])
45
- s.add_runtime_dependency(%q<hpricot>, [">= 0.8"])
44
+ s.add_runtime_dependency(%q<nokogiri>, [">= 1.5.6"])
46
45
  else
46
+ s.add_dependency(%q<actionmailer>, [">= 3.2"])
47
+ s.add_dependency(%q<addressable>, [">= 0"])
47
48
  s.add_dependency(%q<css_parser>, [">= 1.2.5"])
48
- s.add_dependency(%q<hpricot>, [">= 0.8"])
49
+ s.add_dependency(%q<nokogiri>, [">= 1.5.6"])
49
50
  end
50
51
  else
52
+ s.add_dependency(%q<actionmailer>, [">= 3.2"])
53
+ s.add_dependency(%q<addressable>, [">= 0"])
51
54
  s.add_dependency(%q<css_parser>, [">= 1.2.5"])
52
- s.add_dependency(%q<hpricot>, [">= 0.8"])
55
+ s.add_dependency(%q<nokogiri>, [">= 1.5.6"])
53
56
  end
54
57
  end
55
58
 
@@ -1,6 +1,6 @@
1
- require 'rubygems'
1
+ require 'abstract_controller'
2
2
  require 'action_mailer'
3
- require 'hpricot'
3
+ require 'nokogiri'
4
4
  require 'css_parser'
5
5
 
6
6
  module AwesomeMailer
@@ -8,91 +8,11 @@ module AwesomeMailer
8
8
  abstract!
9
9
  include ActionView::Helpers::AssetTagHelper::StylesheetTagHelpers
10
10
  include ActionView::Helpers::AssetTagHelper::JavascriptTagHelpers
11
+ include AbstractController::UrlFor
11
12
 
12
13
  def render(*arguments)
13
- html_string = super
14
- document = Hpricot(html_string)
15
- stylesheets = document.search('link[@rel=stylesheet]')
16
- stylesheets.each do |stylesheet|
17
- if stylesheet['media'] =~ /^(all|handheld|screen)$/ # Must be intended for digital screens!
18
- apply_stylesheet!(document, stylesheet)
19
- end
20
- end
21
- stylesheets.remove
22
- document.to_html
23
- end
24
-
25
- private
26
- def append_styles!(document, selector, declarations)
27
- unless head = document.at('head')
28
- head = Hpricot::Elem.new('head')
29
- document.children.unshift(head)
30
- end
31
- unless style = head.at('style[@type=text/css]')
32
- style = Hpricot::Elem.new('style')
33
- style['type'] = 'text/css'
34
- style.inner_html = "\n"
35
- head.children.unshift(style)
36
- end
37
- style.inner_html += "#{selector} { #{declarations} }\n"
38
- end
39
-
40
- def apply_rules!(document, css_parser, url)
41
- css_parser.each_selector do |selector, declarations, specificity|
42
- if url
43
- # Rewrite relative URLs to match their parent CSS's URL path
44
- path_url = Addressable::URI.parse(url)
45
- path_url.path = File.dirname(path_url.path)
46
- declarations.scan(/(url\(?["']+(.[^'"]*)["']\))/i).each do |url_command, item|
47
- next if item =~ /^(http(s){0,1}:\/\/|\/)/
48
- item_url = path_url.dup
49
- item_url.path = File.join(item_url.path, item)
50
- new_url_command = url_command.gsub(item, item_url.to_s)
51
- declarations[url_command] = new_url_command
52
- end
53
- end
54
- if selector =~ /(^@)/
55
- append_styles!(document, selector, declarations.to_s) if url
56
- elsif selector !~ /:/
57
- document.search(selector).each do |element|
58
- element['style'] = [element['style'], *declarations].compact.join(';')
59
- end
60
- end
61
- end
62
- end
63
-
64
- def apply_stylesheet!(document, stylesheet)
65
- css_parser = CssParser::Parser.new
66
- clean_href = stylesheet['href'].split('?').shift
67
- if self.class.default_url_options[:host]
68
- clean_href.gsub!(/^http:\/\/#{self.class.default_url_options[:host]}/, '')
69
- end
70
- url = nil
71
- case clean_href
72
- when /^\/assets/
73
- if asset = Rails.application.assets[clean_href.gsub(/^\/assets\//, '')]
74
- css_parser.add_block!(asset.to_s, :media_types => :all)
75
- else
76
- dirname = File.dirname(clean_href).split('/').reject(&:blank?)[1..-1]
77
- local_file = File.join(Rails.root, 'app', 'assets', 'stylesheets', dirname, File.basename(clean_href))
78
- if File.file?(local_file)
79
- css_parser.load_file!(local_file)
80
- end
81
- end
82
- when /^\//
83
- css_parser.load_file!(File.join(Rails.root, 'public', clean_href))
84
- when /^#{self.class.default_url_options[:host]}\/assets/
85
- raise 'wugh oh'
86
- else
87
- raise stylesheet.inspect
88
- css_parser.load_uri!(stylesheet['href'])
89
- url = clean_href
90
- end
91
- apply_rules!(document, css_parser, url)
92
- end
93
-
94
- def sprockets?
95
- Rails.application.respond_to?(:assets)
14
+ return super unless formats.include? :html
15
+ AwesomeMailer::Renderer.new(super).to_html
96
16
  end
97
17
  end
98
18
  end
@@ -0,0 +1,110 @@
1
+ module AwesomeMailer
2
+ class Renderer
3
+ attr_accessor :document
4
+
5
+ def initialize(document_string)
6
+ self.document = Nokogiri::HTML.parse(document_string)
7
+ stylesheets = document.search('link[@rel=stylesheet]')
8
+ stylesheets.each do |stylesheet|
9
+ # Must be intended for digital screens!
10
+ load_stylesheet(stylesheet) if stylesheet['media'] =~ /^(all|handheld|screen)$/
11
+ end
12
+ apply_css!(document)
13
+ end
14
+
15
+ def to_html
16
+ document.to_html
17
+ end
18
+
19
+ private
20
+ def append_styles!(document, selector, declarations)
21
+ header_stylesheet.inner_html += "#{selector} { #{declarations} }\n"
22
+ end
23
+
24
+ def apply_css!(document)
25
+ css_parser.each_selector do |selector, declarations, specificity|
26
+ # Rewrite relative URLs to match their parent CSS's URL path
27
+ rewrite_relative_urls(declarations) if css_host
28
+ if selector =~ /(^@|:)/
29
+ # Include difficult styles in the head
30
+ append_styles!(document, selector, declarations.to_s)
31
+ else
32
+ # Include regular styles inline
33
+ document.search(selector).each do |element|
34
+ element['style'] = [element['style'], *declarations].compact.join(';')
35
+ end
36
+ end
37
+ end
38
+ end
39
+
40
+ def asset_pipeline_path
41
+ return false unless sprockets?
42
+ /^#{Regexp.escape(Rails.configuration.assets[:path])}\//
43
+ end
44
+
45
+ def css_host
46
+ if host = AwesomeMailer::Base.default_url_options[:host]
47
+ Addressable::URI.heuristic_parse(host, scheme: 'http')
48
+ end
49
+ end
50
+
51
+ def css_parser
52
+ @css_parser ||= CssParser::Parser.new
53
+ end
54
+
55
+ def head
56
+ @head ||= document.at('head') || Nokogiri::XML::Node.new('head', document.root).tap do |head|
57
+ document.root.children.first.add_previous_sibling(head)
58
+ end
59
+ end
60
+
61
+ def header_stylesheet
62
+ @header_stylesheet ||= head.at('style[@type="text/css"]') || Nokogiri::XML::Node.new('style', head).tap do |style|
63
+ style['type'] = 'text/css'
64
+ style.inner_html = "\n"
65
+ head.add_child(style)
66
+ end
67
+ end
68
+
69
+ def load_stylesheet(stylesheet)
70
+ stylesheet_path = stylesheet['href'].split('?').shift
71
+ stylesheet_path.gsub!(/^#{Regexp.escape(css_host)}/, '') if css_host
72
+ case stylesheet_path
73
+ when asset_pipeline_path
74
+ if asset = read_asset_pipeline_asset(stylesheet_path)
75
+ css_parser.add_block!(asset.to_s, :media_types => :all)
76
+ end
77
+ when /^\//
78
+ local_path = rails? && Rails.root.join('public', stylesheet_path.gsub(/^\//, '')).to_s
79
+ css_parser.load_file!(local_path) if local_path && File.file?(local_path)
80
+ else
81
+ dirname = File.dirname(stylesheet['href'])
82
+ css_parser.load_uri!(stylesheet['href'], base_uri: dirname)
83
+ end
84
+ stylesheet.remove
85
+ end
86
+
87
+ def rails?
88
+ defined? Rails
89
+ end
90
+
91
+ def read_asset_pipeline_asset(path)
92
+ path = path.gsub(asset_pipeline_path, '')
93
+ Rails.application.assets[path]
94
+ end
95
+
96
+ def rewrite_relative_urls(css_declarations)
97
+ css_declarations.scan(/(url\s*\(?["']+(.[^'"]*)["']\))/i).each do |url_command, item|
98
+ next if item =~ /^http(s){0,1}:\/\//
99
+ item_url = css_host.dup
100
+ item_url.path = File.join(item_url.path, item)
101
+ new_url_command = url_command.gsub(item, item_url.to_s)
102
+ css_declarations[url_command] = new_url_command
103
+ end
104
+ end
105
+
106
+ def sprockets?
107
+ rails? && Rails.application.respond_to?(:assets)
108
+ end
109
+ end
110
+ end
@@ -1,4 +1,4 @@
1
- require 'awesome_mailer/base'
2
-
3
1
  module AwesomeMailer
2
+ autoload :Base, 'awesome_mailer/base'
3
+ autoload :Renderer, 'awesome_mailer/renderer'
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: awesomemailer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,8 +9,40 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-08-27 00:00:00.000000000 Z
12
+ date: 2013-02-03 00:00:00.000000000 Z
13
13
  dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: actionmailer
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '3.2'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '3.2'
30
+ - !ruby/object:Gem::Dependency
31
+ name: addressable
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
14
46
  - !ruby/object:Gem::Dependency
15
47
  name: css_parser
16
48
  requirement: !ruby/object:Gem::Requirement
@@ -28,13 +60,13 @@ dependencies:
28
60
  - !ruby/object:Gem::Version
29
61
  version: 1.2.5
30
62
  - !ruby/object:Gem::Dependency
31
- name: hpricot
63
+ name: nokogiri
32
64
  requirement: !ruby/object:Gem::Requirement
33
65
  none: false
34
66
  requirements:
35
67
  - - ! '>='
36
68
  - !ruby/object:Gem::Version
37
- version: '0.8'
69
+ version: 1.5.6
38
70
  type: :runtime
39
71
  prerelease: false
40
72
  version_requirements: !ruby/object:Gem::Requirement
@@ -42,7 +74,7 @@ dependencies:
42
74
  requirements:
43
75
  - - ! '>='
44
76
  - !ruby/object:Gem::Version
45
- version: '0.8'
77
+ version: 1.5.6
46
78
  description: ! "\n AwesomeMailer embeds your e-mail CSS inline, allowing you
47
79
  to write e-mail templates without worrying too much about stylesheets\n "
48
80
  email: flip@x451.com
@@ -54,18 +86,15 @@ files:
54
86
  - CHANGELOG
55
87
  - Gemfile
56
88
  - Gemfile.lock
89
+ - Guardfile
57
90
  - README.md
58
91
  - Rakefile
59
92
  - VERSION
60
93
  - awesomemailer.gemspec
61
94
  - lib/awesome_mailer.rb
62
95
  - lib/awesome_mailer/base.rb
96
+ - lib/awesome_mailer/renderer.rb
63
97
  - lib/awesomemailer.rb
64
- - spec/lib/awesome_mailer_spec.rb
65
- - spec/spec.opts
66
- - spec/spec_helper.rb
67
- - spec/support/test_mailer/test_email.html.erb
68
- - spec/support/test_mailer/test_email.text.erb
69
98
  homepage: http://github.com/Plinq/awesome_mailer
70
99
  licenses: []
71
100
  post_install_message:
@@ -78,6 +107,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
78
107
  - - ! '>='
79
108
  - !ruby/object:Gem::Version
80
109
  version: '0'
110
+ segments:
111
+ - 0
112
+ hash: -3813975484138673240
81
113
  required_rubygems_version: !ruby/object:Gem::Requirement
82
114
  none: false
83
115
  requirements:
@@ -1,41 +0,0 @@
1
- require 'spec_helper'
2
- require 'awesome_mailer'
3
-
4
- AwesomeMailer::Base.prepend_view_path 'spec/support'
5
- AwesomeMailer::Base.config.assets_dir = 'spec/support'
6
-
7
- class TestMailer < AwesomeMailer::Base
8
- def test_email(subject = "Hello!")
9
- mail(
10
- :from => "flip@x451.com",
11
- :to => "flip@x451.com",
12
- :subject => subject
13
- )
14
- end
15
-
16
- def test_multipart_email(subject = "Hello")
17
- mail(
18
- :from => "flip@x451.com",
19
- :to => "flip@x451.com",
20
- :subject => subject
21
- ) do |format|
22
- format.html { render :test_email }
23
- format.text { render :test_email }
24
- end
25
- end
26
- end
27
-
28
- describe AwesomeMailer::Base do
29
- it "should render messages like ActionMailer::Base" do
30
- TestMailer.test_email("Howdy!").should be_instance_of Mail::Message
31
- end
32
-
33
- it "should automatically parse the body of HTML e-mails" do
34
- raise TestMailer.test_email("Howdy!").html_part.body.inspect
35
- end
36
-
37
- it "should automatically parse the body of multipart e-mails" do
38
- raise TestMailer.test_multipart_email("Howdy!").html_part.body.inspect
39
- end
40
- end
41
-
data/spec/spec.opts DELETED
@@ -1,2 +0,0 @@
1
- --color
2
- --backtrace
data/spec/spec_helper.rb DELETED
@@ -1 +0,0 @@
1
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
@@ -1,2 +0,0 @@
1
- <%= stylesheet_link_tag 'test.css' %>
2
- <div>welcome!</div>
@@ -1 +0,0 @@
1
- welcome!