Skip to content

Commit 5293499

Browse files
fix: Updating libraries (#121)
1 parent cc2ccb8 commit 5293499

File tree

6 files changed

+24
-26
lines changed

6 files changed

+24
-26
lines changed

.rubocop.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,5 @@ Layout/SpaceInsideHashLiteralBraces:
3939
Naming/VariableNumber:
4040
Enabled: false
4141

42-
Lint/RescueWithoutErrorClass:
42+
Style/RescueStandardError:
4343
Enabled: false

lib/optimizely/notification_center.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ def initialize(logger, error_handler)
4242

4343
def add_notification_listener(notification_type, notification_callback)
4444
return nil unless notification_type_valid?(notification_type)
45-
4645
unless notification_callback
4746
@logger.log Logger::ERROR, 'Callback can not be empty.'
4847
return nil

optimizely-sdk.gemspec

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ Gem::Specification.new do |spec|
1818
spec.require_paths = ['lib']
1919

2020
spec.add_development_dependency 'bundler', '~> 1.10'
21-
spec.add_development_dependency 'rake', '~> 10.0'
22-
spec.add_development_dependency 'rspec', '~> 3.4.0'
23-
spec.add_development_dependency 'rubocop', '~> 0.51.0'
21+
spec.add_development_dependency 'rake', '~> 12.0'
22+
spec.add_development_dependency 'rspec', '~> 3.7.0'
23+
spec.add_development_dependency 'rubocop', '~> 0.56.0'
2424

2525
spec.add_runtime_dependency 'httparty', '~> 0.11'
2626
spec.add_runtime_dependency 'json-schema', '~> 2.6'

spec/bucketing_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def get_bucketing_key(bucketing_id, entity_id = nil)
5757
expect(bucketer.send(:generate_bucket_value, get_bucketing_key(
5858
'a very very very very very very very very very very very very '\
5959
'very very very long ppd string'
60-
))).to eq(6128)
60+
))).to eq(6128)
6161
end
6262

6363
it 'should return the proper variation for a user in a mutually exclusive grouped experiment' do

spec/notification_center_spec.rb

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,8 @@ def call; end
4141
describe 'test add notification with invalid params' do
4242
it 'should log and return nil if notification type is empty' do
4343
expect(notification_center.add_notification_listener(
44-
nil,
45-
@callback_reference
46-
)).to eq(nil)
44+
nil, @callback_reference
45+
)).to eq(nil)
4746
expect(spy_logger).to have_received(:log).once
4847
.with(Logger::ERROR, 'Notification type can not be empty.')
4948
end
@@ -52,7 +51,7 @@ def call; end
5251
expect(notification_center.add_notification_listener(
5352
Optimizely::NotificationCenter::NOTIFICATION_TYPES[:ACTIVATE],
5453
nil
55-
)).to eq(nil)
54+
)).to eq(nil)
5655
expect(spy_logger).to have_received(:log).once
5756
.with(Logger::ERROR, 'Callback can not be empty.')
5857
end
@@ -61,7 +60,7 @@ def call; end
6160
expect(notification_center.add_notification_listener(
6261
'Test notification type',
6362
@callback_reference
64-
)).to eq(nil)
63+
)).to eq(nil)
6564
expect(spy_logger).to have_received(:log).once
6665
.with(Logger::ERROR, 'Invalid notification type.')
6766
end
@@ -70,7 +69,7 @@ def call; end
7069
expect(notification_center.add_notification_listener(
7170
Optimizely::NotificationCenter::NOTIFICATION_TYPES[:ACTIVATE],
7271
'Invalid callback!'
73-
)).to eq(nil)
72+
)).to eq(nil)
7473
expect(spy_logger).to have_received(:log).once
7574
.with(Logger::ERROR, 'Invalid notification callback given.')
7675
end
@@ -81,7 +80,7 @@ def call; end
8180
expect(notification_center.add_notification_listener(
8281
Optimizely::NotificationCenter::NOTIFICATION_TYPES[:ACTIVATE],
8382
@callback_reference
84-
)).to eq(1)
83+
)).to eq(1)
8584
# verifies that one notification is added
8685
expect(notification_center.notifications[Optimizely::NotificationCenter::NOTIFICATION_TYPES[:ACTIVATE]].length)
8786
.to eq(1)
@@ -95,7 +94,7 @@ def call; end
9594
expect(notification_center.add_notification_listener(
9695
value,
9796
@callback_reference
98-
)).to eq(notification_id)
97+
)).to eq(notification_id)
9998
end
10099
notification_center.notifications.each_key do |key|
101100
expect(notification_center.notifications[key].length)
@@ -141,19 +140,19 @@ def call; end
141140
expect(notification_center.add_notification_listener(
142141
Optimizely::NotificationCenter::NOTIFICATION_TYPES[:ACTIVATE],
143142
@callback_reference
144-
)).to eq(-1)
143+
)).to eq(-1)
145144
end
146145

147146
it 'should add same callback for a different notification type' do
148147
expect(notification_center.add_notification_listener(
149148
Optimizely::NotificationCenter::NOTIFICATION_TYPES[:ACTIVATE],
150149
@callback_reference
151-
)).to eq(1)
150+
)).to eq(1)
152151

153152
expect(notification_center.add_notification_listener(
154153
Optimizely::NotificationCenter::NOTIFICATION_TYPES[:TRACK],
155154
@callback_reference
156-
)).to eq(2)
155+
)).to eq(2)
157156
end
158157
end
159158

@@ -169,18 +168,18 @@ def call; end
169168
expect(@inner_notification_center.add_notification_listener(
170169
Optimizely::NotificationCenter::NOTIFICATION_TYPES[:ACTIVATE],
171170
@callback_reference
172-
)).to eq(1)
171+
)).to eq(1)
173172

174173
expect(@inner_notification_center.add_notification_listener(
175174
Optimizely::NotificationCenter::NOTIFICATION_TYPES[:TRACK],
176175
@callback_reference
177-
)).to eq(2)
176+
)).to eq(2)
178177

179178
# add another callback for NOTIFICATION_TYPES::ACTIVATE
180179
expect(@inner_notification_center.add_notification_listener(
181180
Optimizely::NotificationCenter::NOTIFICATION_TYPES[:ACTIVATE],
182181
@callback_reference_second
183-
)).to eq(3)
182+
)).to eq(3)
184183
# Verify that notifications length for NOTIFICATION_TYPES::ACTIVATE is 2
185184
expect(@inner_notification_center.notifications[
186185
Optimizely::NotificationCenter::NOTIFICATION_TYPES[:ACTIVATE]].length).to eq(2)
@@ -338,27 +337,27 @@ def call; end
338337
expect(@inner_notification_center.add_notification_listener(
339338
Optimizely::NotificationCenter::NOTIFICATION_TYPES[:ACTIVATE],
340339
@callback_reference
341-
)).to eq(1)
340+
)).to eq(1)
342341

343342
expect(@inner_notification_center.add_notification_listener(
344343
Optimizely::NotificationCenter::NOTIFICATION_TYPES[:ACTIVATE],
345344
@callback_reference_second
346-
)).to eq(2)
345+
)).to eq(2)
347346

348347
expect(@inner_notification_center.add_notification_listener(
349348
Optimizely::NotificationCenter::NOTIFICATION_TYPES[:ACTIVATE],
350349
@callback_reference_third
351-
)).to eq(3)
350+
)).to eq(3)
352351

353352
expect(@inner_notification_center.add_notification_listener(
354353
Optimizely::NotificationCenter::NOTIFICATION_TYPES[:TRACK],
355354
@callback_reference
356-
)).to eq(4)
355+
)).to eq(4)
357356

358357
expect(@inner_notification_center.add_notification_listener(
359358
Optimizely::NotificationCenter::NOTIFICATION_TYPES[:TRACK],
360359
@callback_reference_second
361-
)).to eq(5)
360+
)).to eq(5)
362361

363362
# verify that notifications length for each type reflects the just added callbacks
364363

spec/spec_helper.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
#
1818
require 'coveralls'
1919
Coveralls.wear!
20-
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
20+
$LOAD_PATH.unshift File.expand_path('../lib', __dir__)
2121
require 'optimizely'
2222
require 'spec_params'
2323

0 commit comments

Comments
 (0)