notifiable-rails 0.24.0 → 0.24.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 551660755a1daac81f623c91e648b0a96427f70a
4
- data.tar.gz: 536f82a503f1b6d23568d148aff248c3560193bd
3
+ metadata.gz: ede18aeef7cd9913c7a12b244c0151d718481a50
4
+ data.tar.gz: df1997d979049133bc614f5ffa0f81f3ffe3f415
5
5
  SHA512:
6
- metadata.gz: 984904ddac1abd030ddd6ccaf14355698e8a10accad50ccc462e7fc2def723cf2fc3556d6c715e3a0086d044a9a418d2e652f73a48c511c595c9572e48e58e99
7
- data.tar.gz: 1b0b16774cf324a1ccf8e213ecb5e5eb82f13ce92354bc1d326a4d8580148ff7ee7abab2dcf0f0e509e479436d43ee62e1744b8e36af0b0fcc7874636a916be1
6
+ metadata.gz: 9bea8c381c751b92fcea32f0568fb5b029d0310545e616edc917bf7dcf1b9057fba857e7d02309997e23a2706f219aee63100442960fc99e0024dd5b0b067a67
7
+ data.tar.gz: fd268ce3d93814627b51e9312eb3588fdd422c806351ec8bc2b3e9373370caad8397741bf8d4ab472f1f204067336bddf0f25c4c2573066eca55bb89d0945f07
@@ -30,6 +30,17 @@ module Notifiable
30
30
  configuration
31
31
  end
32
32
 
33
+ def self.define_configuration_accessors(notifiers)
34
+ notifiers.each_pair do |provider, clazz|
35
+ next unless clazz.notifier_attributes
36
+
37
+ clazz.notifier_attributes.each do |attribute|
38
+ define_method("#{provider}_#{attribute}="){ |v| configuration[provider][attribute] = v }
39
+ define_method("#{provider}_#{attribute}"){ configuration[provider][attribute] }
40
+ end
41
+ end
42
+ end
43
+
33
44
  def save_notification_statuses?
34
45
  self.configuration[:save_notification_statuses].nil? ? true : self.configuration[:save_notification_statuses]
35
46
  end
@@ -1,3 +1,3 @@
1
1
  module Notifiable
2
- VERSION = "0.24.0"
2
+ VERSION = "0.24.1"
3
3
  end
@@ -26,4 +26,9 @@ describe Notifiable::App do
26
26
 
27
27
  it { expect(notifiable_app.send(:configuration)).to eq :mock => {}, :configurable_mock=>{:use_sandbox=>nil} }
28
28
  end
29
+
30
+ describe "define_configuration_accessors" do
31
+ it { expect(Notifiable::App.instance_methods).to include(:configurable_mock_use_sandbox) }
32
+ it { expect(Notifiable::App.instance_methods).to include(:configurable_mock_use_sandbox=) }
33
+ end
29
34
  end
data/spec/spec_helper.rb CHANGED
@@ -46,6 +46,9 @@ RSpec.configure do |config|
46
46
  config.infer_spec_type_from_file_location!
47
47
 
48
48
  config.before(:suite) do
49
+ Notifiable.notifier_classes[:mock] = MockNotifier
50
+ Notifiable.notifier_classes[:configurable_mock] = ConfigurableMockNotifier
51
+ Notifiable::App.define_configuration_accessors(Notifiable.notifier_classes)
49
52
  #FactoryGirl.lint
50
53
  end
51
54
 
@@ -67,8 +70,6 @@ class MockNotifier < Notifiable::NotifierBase
67
70
  end
68
71
  end
69
72
 
70
- Notifiable.notifier_classes[:mock] = MockNotifier
71
-
72
73
  class ConfigurableMockNotifier < Notifiable::NotifierBase
73
74
  notifier_attribute :use_sandbox
74
75
 
@@ -76,4 +77,3 @@ class ConfigurableMockNotifier < Notifiable::NotifierBase
76
77
  @use_sandbox
77
78
  end
78
79
  end
79
- Notifiable.notifier_classes[:configurable_mock] = ConfigurableMockNotifier