Skip to content

Commit 42a5e50

Browse files
committed
Fix errors
1 parent 5ef3c76 commit 42a5e50

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

lib/optimizely/config/datafile_project_config.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,7 @@ def get_attribute_by_key(attribute_key)
453453
# Returns:
454454
# Attribute corresponding to the provided attribute key.
455455
attribute = @attribute_key_map[attribute_key]
456-
if attribute_key in @attribute_key_map
456+
if @attribute_key_map.key?(attribute_key)
457457
return attribute
458458
end
459459

@@ -472,7 +472,7 @@ def get_attribute_key_by_id(attribute_id)
472472
# Returns:
473473
# Attribute key corresponding to the provided attribute ID.
474474
attribute = @attribute_id_to_key_map[attribute_id]
475-
if attribute_id in @attribute_id_to_key_map
475+
if @attribute_id_to_key_map.key?(attribute_id)
476476
return attribute
477477
end
478478

lib/optimizely/helpers/constants.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ module Constants
203203
'type' => 'object'
204204
},
205205
'cmab' => {
206-
'type' => 'object',
206+
'type' => 'object'
207207
}
208208
},
209209
'required' => %w[
@@ -313,10 +313,10 @@ module Constants
313313
'type' => 'object',
314314
'properties' => {
315315
'attributeIds' => {
316-
'type' => 'array',
316+
'type' => 'array'
317317
},
318318
'trafficAllocation' => {
319-
'type' => 'integer',
319+
'type' => 'integer'
320320
}
321321
}
322322
}

spec/config/datafile_project_config_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1080,15 +1080,15 @@
10801080

10811081
describe 'test_cmab_field_population' do
10821082
config_dict = Marshal.load(Marshal.dump(OptimizelySpec::VALID_CONFIG_BODY))
1083-
config_dict['experiments'][0]['cmab'] = { 'attributeIds' => ['808797688', '808797689'], 'trafficAllocation' => 4000 }
1083+
config_dict['experiments'][0]['cmab'] = {'attributeIds' => %w[808797688 808797689], 'trafficAllocation' => 4000}
10841084
config_dict['experiments'][0]['trafficAllocation'] = []
10851085

10861086
config_json = JSON.dump(config_dict)
10871087
project_config = Optimizely::DatafileProjectConfig.new(config_json, logger, error_handler)
10881088

10891089
it 'Should return CMAB details' do
10901090
experiment = project_config.get_experiment_from_key('test_experiment')
1091-
expect(experiment['cmab']).to eq({'attributeIds' => ['808797688', '808797689'], 'trafficAllocation' => 4000})
1091+
expect(experiment['cmab']).to eq({'attributeIds' => %w[808797688 808797689], 'trafficAllocation' => 4000})
10921092

10931093
experiment2 = project_config.get_experiment_from_key('test_experiment_2')
10941094
expect(experiment2['cmab']).to eq(nil)

0 commit comments

Comments
 (0)