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 +4 -4
- data/lib/notifiable/app.rb +11 -0
- data/lib/notifiable/version.rb +1 -1
- data/spec/model/notifiable_app_spec.rb +5 -0
- data/spec/spec_helper.rb +3 -3
- data/spec/test_app/log/test.log +27526 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ede18aeef7cd9913c7a12b244c0151d718481a50
|
4
|
+
data.tar.gz: df1997d979049133bc614f5ffa0f81f3ffe3f415
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9bea8c381c751b92fcea32f0568fb5b029d0310545e616edc917bf7dcf1b9057fba857e7d02309997e23a2706f219aee63100442960fc99e0024dd5b0b067a67
|
7
|
+
data.tar.gz: fd268ce3d93814627b51e9312eb3588fdd422c806351ec8bc2b3e9373370caad8397741bf8d4ab472f1f204067336bddf0f25c4c2573066eca55bb89d0945f07
|
data/lib/notifiable/app.rb
CHANGED
@@ -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
|
data/lib/notifiable/version.rb
CHANGED
@@ -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
|