@@ -41,9 +41,8 @@ def call; end
41
41
describe 'test add notification with invalid params' do
42
42
it 'should log and return nil if notification type is empty' do
43
43
expect ( notification_center . add_notification_listener (
44
- nil ,
45
- @callback_reference
46
- ) ) . to eq ( nil )
44
+ nil , @callback_reference
45
+ ) ) . to eq ( nil )
47
46
expect ( spy_logger ) . to have_received ( :log ) . once
48
47
. with ( Logger ::ERROR , 'Notification type can not be empty.' )
49
48
end
@@ -52,7 +51,7 @@ def call; end
52
51
expect ( notification_center . add_notification_listener (
53
52
Optimizely ::NotificationCenter ::NOTIFICATION_TYPES [ :ACTIVATE ] ,
54
53
nil
55
- ) ) . to eq ( nil )
54
+ ) ) . to eq ( nil )
56
55
expect ( spy_logger ) . to have_received ( :log ) . once
57
56
. with ( Logger ::ERROR , 'Callback can not be empty.' )
58
57
end
@@ -61,7 +60,7 @@ def call; end
61
60
expect ( notification_center . add_notification_listener (
62
61
'Test notification type' ,
63
62
@callback_reference
64
- ) ) . to eq ( nil )
63
+ ) ) . to eq ( nil )
65
64
expect ( spy_logger ) . to have_received ( :log ) . once
66
65
. with ( Logger ::ERROR , 'Invalid notification type.' )
67
66
end
@@ -70,7 +69,7 @@ def call; end
70
69
expect ( notification_center . add_notification_listener (
71
70
Optimizely ::NotificationCenter ::NOTIFICATION_TYPES [ :ACTIVATE ] ,
72
71
'Invalid callback!'
73
- ) ) . to eq ( nil )
72
+ ) ) . to eq ( nil )
74
73
expect ( spy_logger ) . to have_received ( :log ) . once
75
74
. with ( Logger ::ERROR , 'Invalid notification callback given.' )
76
75
end
@@ -81,7 +80,7 @@ def call; end
81
80
expect ( notification_center . add_notification_listener (
82
81
Optimizely ::NotificationCenter ::NOTIFICATION_TYPES [ :ACTIVATE ] ,
83
82
@callback_reference
84
- ) ) . to eq ( 1 )
83
+ ) ) . to eq ( 1 )
85
84
# verifies that one notification is added
86
85
expect ( notification_center . notifications [ Optimizely ::NotificationCenter ::NOTIFICATION_TYPES [ :ACTIVATE ] ] . length )
87
86
. to eq ( 1 )
@@ -95,7 +94,7 @@ def call; end
95
94
expect ( notification_center . add_notification_listener (
96
95
value ,
97
96
@callback_reference
98
- ) ) . to eq ( notification_id )
97
+ ) ) . to eq ( notification_id )
99
98
end
100
99
notification_center . notifications . each_key do |key |
101
100
expect ( notification_center . notifications [ key ] . length )
@@ -141,19 +140,19 @@ def call; end
141
140
expect ( notification_center . add_notification_listener (
142
141
Optimizely ::NotificationCenter ::NOTIFICATION_TYPES [ :ACTIVATE ] ,
143
142
@callback_reference
144
- ) ) . to eq ( -1 )
143
+ ) ) . to eq ( -1 )
145
144
end
146
145
147
146
it 'should add same callback for a different notification type' do
148
147
expect ( notification_center . add_notification_listener (
149
148
Optimizely ::NotificationCenter ::NOTIFICATION_TYPES [ :ACTIVATE ] ,
150
149
@callback_reference
151
- ) ) . to eq ( 1 )
150
+ ) ) . to eq ( 1 )
152
151
153
152
expect ( notification_center . add_notification_listener (
154
153
Optimizely ::NotificationCenter ::NOTIFICATION_TYPES [ :TRACK ] ,
155
154
@callback_reference
156
- ) ) . to eq ( 2 )
155
+ ) ) . to eq ( 2 )
157
156
end
158
157
end
159
158
@@ -169,18 +168,18 @@ def call; end
169
168
expect ( @inner_notification_center . add_notification_listener (
170
169
Optimizely ::NotificationCenter ::NOTIFICATION_TYPES [ :ACTIVATE ] ,
171
170
@callback_reference
172
- ) ) . to eq ( 1 )
171
+ ) ) . to eq ( 1 )
173
172
174
173
expect ( @inner_notification_center . add_notification_listener (
175
174
Optimizely ::NotificationCenter ::NOTIFICATION_TYPES [ :TRACK ] ,
176
175
@callback_reference
177
- ) ) . to eq ( 2 )
176
+ ) ) . to eq ( 2 )
178
177
179
178
# add another callback for NOTIFICATION_TYPES::ACTIVATE
180
179
expect ( @inner_notification_center . add_notification_listener (
181
180
Optimizely ::NotificationCenter ::NOTIFICATION_TYPES [ :ACTIVATE ] ,
182
181
@callback_reference_second
183
- ) ) . to eq ( 3 )
182
+ ) ) . to eq ( 3 )
184
183
# Verify that notifications length for NOTIFICATION_TYPES::ACTIVATE is 2
185
184
expect ( @inner_notification_center . notifications [
186
185
Optimizely ::NotificationCenter ::NOTIFICATION_TYPES [ :ACTIVATE ] ] . length ) . to eq ( 2 )
@@ -338,27 +337,27 @@ def call; end
338
337
expect ( @inner_notification_center . add_notification_listener (
339
338
Optimizely ::NotificationCenter ::NOTIFICATION_TYPES [ :ACTIVATE ] ,
340
339
@callback_reference
341
- ) ) . to eq ( 1 )
340
+ ) ) . to eq ( 1 )
342
341
343
342
expect ( @inner_notification_center . add_notification_listener (
344
343
Optimizely ::NotificationCenter ::NOTIFICATION_TYPES [ :ACTIVATE ] ,
345
344
@callback_reference_second
346
- ) ) . to eq ( 2 )
345
+ ) ) . to eq ( 2 )
347
346
348
347
expect ( @inner_notification_center . add_notification_listener (
349
348
Optimizely ::NotificationCenter ::NOTIFICATION_TYPES [ :ACTIVATE ] ,
350
349
@callback_reference_third
351
- ) ) . to eq ( 3 )
350
+ ) ) . to eq ( 3 )
352
351
353
352
expect ( @inner_notification_center . add_notification_listener (
354
353
Optimizely ::NotificationCenter ::NOTIFICATION_TYPES [ :TRACK ] ,
355
354
@callback_reference
356
- ) ) . to eq ( 4 )
355
+ ) ) . to eq ( 4 )
357
356
358
357
expect ( @inner_notification_center . add_notification_listener (
359
358
Optimizely ::NotificationCenter ::NOTIFICATION_TYPES [ :TRACK ] ,
360
359
@callback_reference_second
361
- ) ) . to eq ( 5 )
360
+ ) ) . to eq ( 5 )
362
361
363
362
# verify that notifications length for each type reflects the just added callbacks
364
363
0 commit comments