File tree Expand file tree Collapse file tree 3 files changed +20
-15
lines changed Expand file tree Collapse file tree 3 files changed +20
-15
lines changed Original file line number Diff line number Diff line change @@ -383,7 +383,7 @@ def get_attribute_id(attribute_key)
383
383
end
384
384
return attribute [ 'id' ]
385
385
end
386
- return attribute_key if has_reserved_prefix && attribute_key != Helpers :: Constants :: CONTROL_ATTRIBUTES [ 'BOT_FILTERING' ]
386
+ return attribute_key if has_reserved_prefix
387
387
@logger . log Logger ::ERROR , "Attribute key '#{ attribute_key } ' is not in datafile."
388
388
@error_handler . handle_error InvalidAttributeError
389
389
nil
Original file line number Diff line number Diff line change 357
357
358
358
# Create impression event with bucketing ID
359
359
it 'should create valid Event when create_impression_event is called with Bucketing ID attribute' do
360
- @expected_impression_params [ :visitors ] [ 0 ] [ :attributes ] . unshift ( {
361
- entity_id : '111094' ,
362
- key : 'browser_type' ,
363
- type : 'custom' ,
364
- value : 'firefox'
365
- } , entity_id : Optimizely ::Helpers ::Constants ::CONTROL_ATTRIBUTES [ 'BUCKETING_ID' ] ,
366
- key : Optimizely ::Helpers ::Constants ::CONTROL_ATTRIBUTES [ 'BUCKETING_ID' ] ,
367
- type : 'custom' ,
368
- value : 'variation' )
360
+ @expected_impression_params [ :visitors ] [ 0 ] [ :attributes ] . unshift (
361
+ {
362
+ entity_id : '111094' ,
363
+ key : 'browser_type' ,
364
+ type : 'custom' ,
365
+ value : 'firefox'
366
+ } ,
367
+ entity_id : Optimizely ::Helpers ::Constants ::CONTROL_ATTRIBUTES [ 'BUCKETING_ID' ] ,
368
+ key : Optimizely ::Helpers ::Constants ::CONTROL_ATTRIBUTES [ 'BUCKETING_ID' ] ,
369
+ type : 'custom' ,
370
+ value : 'variation'
371
+ )
369
372
370
373
user_attributes = {
371
374
'browser_type' => 'firefox' ,
Original file line number Diff line number Diff line change 1031
1031
describe 'get_attribute_id_valid_key' do
1032
1032
let ( :spy_logger ) { spy ( 'logger' ) }
1033
1033
let ( :config ) { Optimizely ::ProjectConfig . new ( config_body_JSON , spy_logger , error_handler ) }
1034
+
1034
1035
it 'should return attribute ID when provided valid attribute key has reserved prefix' do
1035
1036
config . attribute_key_map [ '$opt_bot' ] = { 'key' => '$opt_bot' , 'id' => '111' }
1036
1037
expect ( config . get_attribute_id ( '$opt_bot' ) ) . to eq ( '111' )
1037
- expect ( spy_logger ) . to have_received ( :log ) . with ( Logger ::WARN ,
1038
- "Attribute '$opt_bot' unexpectedly has reserved prefix '$opt_'; using attribute ID instead of reserved attribute name." )
1038
+ expect ( spy_logger ) . to have_received ( :log ) . with (
1039
+ Logger ::WARN ,
1040
+ "Attribute '$opt_bot' unexpectedly has reserved prefix '$opt_'; using attribute ID instead of reserved attribute name."
1041
+ )
1039
1042
end
1043
+
1040
1044
it 'should return attribute ID when provided attribute key is valid' do
1041
1045
expect ( config . get_attribute_id ( 'browser_type' ) ) . to eq ( '111094' )
1042
1046
end
1043
- it 'should return nil when provided attribute key is bot_filtering_constant' do
1044
- expect ( config . get_attribute_id ( '$opt_bot_filtering' ) ) . to eq ( nil )
1045
- end
1047
+
1046
1048
it 'should return attribute key as attribute ID when key has reserved prefix but is not present in data file' do
1047
1049
expect ( config . get_attribute_id ( '$opt_user_agent' ) ) . to eq ( '$opt_user_agent' )
1048
1050
end
You can’t perform that action at this time.
0 commit comments