transpec 1.10.2 → 1.10.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -1
- data/Guardfile +2 -2
- data/README.md +2 -1
- data/README.md.erb +2 -1
- data/lib/transpec/cli.rb +23 -7
- data/lib/transpec/conversion_error.rb +1 -1
- data/lib/transpec/dynamic_analyzer.rb +21 -11
- data/lib/transpec/file_finder.rb +1 -1
- data/lib/transpec/version.rb +1 -1
- data/spec/transpec/cli_spec.rb +22 -0
- data/spec/transpec/dynamic_analyzer_spec.rb +2 -2
- data/spec/transpec/syntax/be_boolean_spec.rb +9 -9
- data/spec/transpec/syntax/be_close_spec.rb +2 -2
- data/spec/transpec/syntax/current_example_spec.rb +13 -13
- data/spec/transpec/syntax/double_spec.rb +3 -3
- data/spec/transpec/syntax/example_spec.rb +14 -14
- data/spec/transpec/syntax/have_spec.rb +41 -41
- data/spec/transpec/syntax/its_spec.rb +16 -16
- data/spec/transpec/syntax/matcher_definition_spec.rb +2 -2
- data/spec/transpec/syntax/method_stub_spec.rb +47 -47
- data/spec/transpec/syntax/oneliner_should_spec.rb +28 -28
- data/spec/transpec/syntax/operator_spec.rb +36 -36
- data/spec/transpec/syntax/pending_spec.rb +20 -20
- data/spec/transpec/syntax/raise_error_spec.rb +17 -17
- data/spec/transpec/syntax/receive_spec.rb +28 -28
- data/spec/transpec/syntax/rspec_configure_spec.rb +1 -1
- data/spec/transpec/syntax/should_receive_spec.rb +48 -48
- data/spec/transpec/syntax/should_spec.rb +15 -15
- data/transpec.gemspec +2 -1
- metadata +18 -4
@@ -22,7 +22,7 @@ module Transpec
|
|
22
22
|
context 'with #expect' do
|
23
23
|
let(:receive_object) { expect_object.receive_matcher }
|
24
24
|
|
25
|
-
context '
|
25
|
+
context 'with expression `expect(obj).to receive(:message).and_return { value }`' do
|
26
26
|
let(:source) do
|
27
27
|
<<-END
|
28
28
|
describe 'example' do
|
@@ -43,7 +43,7 @@ module Transpec
|
|
43
43
|
END
|
44
44
|
end
|
45
45
|
|
46
|
-
it 'converts
|
46
|
+
it 'converts to `expect(obj).to receive(:message) { value }` form' do
|
47
47
|
rewritten_source.should == expected_source
|
48
48
|
end
|
49
49
|
|
@@ -54,7 +54,7 @@ module Transpec
|
|
54
54
|
end
|
55
55
|
end
|
56
56
|
|
57
|
-
context '
|
57
|
+
context 'with expression `expect(obj).to receive(:message).and_return do value end`' do
|
58
58
|
let(:source) do
|
59
59
|
<<-END
|
60
60
|
describe 'example' do
|
@@ -79,7 +79,7 @@ module Transpec
|
|
79
79
|
END
|
80
80
|
end
|
81
81
|
|
82
|
-
it 'converts
|
82
|
+
it 'converts to `expect(obj).to receive(:message) do value end` form' do
|
83
83
|
rewritten_source.should == expected_source
|
84
84
|
end
|
85
85
|
|
@@ -90,7 +90,7 @@ module Transpec
|
|
90
90
|
end
|
91
91
|
end
|
92
92
|
|
93
|
-
context '
|
93
|
+
context 'with expression `expect_any_instance_of(Klass).to receive(:message).and_return { value }`' do
|
94
94
|
let(:source) do
|
95
95
|
<<-END
|
96
96
|
describe 'example' do
|
@@ -111,7 +111,7 @@ module Transpec
|
|
111
111
|
END
|
112
112
|
end
|
113
113
|
|
114
|
-
it 'converts
|
114
|
+
it 'converts to `expect_any_instance_of(Klass).to receive(:message) { value }` form' do
|
115
115
|
rewritten_source.should == expected_source
|
116
116
|
end
|
117
117
|
|
@@ -122,7 +122,7 @@ module Transpec
|
|
122
122
|
end
|
123
123
|
end
|
124
124
|
|
125
|
-
context '
|
125
|
+
context 'with expression `expect(obj).to receive(:message).and_return`' do
|
126
126
|
let(:source) do
|
127
127
|
<<-END
|
128
128
|
describe 'example' do
|
@@ -143,7 +143,7 @@ module Transpec
|
|
143
143
|
END
|
144
144
|
end
|
145
145
|
|
146
|
-
it 'converts
|
146
|
+
it 'converts to `expect(obj).to receive(:message)` form' do
|
147
147
|
rewritten_source.should == expected_source
|
148
148
|
end
|
149
149
|
|
@@ -153,7 +153,7 @@ module Transpec
|
|
153
153
|
end
|
154
154
|
end
|
155
155
|
|
156
|
-
context '
|
156
|
+
context 'with expression `expect(obj).to receive(:message).and_return(value)`' do
|
157
157
|
let(:source) do
|
158
158
|
<<-END
|
159
159
|
describe 'example' do
|
@@ -174,7 +174,7 @@ module Transpec
|
|
174
174
|
context 'with #allow' do
|
175
175
|
let(:receive_object) { allow_object.receive_matcher }
|
176
176
|
|
177
|
-
context '
|
177
|
+
context 'with expression `allow(obj).to receive(:message).and_return { value }`' do
|
178
178
|
let(:source) do
|
179
179
|
<<-END
|
180
180
|
describe 'example' do
|
@@ -195,7 +195,7 @@ module Transpec
|
|
195
195
|
END
|
196
196
|
end
|
197
197
|
|
198
|
-
it 'converts
|
198
|
+
it 'converts to `allow(obj).to receive(:message) { value }` form' do
|
199
199
|
rewritten_source.should == expected_source
|
200
200
|
end
|
201
201
|
|
@@ -216,7 +216,7 @@ module Transpec
|
|
216
216
|
context 'with #expect' do
|
217
217
|
let(:receive_object) { expect_object.receive_matcher }
|
218
218
|
|
219
|
-
context '
|
219
|
+
context 'with expression `expect_any_instance_of(Klass).to receive(:message) do |arg| .. end`' do
|
220
220
|
let(:source) do
|
221
221
|
<<-END
|
222
222
|
describe 'example' do
|
@@ -239,7 +239,7 @@ module Transpec
|
|
239
239
|
END
|
240
240
|
end
|
241
241
|
|
242
|
-
it 'converts
|
242
|
+
it 'converts to `expect_any_instance_of(Klass).to receive(:message) do |instance, arg| .. end` form' do
|
243
243
|
rewritten_source.should == expected_source
|
244
244
|
end
|
245
245
|
|
@@ -250,7 +250,7 @@ module Transpec
|
|
250
250
|
end
|
251
251
|
end
|
252
252
|
|
253
|
-
context '
|
253
|
+
context 'with expression `expect_any_instance_of(Klass).to receive(:message).once do |arg| .. end`' do
|
254
254
|
let(:source) do
|
255
255
|
<<-END
|
256
256
|
describe 'example' do
|
@@ -273,8 +273,8 @@ module Transpec
|
|
273
273
|
END
|
274
274
|
end
|
275
275
|
|
276
|
-
it 'converts
|
277
|
-
'`expect_any_instance_of(Klass).to receive(:
|
276
|
+
it 'converts to ' \
|
277
|
+
'`expect_any_instance_of(Klass).to receive(:message).once do |instance, arg| .. end` form' do
|
278
278
|
rewritten_source.should == expected_source
|
279
279
|
end
|
280
280
|
|
@@ -285,7 +285,7 @@ module Transpec
|
|
285
285
|
end
|
286
286
|
end
|
287
287
|
|
288
|
-
context '
|
288
|
+
context 'with expression `expect_any_instance_of(Klass).to receive(:message) { |arg| .. }`' do
|
289
289
|
let(:source) do
|
290
290
|
<<-END
|
291
291
|
describe 'example' do
|
@@ -308,7 +308,7 @@ module Transpec
|
|
308
308
|
END
|
309
309
|
end
|
310
310
|
|
311
|
-
it 'converts
|
311
|
+
it 'converts to `expect_any_instance_of(Klass).to receive(:message) { |instance, arg| .. }` form' do
|
312
312
|
rewritten_source.should == expected_source
|
313
313
|
end
|
314
314
|
|
@@ -319,7 +319,7 @@ module Transpec
|
|
319
319
|
end
|
320
320
|
end
|
321
321
|
|
322
|
-
context '
|
322
|
+
context 'with expression `expect_any_instance_of(Klass).to receive(:message) do .. end`' do
|
323
323
|
let(:source) do
|
324
324
|
<<-END
|
325
325
|
describe 'example' do
|
@@ -336,7 +336,7 @@ module Transpec
|
|
336
336
|
end
|
337
337
|
end
|
338
338
|
|
339
|
-
context '
|
339
|
+
context 'with expression `expect_any_instance_of(Klass).to receive(:message) do |instance| .. end`' do
|
340
340
|
let(:source) do
|
341
341
|
<<-END
|
342
342
|
describe 'example' do
|
@@ -353,7 +353,7 @@ module Transpec
|
|
353
353
|
end
|
354
354
|
end
|
355
355
|
|
356
|
-
context '
|
356
|
+
context 'with expression `expect(obj).to receive(:message) do |arg| .. end`' do
|
357
357
|
let(:source) do
|
358
358
|
<<-END
|
359
359
|
describe 'example' do
|
@@ -374,7 +374,7 @@ module Transpec
|
|
374
374
|
context 'with #allow' do
|
375
375
|
let(:receive_object) { allow_object.receive_matcher }
|
376
376
|
|
377
|
-
context '
|
377
|
+
context 'with expression `allow_any_instance_of(Klass).to receive(:message) do |arg| .. end`' do
|
378
378
|
let(:source) do
|
379
379
|
<<-END
|
380
380
|
describe 'example' do
|
@@ -397,7 +397,7 @@ module Transpec
|
|
397
397
|
END
|
398
398
|
end
|
399
399
|
|
400
|
-
it 'converts
|
400
|
+
it 'converts to `allow_any_instance_of(Klass).to receive(:message) do |instance, arg| .. end` form' do
|
401
401
|
rewritten_source.should == expected_source
|
402
402
|
end
|
403
403
|
|
@@ -408,7 +408,7 @@ module Transpec
|
|
408
408
|
end
|
409
409
|
end
|
410
410
|
|
411
|
-
context '
|
411
|
+
context 'with expression `allow_any_instance_of(Klass).to receive(:message) { |arg| .. }`' do
|
412
412
|
let(:source) do
|
413
413
|
<<-END
|
414
414
|
describe 'example' do
|
@@ -431,7 +431,7 @@ module Transpec
|
|
431
431
|
END
|
432
432
|
end
|
433
433
|
|
434
|
-
it 'converts
|
434
|
+
it 'converts to `allow_any_instance_of(Klass).to receive(:message) { |instance, arg| .. }` form' do
|
435
435
|
rewritten_source.should == expected_source
|
436
436
|
end
|
437
437
|
|
@@ -442,7 +442,7 @@ module Transpec
|
|
442
442
|
end
|
443
443
|
end
|
444
444
|
|
445
|
-
context '
|
445
|
+
context 'with expression `allow_any_instance_of(Klass).to receive(:message) do .. end`' do
|
446
446
|
let(:source) do
|
447
447
|
<<-END
|
448
448
|
describe 'example' do
|
@@ -459,7 +459,7 @@ module Transpec
|
|
459
459
|
end
|
460
460
|
end
|
461
461
|
|
462
|
-
context '
|
462
|
+
context 'with expression `allow_any_instance_of(Klass).to receive(:message) do |instance| .. end`' do
|
463
463
|
let(:source) do
|
464
464
|
<<-END
|
465
465
|
describe 'example' do
|
@@ -476,7 +476,7 @@ module Transpec
|
|
476
476
|
end
|
477
477
|
end
|
478
478
|
|
479
|
-
context '
|
479
|
+
context 'with expression `allow(obj).to receive(:message) do |arg| .. end`' do
|
480
480
|
let(:source) do
|
481
481
|
<<-END
|
482
482
|
describe 'example' do
|
@@ -12,7 +12,7 @@ module Transpec
|
|
12
12
|
let(:record) { should_receive_object.report.records.first }
|
13
13
|
|
14
14
|
describe '#expectize!' do
|
15
|
-
context '
|
15
|
+
context 'with expression `obj.should_receive(:message)`' do
|
16
16
|
let(:source) do
|
17
17
|
<<-END
|
18
18
|
describe 'example' do
|
@@ -33,7 +33,7 @@ module Transpec
|
|
33
33
|
END
|
34
34
|
end
|
35
35
|
|
36
|
-
it 'converts
|
36
|
+
it 'converts to `expect(obj).to receive(:message)` form' do
|
37
37
|
should_receive_object.expectize!
|
38
38
|
rewritten_source.should == expected_source
|
39
39
|
end
|
@@ -152,7 +152,7 @@ module Transpec
|
|
152
152
|
end
|
153
153
|
end
|
154
154
|
|
155
|
-
context '
|
155
|
+
context 'with expression `obj.should_not_receive(:message)`' do
|
156
156
|
let(:source) do
|
157
157
|
<<-END
|
158
158
|
describe 'example' do
|
@@ -173,7 +173,7 @@ module Transpec
|
|
173
173
|
END
|
174
174
|
end
|
175
175
|
|
176
|
-
it 'converts
|
176
|
+
it 'converts to `expect(obj).not_to receive(:message)` form' do
|
177
177
|
should_receive_object.expectize!
|
178
178
|
rewritten_source.should == expected_source
|
179
179
|
end
|
@@ -196,7 +196,7 @@ module Transpec
|
|
196
196
|
END
|
197
197
|
end
|
198
198
|
|
199
|
-
it 'converts
|
199
|
+
it 'converts to `expect(obj).to_not receive(:message)` form' do
|
200
200
|
should_receive_object.expectize!('to_not')
|
201
201
|
rewritten_source.should == expected_source
|
202
202
|
end
|
@@ -238,7 +238,7 @@ module Transpec
|
|
238
238
|
# arg == 1
|
239
239
|
# }
|
240
240
|
#
|
241
|
-
context '
|
241
|
+
context 'with expression `obj.should_receive(:message).with do .. end`' do
|
242
242
|
let(:source) do
|
243
243
|
<<-END
|
244
244
|
describe 'example' do
|
@@ -265,14 +265,14 @@ module Transpec
|
|
265
265
|
END
|
266
266
|
end
|
267
267
|
|
268
|
-
it 'converts
|
268
|
+
it 'converts to `expect(obj).to receive(:message) { .. }` form' do
|
269
269
|
should_receive_object.expectize!
|
270
270
|
rewritten_source.should == expected_source
|
271
271
|
end
|
272
272
|
end
|
273
273
|
|
274
274
|
# If #with take normal arguments, the block won't be used as an argument matcher.
|
275
|
-
context '
|
275
|
+
context 'with expression `obj.should_receive(:message).with(arg) do .. end`' do
|
276
276
|
let(:source) do
|
277
277
|
<<-END
|
278
278
|
describe 'example' do
|
@@ -299,7 +299,7 @@ module Transpec
|
|
299
299
|
END
|
300
300
|
end
|
301
301
|
|
302
|
-
it 'converts
|
302
|
+
it 'converts to `expect(obj).to receive(:message).with(arg) do .. end` form' do
|
303
303
|
should_receive_object.expectize!
|
304
304
|
rewritten_source.should == expected_source
|
305
305
|
end
|
@@ -313,7 +313,7 @@ module Transpec
|
|
313
313
|
# arg == 1
|
314
314
|
# end.once
|
315
315
|
#
|
316
|
-
# However with `expect(
|
316
|
+
# However with `expect(obj).to receive`, the do..end block is taken by the #to method.
|
317
317
|
# This means the receiver of #once method is return value of #to, that is actually
|
318
318
|
# return value of RSpec::Mocks::Matchers::Receive#setup_method_substitute
|
319
319
|
# and it's not the instance of RSpec::Mocks::MessageExpectation.
|
@@ -333,7 +333,7 @@ module Transpec
|
|
333
333
|
# arg == 1
|
334
334
|
# }.once
|
335
335
|
#
|
336
|
-
context '
|
336
|
+
context 'with expression `obj.should_receive(:message) do .. end.once`' do
|
337
337
|
let(:source) do
|
338
338
|
<<-END
|
339
339
|
describe 'example' do
|
@@ -360,14 +360,14 @@ module Transpec
|
|
360
360
|
END
|
361
361
|
end
|
362
362
|
|
363
|
-
it 'converts
|
363
|
+
it 'converts to `expect(obj).to receive(:message) { .. }.once` form' do
|
364
364
|
should_receive_object.expectize!
|
365
365
|
rewritten_source.should == expected_source
|
366
366
|
end
|
367
367
|
end
|
368
368
|
|
369
369
|
# This case, do..end block works without problem.
|
370
|
-
context '
|
370
|
+
context 'with expression `obj.should_receive(:message) do .. end`' do
|
371
371
|
let(:source) do
|
372
372
|
<<-END
|
373
373
|
describe 'example' do
|
@@ -394,13 +394,13 @@ module Transpec
|
|
394
394
|
END
|
395
395
|
end
|
396
396
|
|
397
|
-
it 'converts
|
397
|
+
it 'converts to `expect(obj).to receive(:message) do .. end` form' do
|
398
398
|
should_receive_object.expectize!
|
399
399
|
rewritten_source.should == expected_source
|
400
400
|
end
|
401
401
|
end
|
402
402
|
|
403
|
-
context '
|
403
|
+
context 'with expression `Klass.any_instance.should_receive(:message)`' do
|
404
404
|
let(:source) do
|
405
405
|
<<-END
|
406
406
|
describe 'example' do
|
@@ -421,7 +421,7 @@ module Transpec
|
|
421
421
|
END
|
422
422
|
end
|
423
423
|
|
424
|
-
it 'converts
|
424
|
+
it 'converts to `expect_any_instance_of(Klass).to receive(:message)` form' do
|
425
425
|
should_receive_object.expectize!
|
426
426
|
rewritten_source.should == expected_source
|
427
427
|
end
|
@@ -474,7 +474,7 @@ module Transpec
|
|
474
474
|
end
|
475
475
|
end
|
476
476
|
|
477
|
-
context '
|
477
|
+
context 'with expression `described_class.any_instance.should_receive(:message)`' do
|
478
478
|
let(:source) do
|
479
479
|
<<-END
|
480
480
|
describe 'example' do
|
@@ -495,7 +495,7 @@ module Transpec
|
|
495
495
|
END
|
496
496
|
end
|
497
497
|
|
498
|
-
it 'converts
|
498
|
+
it 'converts to `expect_any_instance_of(described_class).to receive(:message)` form' do
|
499
499
|
should_receive_object.expectize!
|
500
500
|
rewritten_source.should == expected_source
|
501
501
|
end
|
@@ -508,7 +508,7 @@ module Transpec
|
|
508
508
|
end
|
509
509
|
end
|
510
510
|
|
511
|
-
context '
|
511
|
+
context 'with expression `variable.any_instance.should_receive(:message)`' do
|
512
512
|
let(:source) do
|
513
513
|
<<-END
|
514
514
|
describe 'example' do
|
@@ -533,7 +533,7 @@ module Transpec
|
|
533
533
|
END
|
534
534
|
end
|
535
535
|
|
536
|
-
it 'converts
|
536
|
+
it 'converts to `expect_any_instance_of(variable).to receive(:message)` form' do
|
537
537
|
should_receive_object.expectize!
|
538
538
|
rewritten_source.should == expected_source
|
539
539
|
end
|
@@ -546,7 +546,7 @@ module Transpec
|
|
546
546
|
end
|
547
547
|
end
|
548
548
|
|
549
|
-
context '
|
549
|
+
context 'with expression `variable.should_receive(:message)` ' \
|
550
550
|
'and the variable is an AnyInstance::Recorder' do
|
551
551
|
context 'with runtime information' do
|
552
552
|
include_context 'dynamic analysis objects'
|
@@ -575,7 +575,7 @@ module Transpec
|
|
575
575
|
END
|
576
576
|
end
|
577
577
|
|
578
|
-
it 'converts
|
578
|
+
it 'converts to `expect_any_instance_of(Klass).to receive(:message)` form' do
|
579
579
|
should_receive_object.expectize!
|
580
580
|
rewritten_source.should == expected_source
|
581
581
|
end
|
@@ -593,7 +593,7 @@ module Transpec
|
|
593
593
|
describe '#useless_expectation?' do
|
594
594
|
subject { should_receive_object.useless_expectation? }
|
595
595
|
|
596
|
-
context '
|
596
|
+
context 'with expression `obj.should_receive(:message).any_number_of_times`' do
|
597
597
|
let(:source) do
|
598
598
|
<<-END
|
599
599
|
describe 'example' do
|
@@ -607,7 +607,7 @@ module Transpec
|
|
607
607
|
it { should be_true }
|
608
608
|
end
|
609
609
|
|
610
|
-
context '
|
610
|
+
context 'with expression `obj.should_receive(:message).with(arg).any_number_of_times`' do
|
611
611
|
let(:source) do
|
612
612
|
<<-END
|
613
613
|
describe 'example' do
|
@@ -621,7 +621,7 @@ module Transpec
|
|
621
621
|
it { should be_true }
|
622
622
|
end
|
623
623
|
|
624
|
-
context '
|
624
|
+
context 'with expression `obj.should_receive(:message).at_least(0)`' do
|
625
625
|
let(:source) do
|
626
626
|
<<-END
|
627
627
|
describe 'example' do
|
@@ -635,7 +635,7 @@ module Transpec
|
|
635
635
|
it { should be_true }
|
636
636
|
end
|
637
637
|
|
638
|
-
context '
|
638
|
+
context 'with expression `obj.should_receive(:message).at_least(1)`' do
|
639
639
|
let(:source) do
|
640
640
|
<<-END
|
641
641
|
describe 'example' do
|
@@ -649,7 +649,7 @@ module Transpec
|
|
649
649
|
it { should be_false }
|
650
650
|
end
|
651
651
|
|
652
|
-
context '
|
652
|
+
context 'with expression `obj.should_receive(:message)`' do
|
653
653
|
let(:source) do
|
654
654
|
<<-END
|
655
655
|
describe 'example' do
|
@@ -665,7 +665,7 @@ module Transpec
|
|
665
665
|
end
|
666
666
|
|
667
667
|
describe '#allowize_useless_expectation!' do
|
668
|
-
context '
|
668
|
+
context 'with expression `obj.should_receive(:message).any_number_of_times`' do
|
669
669
|
let(:source) do
|
670
670
|
<<-END
|
671
671
|
describe 'example' do
|
@@ -686,7 +686,7 @@ module Transpec
|
|
686
686
|
END
|
687
687
|
end
|
688
688
|
|
689
|
-
it 'converts
|
689
|
+
it 'converts to `allow(obj).to receive(:message)` form' do
|
690
690
|
should_receive_object.allowize_useless_expectation!
|
691
691
|
rewritten_source.should == expected_source
|
692
692
|
end
|
@@ -767,7 +767,7 @@ module Transpec
|
|
767
767
|
end
|
768
768
|
end
|
769
769
|
|
770
|
-
context '
|
770
|
+
context 'with expression `Klass.any_instance.should_receive(:message).any_number_of_times`' do
|
771
771
|
let(:source) do
|
772
772
|
<<-END
|
773
773
|
describe 'example' do
|
@@ -788,7 +788,7 @@ module Transpec
|
|
788
788
|
END
|
789
789
|
end
|
790
790
|
|
791
|
-
it 'converts
|
791
|
+
it 'converts to `allow_any_instance_of(Klass).to receive(:message)` form' do
|
792
792
|
should_receive_object.allowize_useless_expectation!
|
793
793
|
rewritten_source.should == expected_source
|
794
794
|
end
|
@@ -801,7 +801,7 @@ module Transpec
|
|
801
801
|
end
|
802
802
|
end
|
803
803
|
|
804
|
-
context '
|
804
|
+
context 'with expression `described_class.any_instance.should_receive(:message).any_number_of_times`' do
|
805
805
|
let(:source) do
|
806
806
|
<<-END
|
807
807
|
describe 'example' do
|
@@ -822,7 +822,7 @@ module Transpec
|
|
822
822
|
END
|
823
823
|
end
|
824
824
|
|
825
|
-
it 'converts
|
825
|
+
it 'converts to `allow_any_instance_of(described_class).to receive(:message)` form' do
|
826
826
|
should_receive_object.allowize_useless_expectation!
|
827
827
|
rewritten_source.should == expected_source
|
828
828
|
end
|
@@ -835,7 +835,7 @@ module Transpec
|
|
835
835
|
end
|
836
836
|
end
|
837
837
|
|
838
|
-
context '
|
838
|
+
context 'with expression `obj.should_receive(:message).at_least(0)`' do
|
839
839
|
let(:source) do
|
840
840
|
<<-END
|
841
841
|
describe 'example' do
|
@@ -856,7 +856,7 @@ module Transpec
|
|
856
856
|
END
|
857
857
|
end
|
858
858
|
|
859
|
-
it 'converts
|
859
|
+
it 'converts to `allow(obj).to receive(:message)` form' do
|
860
860
|
should_receive_object.allowize_useless_expectation!
|
861
861
|
rewritten_source.should == expected_source
|
862
862
|
end
|
@@ -869,7 +869,7 @@ module Transpec
|
|
869
869
|
end
|
870
870
|
end
|
871
871
|
|
872
|
-
context '
|
872
|
+
context 'with expression `Klass.any_instance.should_receive(:message).at_least(0)`' do
|
873
873
|
let(:source) do
|
874
874
|
<<-END
|
875
875
|
describe 'example' do
|
@@ -890,7 +890,7 @@ module Transpec
|
|
890
890
|
END
|
891
891
|
end
|
892
892
|
|
893
|
-
it 'converts
|
893
|
+
it 'converts to `allow_any_instance_of(Klass).to receive(:message)` form' do
|
894
894
|
should_receive_object.allowize_useless_expectation!
|
895
895
|
rewritten_source.should == expected_source
|
896
896
|
end
|
@@ -903,7 +903,7 @@ module Transpec
|
|
903
903
|
end
|
904
904
|
end
|
905
905
|
|
906
|
-
context '
|
906
|
+
context 'with expression `obj.should_receive(:message)`' do
|
907
907
|
let(:source) do
|
908
908
|
<<-END
|
909
909
|
describe 'example' do
|
@@ -926,7 +926,7 @@ module Transpec
|
|
926
926
|
should_receive_object.stubize_useless_expectation!
|
927
927
|
end
|
928
928
|
|
929
|
-
context '
|
929
|
+
context 'with expression `obj.should_receive(:message).any_number_of_times`' do
|
930
930
|
let(:source) do
|
931
931
|
<<-END
|
932
932
|
describe 'example' do
|
@@ -947,7 +947,7 @@ module Transpec
|
|
947
947
|
END
|
948
948
|
end
|
949
949
|
|
950
|
-
it 'converts
|
950
|
+
it 'converts to `obj.stub(:message)` form' do
|
951
951
|
rewritten_source.should == expected_source
|
952
952
|
end
|
953
953
|
|
@@ -958,7 +958,7 @@ module Transpec
|
|
958
958
|
end
|
959
959
|
end
|
960
960
|
|
961
|
-
context '
|
961
|
+
context 'with expression `obj.should_receive(:message)`' do
|
962
962
|
let(:source) do
|
963
963
|
<<-END
|
964
964
|
describe 'example' do
|
@@ -980,7 +980,7 @@ module Transpec
|
|
980
980
|
should_receive_object.remove_useless_and_return!
|
981
981
|
end
|
982
982
|
|
983
|
-
context '
|
983
|
+
context 'with expression `obj.should_receive(:message).and_return { value }`' do
|
984
984
|
let(:source) do
|
985
985
|
<<-END
|
986
986
|
describe 'example' do
|
@@ -1001,7 +1001,7 @@ module Transpec
|
|
1001
1001
|
END
|
1002
1002
|
end
|
1003
1003
|
|
1004
|
-
it 'converts
|
1004
|
+
it 'converts to `obj.should_receive(:message) { value }` form' do
|
1005
1005
|
rewritten_source.should == expected_source
|
1006
1006
|
end
|
1007
1007
|
|
@@ -1018,7 +1018,7 @@ module Transpec
|
|
1018
1018
|
should_receive_object.add_receiver_arg_to_any_instance_implementation_block!
|
1019
1019
|
end
|
1020
1020
|
|
1021
|
-
context '
|
1021
|
+
context 'with expression `Klass.any_instance.should_receive(:message) do |arg| .. end`' do
|
1022
1022
|
let(:source) do
|
1023
1023
|
<<-END
|
1024
1024
|
describe 'example' do
|
@@ -1041,7 +1041,7 @@ module Transpec
|
|
1041
1041
|
END
|
1042
1042
|
end
|
1043
1043
|
|
1044
|
-
it 'converts
|
1044
|
+
it 'converts to `Klass.any_instance.should_receive(:message) do |instance, arg| .. end` form' do
|
1045
1045
|
rewritten_source.should == expected_source
|
1046
1046
|
end
|
1047
1047
|
|
@@ -1052,7 +1052,7 @@ module Transpec
|
|
1052
1052
|
end
|
1053
1053
|
end
|
1054
1054
|
|
1055
|
-
context '
|
1055
|
+
context 'with expression `Klass.any_instance.should_receive(:message) do .. end`' do
|
1056
1056
|
let(:source) do
|
1057
1057
|
<<-END
|
1058
1058
|
describe 'example' do
|
@@ -1069,7 +1069,7 @@ module Transpec
|
|
1069
1069
|
end
|
1070
1070
|
end
|
1071
1071
|
|
1072
|
-
context '
|
1072
|
+
context 'with expression `Klass.any_instance.should_receive(:message) do |instance| .. end`' do
|
1073
1073
|
let(:source) do
|
1074
1074
|
<<-END
|
1075
1075
|
describe 'example' do
|
@@ -1086,7 +1086,7 @@ module Transpec
|
|
1086
1086
|
end
|
1087
1087
|
end
|
1088
1088
|
|
1089
|
-
context '
|
1089
|
+
context 'with expression `obj.should_receive(:message) do |arg| .. end`' do
|
1090
1090
|
let(:source) do
|
1091
1091
|
<<-END
|
1092
1092
|
describe 'example' do
|