Skip to content

Commit a80d4ac

Browse files
rashidspmikeproeng37
authored andcommitted
Coveralls coverage (#99)
1 parent c10c123 commit a80d4ac

File tree

2 files changed

+8
-32
lines changed

2 files changed

+8
-32
lines changed

lib/optimizely/project_config.rb

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -290,10 +290,8 @@ def get_forced_variation(experiment_key, user_id)
290290
experiment = get_experiment_from_key(experiment_key)
291291
experiment_id = experiment['id'] if experiment
292292
# check for nil and empty string experiment ID
293-
if experiment_id.nil? || experiment_id.empty?
294-
# this case is logged in get_experiment_from_key
295-
return nil
296-
end
293+
# this case is logged in get_experiment_from_key
294+
return nil if experiment_id.nil? || experiment_id.empty?
297295

298296
unless experiment_to_variation_map.key? experiment_id
299297
@logger.log(Logger::DEBUG, "No experiment '#{experiment_key}' mapped to user '#{user_id}' "\
@@ -307,10 +305,8 @@ def get_forced_variation(experiment_key, user_id)
307305
variation_key = variation['key'] if variation
308306

309307
# check if the variation exists in the datafile
310-
if variation_key.empty?
311-
# this case is logged in get_variation_from_id
312-
return nil
313-
end
308+
# this case is logged in get_variation_from_id
309+
return nil if variation_key.empty?
314310

315311
@logger.log(Logger::DEBUG, "Variation '#{variation_key}' is mapped to experiment '#{experiment_key}' "\
316312
"and user '#{user_id}' in the forced variation map")

spec/notification_center_spec.rb

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,7 @@
3030

3131
before(:context) do
3232
class CallBack
33-
def call(args)
34-
args
35-
end
33+
def call; end
3634
end
3735

3836
@callback = CallBack.new
@@ -108,9 +106,7 @@ def call(args)
108106
it 'should add and return notification ID when multiple
109107
valid callbacks are added for a single notification type' do
110108
class CallBackSecond
111-
def call(_args)
112-
'Test multi listner.'
113-
end
109+
def call; end
114110
end
115111

116112
@callback_second = CallBackSecond.new
@@ -166,12 +162,6 @@ def call(_args)
166162
let(:notification_center) { Optimizely::NotificationCenter.new(spy_logger, raise_error_handler) }
167163
before(:example) do
168164
@inner_notification_center = notification_center
169-
class CallBackSecond
170-
def call(_args)
171-
'Test remove notification.'
172-
end
173-
end
174-
175165
@callback_second = CallBackSecond.new
176166
@callback_reference_second = @callback_second.method(:call)
177167
# add a callback for multiple notification types
@@ -321,19 +311,11 @@ def call(_args)
321311
let(:notification_center) { Optimizely::NotificationCenter.new(spy_logger, raise_error_handler) }
322312
before(:example) do
323313
@inner_notification_center = notification_center
324-
class CallBackSecond
325-
def call(_args)
326-
'Test remove notification.'
327-
end
328-
end
329-
330314
@callback_second = CallBackSecond.new
331315
@callback_reference_second = @callback_second.method(:call)
332316

333317
class CallBackThird
334-
def call(_args)
335-
'Test remove notification.'
336-
end
318+
def call; end
337319
end
338320

339321
@callback_third = CallBackThird.new
@@ -406,9 +388,7 @@ def deliver_two(_args)
406388
@logger.log Logger::INFO, 'delivered two.'
407389
end
408390

409-
def deliver_three(_args)
410-
@logger.log Logger::INFO, 'delivered three.'
411-
end
391+
def deliver_three; end
412392
end
413393
let(:raise_error_handler) { Optimizely::RaiseErrorHandler.new }
414394
let(:invitation) { Invitation.new(spy_logger) }

0 commit comments

Comments
 (0)