roadie 2.1.0 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Changelog.md +15 -1
- data/Gemfile.lock +1 -1
- data/lib/roadie/action_mailer_extensions.rb +0 -1
- data/lib/roadie/railtie.rb +4 -1
- data/lib/roadie/version.rb +1 -1
- data/spec/integration_spec.rb +7 -4
- data/spec/lib/roadie_spec.rb +1 -1
- data/spec/spec_helper.rb +18 -9
- data/spec/support/change_url_options.rb +5 -0
- metadata +3 -1
data/Changelog.md
CHANGED
@@ -1,9 +1,23 @@
|
|
1
1
|
### dev
|
2
2
|
|
3
|
-
[full changelog](https://github.com/Mange/roadie/compare/v2.
|
3
|
+
[full changelog](https://github.com/Mange/roadie/compare/v2.2.0...master)
|
4
4
|
|
5
5
|
* Nothing yet
|
6
6
|
|
7
|
+
### 2.2.0
|
8
|
+
|
9
|
+
[full changelog](https://github.com/Mange/roadie/compare/v2.1.0...v2.2.0)
|
10
|
+
|
11
|
+
* Enhancements:
|
12
|
+
* Support for the `url_options` method inside mailer instances
|
13
|
+
* You can now dynamically alter the URL options on a per-email basis
|
14
|
+
|
15
|
+
### 2.1.0
|
16
|
+
|
17
|
+
[full changelog](https://github.com/Mange/roadie/compare/v2.1.0.pre2...v2.1.0)
|
18
|
+
|
19
|
+
* Full release!
|
20
|
+
|
7
21
|
### 2.1.0.pre2
|
8
22
|
|
9
23
|
[full changelog](https://github.com/Mange/roadie/compare/v2.1.0.pre1...v2.1.0.pre2)
|
data/Gemfile.lock
CHANGED
@@ -38,7 +38,6 @@ module Roadie
|
|
38
38
|
end
|
39
39
|
|
40
40
|
def inline_style_response(response)
|
41
|
-
url_options = Rails.application.config.action_mailer.default_url_options
|
42
41
|
if response[:content_type] == 'text/html'
|
43
42
|
response.merge :body => Roadie.inline_css(Roadie.current_provider, css_targets, response[:body], url_options)
|
44
43
|
else
|
data/lib/roadie/railtie.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'action_mailer'
|
2
|
+
require 'roadie'
|
2
3
|
require 'roadie/action_mailer_extensions'
|
3
4
|
|
4
5
|
module Roadie
|
@@ -16,7 +17,9 @@ module Roadie
|
|
16
17
|
config.roadie.provider = nil
|
17
18
|
|
18
19
|
initializer "roadie.extend_action_mailer" do
|
19
|
-
|
20
|
+
ActiveSupport.on_load(:action_mailer) do
|
21
|
+
include Roadie::ActionMailerExtensions
|
22
|
+
end
|
20
23
|
end
|
21
24
|
end
|
22
25
|
end
|
data/lib/roadie/version.rb
CHANGED
data/spec/integration_spec.rb
CHANGED
@@ -17,12 +17,15 @@ module Roadie
|
|
17
17
|
headers('X-Spam' => 'No way! Trust us!')
|
18
18
|
mail(:subject => 'Buy cheap v1agra', :to => to)
|
19
19
|
end
|
20
|
+
|
21
|
+
def url_options
|
22
|
+
# This allows apps to calculate any options on a per-email basis
|
23
|
+
super.merge(:protocol => 'https')
|
24
|
+
end
|
20
25
|
end
|
21
26
|
|
22
27
|
before(:each) do
|
23
|
-
|
24
|
-
|
25
|
-
Rails.stub(:root => FIXTURES_PATH)
|
28
|
+
change_default_url_options(:host => 'example.app.org')
|
26
29
|
mailer.delivery_method = :test
|
27
30
|
end
|
28
31
|
|
@@ -37,7 +40,7 @@ module Roadie
|
|
37
40
|
document = Nokogiri::HTML.parse(html_part.body.decoded)
|
38
41
|
document.should have_selector('html > head + body')
|
39
42
|
document.should have_selector('body #message h1')
|
40
|
-
document.should have_styling('background' => 'url(
|
43
|
+
document.should have_styling('background' => 'url(https://example.app.org/images/dots.png) repeat-x').at_selector('body')
|
41
44
|
document.should have_selector('strong[contains("quota")]')
|
42
45
|
end
|
43
46
|
|
data/spec/lib/roadie_spec.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
@@ -15,18 +15,15 @@ end
|
|
15
15
|
require 'rspec'
|
16
16
|
require 'rails'
|
17
17
|
require 'sprockets'
|
18
|
-
|
18
|
+
|
19
|
+
require 'roadie/railtie'
|
20
|
+
require 'action_mailer/railtie'
|
19
21
|
|
20
22
|
FIXTURES_PATH = Pathname.new(File.dirname(__FILE__)).join('fixtures')
|
21
|
-
Roadie::Railtie.run_initializers
|
22
23
|
|
23
|
-
class TestApplication
|
24
|
+
class TestApplication < Rails::Application
|
24
25
|
def config
|
25
|
-
@config
|
26
|
-
:action_mailer => OpenStruct.new(:default_url_options => {:host => "example.com"}),
|
27
|
-
:assets => OpenStruct.new(:enabled => false),
|
28
|
-
:roadie => OpenStruct.new(:provider => nil),
|
29
|
-
})
|
26
|
+
@config
|
30
27
|
end
|
31
28
|
|
32
29
|
def assets
|
@@ -38,11 +35,23 @@ class TestApplication
|
|
38
35
|
def root
|
39
36
|
FIXTURES_PATH
|
40
37
|
end
|
38
|
+
|
39
|
+
def reset_test_config
|
40
|
+
@config = OpenStruct.new({
|
41
|
+
:action_mailer => OpenStruct.new(:default_url_options => {}),
|
42
|
+
:assets => OpenStruct.new(:enabled => false),
|
43
|
+
:roadie => OpenStruct.new(:provider => nil),
|
44
|
+
})
|
45
|
+
change_default_url_options(:host => "example.com")
|
46
|
+
end
|
41
47
|
end
|
42
48
|
|
49
|
+
ActionMailer::Railtie.run_initializers(:default, Rails.application)
|
50
|
+
Roadie::Railtie.run_initializers(:default, Rails.application)
|
51
|
+
|
43
52
|
RSpec.configure do |c|
|
44
53
|
c.before(:each) do
|
45
|
-
Rails.
|
54
|
+
Rails.application.reset_test_config
|
46
55
|
end
|
47
56
|
end
|
48
57
|
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: roadie
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 2.
|
5
|
+
version: 2.2.0
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Magnus Bergmark
|
@@ -183,6 +183,7 @@ files:
|
|
183
183
|
- spec/lib/roadie_spec.rb
|
184
184
|
- spec/shared_examples/asset_provider_examples.rb
|
185
185
|
- spec/spec_helper.rb
|
186
|
+
- spec/support/change_url_options.rb
|
186
187
|
- spec/support/have_attribute_matcher.rb
|
187
188
|
- spec/support/have_selector_matcher.rb
|
188
189
|
- spec/support/have_styling_matcher.rb
|
@@ -231,6 +232,7 @@ test_files:
|
|
231
232
|
- spec/lib/roadie_spec.rb
|
232
233
|
- spec/shared_examples/asset_provider_examples.rb
|
233
234
|
- spec/spec_helper.rb
|
235
|
+
- spec/support/change_url_options.rb
|
234
236
|
- spec/support/have_attribute_matcher.rb
|
235
237
|
- spec/support/have_selector_matcher.rb
|
236
238
|
- spec/support/have_styling_matcher.rb
|