g5_updatable 0.6.1 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -96,5 +96,44 @@ describe G5Updatable::LocationsUpdater do
96
96
  expect(G5Updatable::Location.by_urn("dead_urn").by_client_uid("client_uid").count).to eq(0)
97
97
  end
98
98
  end
99
+
100
+ context "callbacks" do
101
+ before do
102
+ FactoryGirl.create(:location, uid: uid, urn: "old")
103
+ @callback_called = false
104
+ end
105
+
106
+ it "calls callbacks passing the location that was updated" do
107
+ described_class.on_update { |location| @callback_called = true }
108
+
109
+ expect(@callback_called).to be false
110
+ updater.update
111
+ expect(@callback_called).to be true
112
+ end
113
+ end
99
114
  end
115
+
116
+ describe ".on_update and .on_update_callbacks" do
117
+ before do
118
+ described_class.on_update_callbacks = []
119
+ end
120
+
121
+ it "adds to the #update callbacks" do
122
+ callback_1 = -> (location) {}
123
+ callback_2 = -> (location) {}
124
+ described_class.on_update(&callback_1)
125
+ described_class.on_update(&callback_2)
126
+
127
+ expect(described_class.on_update_callbacks).
128
+ to eq([callback_1, callback_2])
129
+ end
130
+ end
131
+
132
+ describe ".on_update_callbacks" do
133
+ it "defaults to an empty array" do
134
+ described_class.on_update_callbacks = nil
135
+ expect(described_class.on_update_callbacks).to be_empty
136
+ end
137
+ end
138
+
100
139
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: g5_updatable
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.1
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Bauer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-11 00:00:00.000000000 Z
11
+ date: 2015-06-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -80,6 +80,20 @@ dependencies:
80
80
  - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: activesupport
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
83
97
  - !ruby/object:Gem::Dependency
84
98
  name: rspec-rails
85
99
  requirement: !ruby/object:Gem::Requirement
@@ -265,7 +279,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
265
279
  version: '0'
266
280
  requirements: []
267
281
  rubyforge_project:
268
- rubygems_version: 2.4.2
282
+ rubygems_version: 2.4.7
269
283
  signing_key:
270
284
  specification_version: 4
271
285
  summary: Client/Locations data update engine for G5 applications