outbox-rails 0.1.0 → 0.1.1

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.
@@ -102,6 +102,6 @@ module Outbox
102
102
  super || @_message.respond_to?(method, include_private)
103
103
  end
104
104
 
105
- ActiveSupport.run_load_hooks(:outbox, self)
105
+ ActiveSupport.run_load_hooks(:outbox_notifier, self)
106
106
  end
107
107
  end
data/lib/outbox/rails.rb CHANGED
@@ -8,4 +8,6 @@ module Outbox
8
8
 
9
9
  module Rails
10
10
  end
11
+
12
+ ActiveSupport.run_load_hooks(:outbox, self)
11
13
  end
@@ -3,10 +3,26 @@ require 'rails'
3
3
  module Outbox
4
4
  module Rails
5
5
  class Railtie < ::Rails::Railtie
6
- config.outbox = Outbox::Message
6
+ config.outbox = ActiveSupport::OrderedOptions.new
7
7
 
8
8
  initializer 'outbox.logger' do
9
- ActiveSupport.on_load(:outbox) { self.logger ||= ::Rails.logger }
9
+ ActiveSupport.on_load(:outbox_notifier) do
10
+ self.logger ||= ::Rails.logger
11
+ end
12
+ end
13
+
14
+ initializer 'outbox.config' do |app|
15
+ options = app.config.outbox
16
+ use_test_client = !!options.delete(:use_test_client)
17
+
18
+ ActiveSupport.on_load(:outbox) do
19
+ Outbox::Message.use_test_client if use_test_client
20
+
21
+ options.each do |key, value|
22
+ option_setter = "#{key}="
23
+ Outbox::Message.public_send(option_setter, value) if Outbox::Message.respond_to?(option_setter)
24
+ end
25
+ end
10
26
  end
11
27
  end
12
28
  end
@@ -1,5 +1,5 @@
1
1
  module Outbox
2
2
  module Rails
3
- VERSION = '0.1.0'
3
+ VERSION = '0.1.1'
4
4
  end
5
5
  end
data/outbox-rails.gemspec CHANGED
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ['lib']
20
20
 
21
- spec.add_runtime_dependency 'outbox', '~> 0.1.1'
21
+ spec.add_runtime_dependency 'outbox', '~> 0.1.2'
22
22
  spec.add_runtime_dependency 'rails', '~> 4.0.0'
23
23
  spec.add_development_dependency 'bundler', '~> 1.3'
24
24
  spec.add_development_dependency 'rake'
@@ -0,0 +1,3 @@
1
+ # Ignore the default SQLite database.
2
+ db/*.sqlite3
3
+ db/*.sqlite3-journal
@@ -17,12 +17,6 @@ describe Outbox::Notifier do
17
17
  end
18
18
  end
19
19
 
20
- describe '.logger' do
21
- it 'defaults to Rails.logger' do
22
- expect(BaseNotifier.logger).to be(Rails.logger)
23
- end
24
- end
25
-
26
20
  describe '.defaults' do
27
21
  it 'sets the default values' do
28
22
  message = BaseNotifier.welcome
@@ -0,0 +1,17 @@
1
+ require 'spec_helper'
2
+
3
+ describe Outbox::Rails::Railtie do
4
+ describe '.logger' do
5
+ it 'defaults to Rails.logger' do
6
+ expect(BaseNotifier.logger).to be(Rails.logger)
7
+ end
8
+ end
9
+
10
+ describe '.config' do
11
+ it 'sets configuration' do
12
+ email_client = Outbox::Messages::Email.default_client
13
+ expect(email_client).to be_a(Outbox::Clients::TestClient)
14
+ expect(email_client.settings[:option_1]).to eq(true)
15
+ end
16
+ end
17
+ end
data/spec/spec_helper.rb CHANGED
@@ -2,7 +2,10 @@ $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
2
2
 
3
3
  require 'combustion'
4
4
 
5
- Combustion.initialize!
5
+ Combustion.initialize!(:all) do
6
+ config.outbox.default_email_client = :test
7
+ config.outbox.default_email_client_settings = { option_1: true }
8
+ end
6
9
 
7
10
  require 'rspec-rails'
8
11
  require 'outbox/rails'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: outbox-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -18,7 +18,7 @@ dependencies:
18
18
  requirements:
19
19
  - - ~>
20
20
  - !ruby/object:Gem::Version
21
- version: 0.1.1
21
+ version: 0.1.2
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
@@ -26,7 +26,7 @@ dependencies:
26
26
  requirements:
27
27
  - - ~>
28
28
  - !ruby/object:Gem::Version
29
- version: 0.1.1
29
+ version: 0.1.2
30
30
  - !ruby/object:Gem::Dependency
31
31
  name: rails
32
32
  requirement: !ruby/object:Gem::Requirement
@@ -176,6 +176,7 @@ files:
176
176
  - lib/outbox/rails/railtie.rb
177
177
  - lib/outbox/rails/version.rb
178
178
  - outbox-rails.gemspec
179
+ - spec/internal/.gitignore
179
180
  - spec/internal/app/notifiers/base_notifier.rb
180
181
  - spec/internal/app/views/base_notifier/composed_message_with_implicit_render.erb
181
182
  - spec/internal/app/views/base_notifier/implicit_multipart.html.erb
@@ -186,7 +187,8 @@ files:
186
187
  - spec/internal/db/schema.rb
187
188
  - spec/internal/log/.gitignore
188
189
  - spec/internal/public/favicon.ico
189
- - spec/outbox/rails/notifier_spec.rb
190
+ - spec/outbox/notifier_spec.rb
191
+ - spec/outbox/rails/railtie_spec.rb
190
192
  - spec/outbox/rails_spec.rb
191
193
  - spec/spec_helper.rb
192
194
  homepage: https://github.com/localmed/outbox-rails
@@ -204,7 +206,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
204
206
  version: '0'
205
207
  segments:
206
208
  - 0
207
- hash: -2287336915534194965
209
+ hash: 1828128989920267346
208
210
  required_rubygems_version: !ruby/object:Gem::Requirement
209
211
  none: false
210
212
  requirements:
@@ -213,7 +215,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
213
215
  version: '0'
214
216
  segments:
215
217
  - 0
216
- hash: -2287336915534194965
218
+ hash: 1828128989920267346
217
219
  requirements: []
218
220
  rubyforge_project:
219
221
  rubygems_version: 1.8.23
@@ -222,6 +224,7 @@ specification_version: 3
222
224
  summary: Rails Railtie for sending email, SMS, and push notifications using the Outbox
223
225
  gem.
224
226
  test_files:
227
+ - spec/internal/.gitignore
225
228
  - spec/internal/app/notifiers/base_notifier.rb
226
229
  - spec/internal/app/views/base_notifier/composed_message_with_implicit_render.erb
227
230
  - spec/internal/app/views/base_notifier/implicit_multipart.html.erb
@@ -232,6 +235,7 @@ test_files:
232
235
  - spec/internal/db/schema.rb
233
236
  - spec/internal/log/.gitignore
234
237
  - spec/internal/public/favicon.ico
235
- - spec/outbox/rails/notifier_spec.rb
238
+ - spec/outbox/notifier_spec.rb
239
+ - spec/outbox/rails/railtie_spec.rb
236
240
  - spec/outbox/rails_spec.rb
237
241
  - spec/spec_helper.rb