premailer-rails3 1.3.1 → 1.3.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,14 +2,16 @@
2
2
 
3
3
  require 'spec_helper'
4
4
 
5
- describe PremailerRails::Premailer do
5
+ describe Premailer::Rails::CustomizedPremailer do
6
6
  [ :nokogiri, :hpricot ].each do |adapter|
7
7
  context "when adapter is #{adapter}" do
8
- before { ::Premailer::Adapter.stubs(:use).returns(adapter) }
8
+ before { Premailer::Adapter.stubs(:use).returns(adapter) }
9
9
 
10
10
  describe '#to_plain_text' do
11
11
  it 'should include the text from the HTML part' do
12
- premailer = PremailerRails::Premailer.new(Fixtures::Message::HTML_PART)
12
+ premailer =
13
+ Premailer::Rails::CustomizedPremailer \
14
+ .new(Fixtures::Message::HTML_PART)
13
15
  premailer.to_plain_text.gsub(/\s/, ' ').strip \
14
16
  .should == Fixtures::Message::TEXT_PART.gsub(/\s/, ' ').strip
15
17
  end
@@ -18,9 +20,11 @@ describe PremailerRails::Premailer do
18
20
  describe '#to_inline_css' do
19
21
  context 'when inline CSS block present' do
20
22
  it 'should return the HTML with the CSS inlined' do
21
- PremailerRails::CSSHelper.stubs(:css_for_doc).returns('p { color: red; }')
23
+ Premailer::Rails::CSSHelper \
24
+ .stubs(:css_for_doc) \
25
+ .returns('p { color: red; }')
22
26
  html = Fixtures::Message::HTML_PART
23
- premailer = PremailerRails::Premailer.new(html)
27
+ premailer = Premailer::Rails::CustomizedPremailer.new(html)
24
28
  premailer.to_inline_css.should include '<p style="color: red;">'
25
29
  end
26
30
  end
@@ -28,7 +32,7 @@ describe PremailerRails::Premailer do
28
32
  context 'when CSS is loaded externally' do
29
33
  it 'should return the HTML with the CSS inlined' do
30
34
  html = Fixtures::Message::HTML_PART_WITH_CSS
31
- premailer = PremailerRails::Premailer.new(html)
35
+ premailer = Premailer::Rails::CustomizedPremailer.new(html)
32
36
  premailer.to_inline_css.should include '<p style="color: red;">'
33
37
  end
34
38
  end
@@ -38,19 +42,19 @@ describe PremailerRails::Premailer do
38
42
 
39
43
  describe '.new' do
40
44
  it 'should extract the CSS' do
41
- PremailerRails::CSSHelper.expects(:css_for_doc)
42
- PremailerRails::Premailer.new('some html')
45
+ Premailer::Rails::CSSHelper.expects(:css_for_doc)
46
+ Premailer::Rails::CustomizedPremailer.new('some html')
43
47
  end
44
48
 
45
49
  it 'should pass on the configs' do
46
- PremailerRails.config = { :foo => :bar }
47
- premailer = PremailerRails::Premailer.new('some html')
50
+ Premailer::Rails.config = { :foo => :bar }
51
+ premailer = Premailer::Rails::CustomizedPremailer.new('some html')
48
52
  premailer.instance_variable_get(:'@options')[:foo].should == :bar
49
53
  end
50
54
 
51
55
  it 'should not allow to override with_html_string' do
52
- PremailerRails.config = { :with_html_string => false }
53
- premailer = PremailerRails::Premailer.new('some html')
56
+ Premailer::Rails.config = { :with_html_string => false }
57
+ premailer = Premailer::Rails::CustomizedPremailer.new('some html')
54
58
  options = premailer.instance_variable_get(:'@options')
55
59
  options[:with_html_string].should == true
56
60
  end
@@ -1,10 +1,10 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe 'ActionMailer::Base.register_interceptor' do
4
- it 'should register interceptor PremailerRails::Hook' do
4
+ it 'should register interceptor Premailer::Rails::Hook' do
5
5
  ActionMailer::Base \
6
6
  .expects(:register_interceptor) \
7
- .with(PremailerRails::Hook)
8
- load 'premailer-rails3.rb'
7
+ .with(Premailer::Rails::Hook)
8
+ load 'premailer/rails3.rb'
9
9
  end
10
10
  end
@@ -1,31 +1,34 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe PremailerRails::Hook do
3
+ describe Premailer::Rails::Hook do
4
4
  describe '.delivering_email' do
5
5
  before { File.stubs(:read).returns('') }
6
6
  def run_hook(message)
7
- PremailerRails::Hook.delivering_email(message)
7
+ Premailer::Rails::Hook.delivering_email(message)
8
8
  end
9
9
 
10
10
  context 'when message contains html part' do
11
11
  let(:message) { Fixtures::Message.with_parts :html }
12
12
 
13
13
  it 'should create a text part from the html part' do
14
- PremailerRails::Premailer.any_instance.expects(:to_plain_text)
14
+ Premailer::Rails::CustomizedPremailer \
15
+ .any_instance.expects(:to_plain_text)
15
16
  run_hook(message)
16
17
  message.text_part.should be_a Mail::Part
17
18
  end
18
19
 
19
20
  it 'should inline the css in the html part' do
20
- PremailerRails::Premailer.any_instance.expects(:to_inline_css)
21
+ Premailer::Rails::CustomizedPremailer \
22
+ .any_instance.expects(:to_inline_css)
21
23
  run_hook(message)
22
24
  end
23
25
 
24
26
  it 'should not create a text part if disabled' do
25
- PremailerRails::Premailer.any_instance.expects(:to_plain_text).never
26
- PremailerRails.config[:generate_text_part] = false
27
+ Premailer::Rails::CustomizedPremailer \
28
+ .any_instance.expects(:to_plain_text).never
29
+ Premailer::Rails.config[:generate_text_part] = false
27
30
  run_hook(message)
28
- PremailerRails.config[:generate_text_part] = true
31
+ Premailer::Rails.config[:generate_text_part] = true
29
32
  message.text_part.should be_nil
30
33
  message.html_part.should be_a Mail::Part
31
34
  end
@@ -49,13 +52,15 @@ describe PremailerRails::Hook do
49
52
  let(:message) { Fixtures::Message.with_parts :html, :text }
50
53
 
51
54
  it 'should not create a text part from the html part' do
52
- PremailerRails::Premailer.any_instance.expects(:to_plain_text).never
55
+ Premailer::Rails::CustomizedPremailer \
56
+ .any_instance.expects(:to_plain_text).never
53
57
  run_hook(message)
54
58
  message.text_part.should be_a Mail::Part
55
59
  end
56
60
 
57
61
  it 'should inline the css in the html part' do
58
- PremailerRails::Premailer.any_instance.expects(:to_inline_css)
62
+ Premailer::Rails::CustomizedPremailer \
63
+ .any_instance.expects(:to_inline_css)
59
64
  run_hook(message)
60
65
  end
61
66
  end
@@ -64,21 +69,24 @@ describe PremailerRails::Hook do
64
69
  let(:message) { Fixtures::Message.with_body :html }
65
70
 
66
71
  it 'should create a text part from the html part' do
67
- PremailerRails::Premailer.any_instance.expects(:to_plain_text)
72
+ Premailer::Rails::CustomizedPremailer \
73
+ .any_instance.expects(:to_plain_text)
68
74
  run_hook(message)
69
75
  end
70
76
 
71
77
  it 'should create a html part and inline the css' do
72
- PremailerRails::Premailer.any_instance.expects(:to_inline_css)
78
+ Premailer::Rails::CustomizedPremailer \
79
+ .any_instance.expects(:to_inline_css)
73
80
  run_hook(message)
74
81
  message.html_part.should be_a Mail::Part
75
82
  end
76
83
 
77
84
  it 'should not create a text part if disabled' do
78
- PremailerRails::Premailer.any_instance.expects(:to_plain_text).never
79
- PremailerRails.config[:generate_text_part] = false
85
+ Premailer::Rails::CustomizedPremailer \
86
+ .any_instance.expects(:to_plain_text).never
87
+ Premailer::Rails.config[:generate_text_part] = false
80
88
  run_hook(message)
81
- PremailerRails.config[:generate_text_part] = true
89
+ Premailer::Rails.config[:generate_text_part] = true
82
90
  message.text_part.should be_nil
83
91
  message.html_part.should be_nil
84
92
  message.body.should_not be_empty
@@ -1,10 +1,10 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe PremailerRails do
3
+ describe Premailer::Rails do
4
4
  describe '#config' do
5
- subject { PremailerRails.config }
5
+ subject { Premailer::Rails.config }
6
6
  context 'when set' do
7
- before { PremailerRails.config = { :foo => :bar } }
7
+ before { Premailer::Rails.config = { :foo => :bar } }
8
8
  it { should == { :foo => :bar } }
9
9
  end
10
10
  end
@@ -1,14 +1,13 @@
1
+ require 'premailer/rails'
2
+
1
3
  require 'stubs/action_mailer'
2
4
  require 'stubs/rails'
3
- require 'stubs/hassle'
4
5
  require 'fixtures/message'
5
6
  require 'fixtures/html'
6
7
 
7
8
  require 'hpricot'
8
9
  require 'nokogiri'
9
10
 
10
- require 'premailer-rails3'
11
-
12
11
  RSpec.configure do |config|
13
12
  config.mock_with :mocha
14
13
  end
@@ -1,5 +1,5 @@
1
1
  module ActionMailer
2
- module Base
2
+ class Base
3
3
  def self.register_interceptor(x); end
4
4
  end
5
5
  end
@@ -1,9 +1,7 @@
1
1
  require 'stubs/dummy'
2
2
 
3
- module Logger
4
- extend self
5
-
6
- def try(*args); end
3
+ class Logger
4
+ def self.try(*args); end
7
5
  end
8
6
 
9
7
  module Rails
metadata CHANGED
@@ -1,20 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: premailer-rails3
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.1
5
- prerelease:
4
+ version: 1.3.2
6
5
  platform: ruby
7
6
  authors:
8
7
  - Philipe Fatio
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2012-07-26 00:00:00.000000000 Z
11
+ date: 2013-03-12 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: premailer
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
17
  - - ~>
20
18
  - !ruby/object:Gem::Version
@@ -22,7 +20,6 @@ dependencies:
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
24
  - - ~>
28
25
  - !ruby/object:Gem::Version
@@ -30,119 +27,106 @@ dependencies:
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: rails
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ~>
31
+ - - '>='
36
32
  - !ruby/object:Gem::Version
37
33
  version: '3'
38
34
  type: :runtime
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ~>
38
+ - - '>='
44
39
  - !ruby/object:Gem::Version
45
40
  version: '3'
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: rspec-core
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
- - - ! '>='
45
+ - - '>='
52
46
  - !ruby/object:Gem::Version
53
47
  version: '0'
54
48
  type: :development
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
- - - ! '>='
52
+ - - '>='
60
53
  - !ruby/object:Gem::Version
61
54
  version: '0'
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: rspec-expectations
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
- - - ! '>='
59
+ - - '>='
68
60
  - !ruby/object:Gem::Version
69
61
  version: '0'
70
62
  type: :development
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
- - - ! '>='
66
+ - - '>='
76
67
  - !ruby/object:Gem::Version
77
68
  version: '0'
78
69
  - !ruby/object:Gem::Dependency
79
70
  name: mocha
80
71
  requirement: !ruby/object:Gem::Requirement
81
- none: false
82
72
  requirements:
83
- - - ! '>='
73
+ - - '>='
84
74
  - !ruby/object:Gem::Version
85
75
  version: '0'
86
76
  type: :development
87
77
  prerelease: false
88
78
  version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
79
  requirements:
91
- - - ! '>='
80
+ - - '>='
92
81
  - !ruby/object:Gem::Version
93
82
  version: '0'
94
83
  - !ruby/object:Gem::Dependency
95
84
  name: mail
96
85
  requirement: !ruby/object:Gem::Requirement
97
- none: false
98
86
  requirements:
99
- - - ! '>='
87
+ - - '>='
100
88
  - !ruby/object:Gem::Version
101
89
  version: '0'
102
90
  type: :development
103
91
  prerelease: false
104
92
  version_requirements: !ruby/object:Gem::Requirement
105
- none: false
106
93
  requirements:
107
- - - ! '>='
94
+ - - '>='
108
95
  - !ruby/object:Gem::Version
109
96
  version: '0'
110
97
  - !ruby/object:Gem::Dependency
111
98
  name: nokogiri
112
99
  requirement: !ruby/object:Gem::Requirement
113
- none: false
114
100
  requirements:
115
- - - ! '>='
101
+ - - '>='
116
102
  - !ruby/object:Gem::Version
117
103
  version: '0'
118
104
  type: :development
119
105
  prerelease: false
120
106
  version_requirements: !ruby/object:Gem::Requirement
121
- none: false
122
107
  requirements:
123
- - - ! '>='
108
+ - - '>='
124
109
  - !ruby/object:Gem::Version
125
110
  version: '0'
126
111
  - !ruby/object:Gem::Dependency
127
112
  name: hpricot
128
113
  requirement: !ruby/object:Gem::Requirement
129
- none: false
130
114
  requirements:
131
- - - ! '>='
115
+ - - '>='
132
116
  - !ruby/object:Gem::Version
133
117
  version: '0'
134
118
  type: :development
135
119
  prerelease: false
136
120
  version_requirements: !ruby/object:Gem::Requirement
137
- none: false
138
121
  requirements:
139
- - - ! '>='
122
+ - - '>='
140
123
  - !ruby/object:Gem::Version
141
124
  version: '0'
142
- description: ! "This gem brings you the power of the premailer gem to Rails 3\n without
143
- any configuration needs. Create HTML emails, include a\n CSS
144
- file as you do in a normal HTML document and premailer will\n inline
145
- the included CSS."
125
+ description: |-
126
+ This gem brings you the power of the premailer gem to Rails
127
+ without any configuration needs. Create HTML emails,
128
+ include a CSS file as you do in a normal HTML document and
129
+ premailer will inline the included CSS.
146
130
  email:
147
131
  - philipe.fatio@gmail.com
148
132
  executables: []
@@ -157,60 +141,62 @@ files:
157
141
  - LICENSE
158
142
  - README.md
159
143
  - Rakefile
160
- - lib/premailer-rails3.rb
161
- - lib/premailer-rails3/css_helper.rb
162
- - lib/premailer-rails3/css_loaders.rb
163
- - lib/premailer-rails3/hook.rb
164
- - lib/premailer-rails3/premailer.rb
165
- - lib/premailer-rails3/version.rb
166
- - premailer-rails3.gemspec
144
+ - VERSION
145
+ - lib/premailer/rails.rb
146
+ - lib/premailer/rails/css_helper.rb
147
+ - lib/premailer/rails/css_loaders.rb
148
+ - lib/premailer/rails/customized_premailer.rb
149
+ - lib/premailer/rails/hook.rb
150
+ - lib/premailer/rails/nokogiri_fix.rb
151
+ - lib/premailer/rails/premailer.rb
152
+ - lib/premailer/rails/version.rb
153
+ - lib/premailer/rails3.rb
167
154
  - spec/fixtures/html.rb
168
155
  - spec/fixtures/message.rb
169
- - spec/premailer-rails3/css_helper_spec.rb
170
- - spec/premailer-rails3/hook_registration_spec.rb
171
- - spec/premailer-rails3/hook_spec.rb
172
- - spec/premailer-rails3/premailer_rails_3_spec.rb
173
- - spec/premailer-rails3/premailer_spec.rb
156
+ - spec/lib/css_helper_spec.rb
157
+ - spec/lib/customized_premailer_spec.rb
158
+ - spec/lib/hook_registration_spec.rb
159
+ - spec/lib/hook_spec.rb
160
+ - spec/lib/premailer_rails_3_spec.rb
174
161
  - spec/spec_helper.rb
175
162
  - spec/stubs/action_mailer.rb
176
163
  - spec/stubs/dummy.rb
177
- - spec/stubs/hassle.rb
178
164
  - spec/stubs/rails.rb
179
- homepage: https://github.com/fphilipe/premailer-rails3
165
+ - premailer-rails3.gemspec
166
+ homepage: https://github.com/fphilipe/premailer-rails
180
167
  licenses: []
181
- post_install_message:
168
+ metadata: {}
169
+ post_install_message: This gem has been renamed to premailer-rails. This is the last
170
+ version that is released under the old name. Please change this in your Gemfile.
182
171
  rdoc_options: []
183
172
  require_paths:
184
173
  - lib
185
174
  required_ruby_version: !ruby/object:Gem::Requirement
186
- none: false
187
175
  requirements:
188
- - - ! '>='
176
+ - - '>='
189
177
  - !ruby/object:Gem::Version
190
178
  version: '0'
191
179
  required_rubygems_version: !ruby/object:Gem::Requirement
192
- none: false
193
180
  requirements:
194
- - - ! '>='
181
+ - - '>='
195
182
  - !ruby/object:Gem::Version
196
183
  version: '0'
197
184
  requirements: []
198
- rubyforge_project: premailer-rails3
199
- rubygems_version: 1.8.23
185
+ rubyforge_project:
186
+ rubygems_version: 2.0.0
200
187
  signing_key:
201
- specification_version: 3
202
- summary: Easily create HTML emails in Rails 3.
188
+ specification_version: 4
189
+ summary: Easily create styled HTML emails in Rails.
203
190
  test_files:
204
191
  - spec/fixtures/html.rb
205
192
  - spec/fixtures/message.rb
206
- - spec/premailer-rails3/css_helper_spec.rb
207
- - spec/premailer-rails3/hook_registration_spec.rb
208
- - spec/premailer-rails3/hook_spec.rb
209
- - spec/premailer-rails3/premailer_rails_3_spec.rb
210
- - spec/premailer-rails3/premailer_spec.rb
193
+ - spec/lib/css_helper_spec.rb
194
+ - spec/lib/customized_premailer_spec.rb
195
+ - spec/lib/hook_registration_spec.rb
196
+ - spec/lib/hook_spec.rb
197
+ - spec/lib/premailer_rails_3_spec.rb
211
198
  - spec/spec_helper.rb
212
199
  - spec/stubs/action_mailer.rb
213
200
  - spec/stubs/dummy.rb
214
- - spec/stubs/hassle.rb
215
201
  - spec/stubs/rails.rb
216
202
  has_rdoc: