thincloud-postmark 0.3.1 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -29,13 +29,16 @@ module Thincloud
29
29
  end
30
30
  end
31
31
 
32
- # Apply the postmark settings just before ActionMailer applies them
33
- initializer "thincloud.postmark.settings", after: "finisher_hook" do |app|
32
+ # Rails applies config.action_mailer to ActionMailer::Base before
33
+ # initializers are run. This hooks into the end of the initialization
34
+ # process to make sure we have our config settings then we apply them
35
+ # to AM::Base. Keep them in both places so config appears normal.
36
+ initializer "thincloud.postmark.settings", before: "finisher_hook" do
34
37
  if configuration.api_key
35
- postmark_settings = { api_key: configuration.api_key }
36
-
37
- config.action_mailer.delivery_method = :postmark
38
- config.action_mailer.postmark_settings = postmark_settings
38
+ [ActionMailer::Base, config.action_mailer].each do |c|
39
+ c.delivery_method = :postmark
40
+ c.postmark_settings = { api_key: configuration.api_key }
41
+ end
39
42
  end
40
43
  end
41
44
 
@@ -1,5 +1,5 @@
1
1
  module Thincloud
2
2
  module Postmark
3
- VERSION = "0.3.1"
3
+ VERSION = "0.3.2"
4
4
  end
5
5
  end
@@ -39,4 +39,12 @@ describe Dummy::Application.config do
39
39
  it { app_config.delivery_method.must_equal :postmark }
40
40
  it { app_config.postmark_settings.must_equal settings }
41
41
  end
42
+
43
+ describe "updates ActionMailer configuration" do
44
+ let(:base_config) { ActionMailer::Base }
45
+ let(:settings) { { api_key: "INITIALIZER" } }
46
+
47
+ it { base_config.delivery_method.must_equal :postmark }
48
+ it { base_config.postmark_settings.must_equal settings }
49
+ end
42
50
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: thincloud-postmark
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -122,7 +122,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
122
122
  version: '0'
123
123
  segments:
124
124
  - 0
125
- hash: 4329779346811559049
125
+ hash: -1800728793378863451
126
126
  required_rubygems_version: !ruby/object:Gem::Requirement
127
127
  none: false
128
128
  requirements:
@@ -131,7 +131,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
131
131
  version: '0'
132
132
  segments:
133
133
  - 0
134
- hash: 4329779346811559049
134
+ hash: -1800728793378863451
135
135
  requirements: []
136
136
  rubyforge_project:
137
137
  rubygems_version: 1.8.24