@@ -186,6 +186,27 @@ - (void)didSubscribeWithDisposable:(RACCompoundDisposable *)disposable {
186
186
187
187
expect (@(errorSent)).to (beTruthy ());
188
188
});
189
+
190
+ qck_it (@" should receive first values when using take: while in subscribeNext:" , ^{
191
+ id firstValue = @" blah" ;
192
+ id secondValue = @" more blah" ;
193
+
194
+ NSMutableArray *outerValues = [NSMutableArray array ];
195
+ NSMutableArray *innerValues = [NSMutableArray array ];
196
+
197
+ [subject subscribeNext: ^(id outerValue) {
198
+ [outerValues addObject: outerValue];
199
+ [[subject take: 1 ] subscribeNext: ^(id innerValue) {
200
+ [innerValues addObject: innerValue];
201
+ }];
202
+ }];
203
+
204
+ [subject sendNext: firstValue];
205
+ [subject sendNext: secondValue];
206
+
207
+ expect (outerValues).to (equal (@[firstValue, secondValue]));
208
+ expect (innerValues).to (equal (@[firstValue, secondValue]));
209
+ });
189
210
});
190
211
191
212
qck_describe (@" with an unlimited capacity" , ^{
@@ -319,7 +340,7 @@ - (void)didSubscribeWithDisposable:(RACCompoundDisposable *)disposable {
319
340
[subject sendNext: @1 ];
320
341
321
342
dispatch_async (dispatch_get_global_queue (DISPATCH_QUEUE_PRIORITY_DEFAULT, 0 ), ^{
322
- __block RACDisposable *disposable = [subject subscribeNext: ^(id x) {
343
+ __block RACDisposable * _Nullable disposable = [subject subscribeNext: ^(id x) {
323
344
expect (disposable).notTo (beNil ());
324
345
325
346
[values addObject: x];
0 commit comments