|
110 | 110 | end
|
111 | 111 |
|
112 | 112 | it 'should create a valid Event when create_impression_event is called with attributes as a string value' do
|
113 |
| - @expected_impression_params[:visitors][0][:attributes].unshift(entity_id: '111094', |
114 |
| - key: 'browser_type', |
115 |
| - type: 'custom', |
116 |
| - value: 'firefox') |
| 113 | + @expected_impression_params[:visitors][0][:attributes].unshift( |
| 114 | + entity_id: '111094', |
| 115 | + key: 'browser_type', |
| 116 | + type: 'custom', |
| 117 | + value: 'firefox' |
| 118 | + ) |
117 | 119 |
|
118 | 120 | experiment = config.get_experiment_from_key('test_experiment')
|
119 | 121 | impression_event = @event_builder.create_impression_event(experiment, '111128', 'test_user',
|
|
124 | 126 | end
|
125 | 127 |
|
126 | 128 | it 'should create a valid Event when create_impression_event is called with attributes as a false value' do
|
127 |
| - @expected_impression_params[:visitors][0][:attributes].unshift(entity_id: '111094', |
128 |
| - key: 'browser_type', |
129 |
| - type: 'custom', |
130 |
| - value: false) |
| 129 | + @expected_impression_params[:visitors][0][:attributes].unshift( |
| 130 | + entity_id: '111094', |
| 131 | + key: 'browser_type', |
| 132 | + type: 'custom', |
| 133 | + value: false |
| 134 | + ) |
131 | 135 |
|
132 | 136 | experiment = config.get_experiment_from_key('test_experiment')
|
133 | 137 | impression_event = @event_builder.create_impression_event(experiment, '111128', 'test_user',
|
|
138 | 142 | end
|
139 | 143 |
|
140 | 144 | it 'should create a valid Event when create_impression_event is called with attributes as a zero value' do
|
141 |
| - @expected_impression_params[:visitors][0][:attributes].unshift(entity_id: '111094', |
142 |
| - key: 'browser_type', |
143 |
| - type: 'custom', |
144 |
| - value: 0) |
| 145 | + @expected_impression_params[:visitors][0][:attributes].unshift( |
| 146 | + entity_id: '111094', |
| 147 | + key: 'browser_type', |
| 148 | + type: 'custom', |
| 149 | + value: 0 |
| 150 | + ) |
145 | 151 |
|
146 | 152 | experiment = config.get_experiment_from_key('test_experiment')
|
147 | 153 | impression_event = @event_builder.create_impression_event(experiment, '111128', 'test_user', 'browser_type' => 0)
|
|
167 | 173 | end
|
168 | 174 |
|
169 | 175 | it 'should create a valid Event when create_conversion_event is called with attributes' do
|
170 |
| - @expected_conversion_params[:visitors][0][:attributes].unshift(entity_id: '111094', |
171 |
| - key: 'browser_type', |
172 |
| - type: 'custom', |
173 |
| - value: 'firefox') |
| 176 | + @expected_conversion_params[:visitors][0][:attributes].unshift( |
| 177 | + entity_id: '111094', |
| 178 | + key: 'browser_type', |
| 179 | + type: 'custom', |
| 180 | + value: 'firefox' |
| 181 | + ) |
174 | 182 |
|
175 | 183 | conversion_event = @event_builder.create_conversion_event('test_event', 'test_user', {'browser_type' => 'firefox'},
|
176 | 184 | nil, '111127' => '111128')
|
|
343 | 351 | value: 13.37,
|
344 | 352 | tags: event_tags)
|
345 | 353 |
|
346 |
| - @expected_conversion_params[:visitors][0][:attributes].unshift(entity_id: '111094', |
347 |
| - key: 'browser_type', |
348 |
| - type: 'custom', |
349 |
| - value: 'firefox') |
| 354 | + @expected_conversion_params[:visitors][0][:attributes].unshift( |
| 355 | + entity_id: '111094', |
| 356 | + key: 'browser_type', |
| 357 | + type: 'custom', |
| 358 | + value: 'firefox' |
| 359 | + ) |
350 | 360 |
|
351 | 361 | conversion_event = @event_builder.create_conversion_event('test_event', 'test_user', {'browser_type' => 'firefox'},
|
352 | 362 | event_tags, '111127' => '111128')
|
|
441 | 451 |
|
442 | 452 | # Create conversion event with bucketing ID
|
443 | 453 | it 'should create valid Event when create_conversion_event is called with Bucketing ID attribute' do
|
444 |
| - @expected_conversion_params[:visitors][0][:attributes].unshift({ |
445 |
| - entity_id: '111094', |
446 |
| - key: 'browser_type', |
447 |
| - type: 'custom', |
448 |
| - value: 'firefox' |
449 |
| - }, entity_id: Optimizely::Helpers::Constants::CONTROL_ATTRIBUTES['BUCKETING_ID'], |
450 |
| - key: Optimizely::Helpers::Constants::CONTROL_ATTRIBUTES['BUCKETING_ID'], |
451 |
| - type: 'custom', |
452 |
| - value: 'variation') |
| 454 | + @expected_conversion_params[:visitors][0][:attributes].unshift( |
| 455 | + { |
| 456 | + entity_id: '111094', |
| 457 | + key: 'browser_type', |
| 458 | + type: 'custom', |
| 459 | + value: 'firefox' |
| 460 | + }, |
| 461 | + entity_id: Optimizely::Helpers::Constants::CONTROL_ATTRIBUTES['BUCKETING_ID'], |
| 462 | + key: Optimizely::Helpers::Constants::CONTROL_ATTRIBUTES['BUCKETING_ID'], |
| 463 | + type: 'custom', |
| 464 | + value: 'variation' |
| 465 | + ) |
453 | 466 |
|
454 | 467 | user_attributes = {
|
455 | 468 | 'browser_type' => 'firefox',
|
|
0 commit comments