transpec 0.2.6 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.rubocop.yml +1 -1
- data/CHANGELOG.md +10 -0
- data/README.md +111 -56
- data/README.md.erb +117 -62
- data/lib/transpec/ast/node.rb +41 -0
- data/lib/transpec/base_rewriter.rb +55 -0
- data/lib/transpec/cli.rb +43 -153
- data/lib/transpec/configuration.rb +13 -9
- data/lib/transpec/{rewriter.rb → converter.rb} +44 -71
- data/lib/transpec/dynamic_analyzer/rewriter.rb +94 -0
- data/lib/transpec/dynamic_analyzer/runtime_data.rb +27 -0
- data/lib/transpec/dynamic_analyzer.rb +166 -0
- data/lib/transpec/file_finder.rb +53 -0
- data/lib/transpec/option_parser.rb +166 -0
- data/lib/transpec/{context.rb → static_context_inspector.rb} +2 -2
- data/lib/transpec/syntax/be_close.rb +7 -9
- data/lib/transpec/syntax/double.rb +6 -10
- data/lib/transpec/syntax/expect.rb +35 -0
- data/lib/transpec/syntax/have.rb +195 -0
- data/lib/transpec/syntax/method_stub.rb +22 -27
- data/lib/transpec/syntax/mixin/allow_no_message.rb +73 -0
- data/lib/transpec/syntax/mixin/any_instance.rb +22 -0
- data/lib/transpec/syntax/mixin/expectizable.rb +26 -0
- data/lib/transpec/syntax/mixin/have_matcher.rb +23 -0
- data/lib/transpec/syntax/mixin/monkey_patch.rb +37 -0
- data/lib/transpec/syntax/mixin/send.rb +109 -0
- data/lib/transpec/syntax/{matcher.rb → operator_matcher.rb} +27 -14
- data/lib/transpec/syntax/raise_error.rb +6 -10
- data/lib/transpec/syntax/rspec_configure.rb +29 -28
- data/lib/transpec/syntax/should.rb +45 -15
- data/lib/transpec/syntax/should_receive.rb +44 -16
- data/lib/transpec/syntax.rb +29 -21
- data/lib/transpec/util.rb +12 -2
- data/lib/transpec/version.rb +3 -3
- data/spec/spec_helper.rb +8 -6
- data/spec/support/cache_helper.rb +50 -0
- data/spec/support/shared_context.rb +49 -1
- data/spec/transpec/ast/node_spec.rb +65 -0
- data/spec/transpec/cli_spec.rb +33 -242
- data/spec/transpec/commit_message_spec.rb +2 -2
- data/spec/transpec/configuration_spec.rb +12 -8
- data/spec/transpec/{rewriter_spec.rb → converter_spec.rb} +198 -148
- data/spec/transpec/dynamic_analyzer/rewriter_spec.rb +183 -0
- data/spec/transpec/dynamic_analyzer_spec.rb +164 -0
- data/spec/transpec/file_finder_spec.rb +118 -0
- data/spec/transpec/option_parser_spec.rb +185 -0
- data/spec/transpec/{context_spec.rb → static_context_inspector_spec.rb} +27 -12
- data/spec/transpec/syntax/be_close_spec.rb +8 -4
- data/spec/transpec/syntax/double_spec.rb +105 -12
- data/spec/transpec/syntax/expect_spec.rb +83 -0
- data/spec/transpec/syntax/have_spec.rb +599 -0
- data/spec/transpec/syntax/method_stub_spec.rb +276 -115
- data/spec/transpec/syntax/{matcher_spec.rb → operator_matcher_spec.rb} +277 -98
- data/spec/transpec/syntax/raise_error_spec.rb +92 -46
- data/spec/transpec/syntax/should_receive_spec.rb +298 -92
- data/spec/transpec/syntax/should_spec.rb +230 -44
- data/spec/transpec/util_spec.rb +2 -9
- data/tasks/lib/transpec_demo.rb +1 -1
- data/tasks/lib/transpec_test.rb +5 -7
- data/tasks/test.rake +5 -1
- data/transpec.gemspec +1 -1
- metadata +46 -22
- data/lib/transpec/syntax/able_to_allow_no_message.rb +0 -73
- data/lib/transpec/syntax/able_to_target_any_instance.rb +0 -24
- data/lib/transpec/syntax/expectizable.rb +0 -27
- data/lib/transpec/syntax/send_node_syntax.rb +0 -57
@@ -1,26 +1,31 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
|
3
3
|
require 'spec_helper'
|
4
|
-
require 'transpec/syntax/
|
4
|
+
require 'transpec/syntax/operator_matcher'
|
5
5
|
|
6
6
|
module Transpec
|
7
7
|
class Syntax
|
8
|
-
describe
|
8
|
+
describe OperatorMatcher do
|
9
|
+
include ::AST::Sexp
|
9
10
|
include_context 'parsed objects'
|
10
11
|
include_context 'should object'
|
11
12
|
|
12
13
|
subject(:matcher) do
|
13
|
-
|
14
|
+
OperatorMatcher.new(should_object.matcher_node, source_rewriter, runtime_data)
|
14
15
|
end
|
15
16
|
|
17
|
+
let(:runtime_data) { nil }
|
18
|
+
|
16
19
|
let(:record) { matcher.report.records.first }
|
17
20
|
|
18
21
|
describe '#method_name' do
|
19
22
|
context 'when it is operator matcher' do
|
20
23
|
let(:source) do
|
21
24
|
<<-END
|
22
|
-
|
23
|
-
|
25
|
+
describe 'example' do
|
26
|
+
it 'is 1' do
|
27
|
+
subject.should == 1
|
28
|
+
end
|
24
29
|
end
|
25
30
|
END
|
26
31
|
end
|
@@ -42,8 +47,10 @@ module Transpec
|
|
42
47
|
context 'when it is non-operator matcher' do
|
43
48
|
let(:source) do
|
44
49
|
<<-END
|
45
|
-
|
46
|
-
|
50
|
+
describe 'example' do
|
51
|
+
it 'is 1' do
|
52
|
+
subject.should eq(1)
|
53
|
+
end
|
47
54
|
end
|
48
55
|
END
|
49
56
|
end
|
@@ -73,16 +80,20 @@ module Transpec
|
|
73
80
|
context 'when it is `== 1` form' do
|
74
81
|
let(:source) do
|
75
82
|
<<-END
|
76
|
-
|
77
|
-
|
83
|
+
describe 'example' do
|
84
|
+
it 'is 1' do
|
85
|
+
subject.should == 1
|
86
|
+
end
|
78
87
|
end
|
79
88
|
END
|
80
89
|
end
|
81
90
|
|
82
91
|
let(:expected_source) do
|
83
92
|
<<-END
|
84
|
-
|
85
|
-
|
93
|
+
describe 'example' do
|
94
|
+
it 'is 1' do
|
95
|
+
subject.should eq(1)
|
96
|
+
end
|
86
97
|
end
|
87
98
|
END
|
88
99
|
end
|
@@ -107,19 +118,23 @@ module Transpec
|
|
107
118
|
context 'and its argument is in the next line' do
|
108
119
|
let(:source) do
|
109
120
|
<<-END
|
110
|
-
|
111
|
-
|
112
|
-
|
121
|
+
describe 'example' do
|
122
|
+
it 'is 1' do
|
123
|
+
subject.should ==
|
124
|
+
1
|
125
|
+
end
|
113
126
|
end
|
114
127
|
END
|
115
128
|
end
|
116
129
|
|
117
130
|
let(:expected_source) do
|
118
131
|
<<-END
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
132
|
+
describe 'example' do
|
133
|
+
it 'is 1' do
|
134
|
+
subject.should eq(
|
135
|
+
1
|
136
|
+
)
|
137
|
+
end
|
123
138
|
end
|
124
139
|
END
|
125
140
|
end
|
@@ -141,16 +156,20 @@ module Transpec
|
|
141
156
|
context 'when it is `==1` form' do
|
142
157
|
let(:source) do
|
143
158
|
<<-END
|
144
|
-
|
145
|
-
|
159
|
+
describe 'example' do
|
160
|
+
it 'is 1' do
|
161
|
+
subject.should==1
|
162
|
+
end
|
146
163
|
end
|
147
164
|
END
|
148
165
|
end
|
149
166
|
|
150
167
|
let(:expected_source) do
|
151
168
|
<<-END
|
152
|
-
|
153
|
-
|
169
|
+
describe 'example' do
|
170
|
+
it 'is 1' do
|
171
|
+
subject.should eq(1)
|
172
|
+
end
|
154
173
|
end
|
155
174
|
END
|
156
175
|
end
|
@@ -164,8 +183,10 @@ module Transpec
|
|
164
183
|
|
165
184
|
let(:expected_source) do
|
166
185
|
<<-END
|
167
|
-
|
168
|
-
|
186
|
+
describe 'example' do
|
187
|
+
it 'is 1' do
|
188
|
+
subject.should eq 1
|
189
|
+
end
|
169
190
|
end
|
170
191
|
END
|
171
192
|
end
|
@@ -179,16 +200,20 @@ module Transpec
|
|
179
200
|
context 'when it is `be == 1` form' do
|
180
201
|
let(:source) do
|
181
202
|
<<-END
|
182
|
-
|
183
|
-
|
203
|
+
describe 'example' do
|
204
|
+
it 'is 1' do
|
205
|
+
subject.should be == 1
|
206
|
+
end
|
184
207
|
end
|
185
208
|
END
|
186
209
|
end
|
187
210
|
|
188
211
|
let(:expected_source) do
|
189
212
|
<<-END
|
190
|
-
|
191
|
-
|
213
|
+
describe 'example' do
|
214
|
+
it 'is 1' do
|
215
|
+
subject.should eq(1)
|
216
|
+
end
|
192
217
|
end
|
193
218
|
END
|
194
219
|
end
|
@@ -206,16 +231,20 @@ module Transpec
|
|
206
231
|
context 'when it is `be.==(1)` form' do
|
207
232
|
let(:source) do
|
208
233
|
<<-END
|
209
|
-
|
210
|
-
|
234
|
+
describe 'example' do
|
235
|
+
it 'is 1' do
|
236
|
+
subject.should be.==(1)
|
237
|
+
end
|
211
238
|
end
|
212
239
|
END
|
213
240
|
end
|
214
241
|
|
215
242
|
let(:expected_source) do
|
216
243
|
<<-END
|
217
|
-
|
218
|
-
|
244
|
+
describe 'example' do
|
245
|
+
it 'is 1' do
|
246
|
+
subject.should eq(1)
|
247
|
+
end
|
219
248
|
end
|
220
249
|
END
|
221
250
|
end
|
@@ -228,16 +257,20 @@ module Transpec
|
|
228
257
|
context 'when it is `== (2 - 1)` form' do
|
229
258
|
let(:source) do
|
230
259
|
<<-END
|
231
|
-
|
232
|
-
|
260
|
+
describe 'example' do
|
261
|
+
it 'is 1' do
|
262
|
+
subject.should == (2 - 1)
|
263
|
+
end
|
233
264
|
end
|
234
265
|
END
|
235
266
|
end
|
236
267
|
|
237
268
|
let(:expected_source) do
|
238
269
|
<<-END
|
239
|
-
|
240
|
-
|
270
|
+
describe 'example' do
|
271
|
+
it 'is 1' do
|
272
|
+
subject.should eq(2 - 1)
|
273
|
+
end
|
241
274
|
end
|
242
275
|
END
|
243
276
|
end
|
@@ -250,16 +283,20 @@ module Transpec
|
|
250
283
|
context 'when it is `== (5 - 3) / (4 - 2)` form' do
|
251
284
|
let(:source) do
|
252
285
|
<<-END
|
253
|
-
|
254
|
-
|
286
|
+
describe 'example' do
|
287
|
+
it 'is 1' do
|
288
|
+
subject.should == (5 - 3) / (4 - 2)
|
289
|
+
end
|
255
290
|
end
|
256
291
|
END
|
257
292
|
end
|
258
293
|
|
259
294
|
let(:expected_source) do
|
260
295
|
<<-END
|
261
|
-
|
262
|
-
|
296
|
+
describe 'example' do
|
297
|
+
it 'is 1' do
|
298
|
+
subject.should eq((5 - 3) / (4 - 2))
|
299
|
+
end
|
263
300
|
end
|
264
301
|
END
|
265
302
|
end
|
@@ -272,16 +309,20 @@ module Transpec
|
|
272
309
|
context "when it is `== { 'key' => 'value' }` form" do
|
273
310
|
let(:source) do
|
274
311
|
<<-END
|
275
|
-
|
276
|
-
|
312
|
+
describe 'example' do
|
313
|
+
it 'is the hash' do
|
314
|
+
subject.should == { 'key' => 'value' }
|
315
|
+
end
|
277
316
|
end
|
278
317
|
END
|
279
318
|
end
|
280
319
|
|
281
320
|
let(:expected_source) do
|
282
321
|
<<-END
|
283
|
-
|
284
|
-
|
322
|
+
describe 'example' do
|
323
|
+
it 'is the hash' do
|
324
|
+
subject.should eq({ 'key' => 'value' })
|
325
|
+
end
|
285
326
|
end
|
286
327
|
END
|
287
328
|
end
|
@@ -309,16 +350,20 @@ module Transpec
|
|
309
350
|
context "when it is `#{operator} 1` form" do
|
310
351
|
let(:source) do
|
311
352
|
<<-END
|
312
|
-
|
313
|
-
|
353
|
+
describe 'example' do
|
354
|
+
it '#{description} 1' do
|
355
|
+
subject.should #{operator} 1
|
356
|
+
end
|
314
357
|
end
|
315
358
|
END
|
316
359
|
end
|
317
360
|
|
318
361
|
let(:expected_source) do
|
319
362
|
<<-END
|
320
|
-
|
321
|
-
|
363
|
+
describe 'example' do
|
364
|
+
it '#{description} 1' do
|
365
|
+
subject.should be #{operator} 1
|
366
|
+
end
|
322
367
|
end
|
323
368
|
END
|
324
369
|
end
|
@@ -336,8 +381,10 @@ module Transpec
|
|
336
381
|
context "when it is `be #{operator} 1` form" do
|
337
382
|
let(:source) do
|
338
383
|
<<-END
|
339
|
-
|
340
|
-
|
384
|
+
describe 'example' do
|
385
|
+
it '#{description} 1' do
|
386
|
+
subject.should be #{operator} 1
|
387
|
+
end
|
341
388
|
end
|
342
389
|
END
|
343
390
|
end
|
@@ -355,16 +402,20 @@ module Transpec
|
|
355
402
|
context 'when it is `=~ /pattern/` form' do
|
356
403
|
let(:source) do
|
357
404
|
<<-END
|
358
|
-
|
359
|
-
|
405
|
+
describe 'example' do
|
406
|
+
it 'matches the pattern' do
|
407
|
+
subject.should =~ /pattern/
|
408
|
+
end
|
360
409
|
end
|
361
410
|
END
|
362
411
|
end
|
363
412
|
|
364
413
|
let(:expected_source) do
|
365
414
|
<<-END
|
366
|
-
|
367
|
-
|
415
|
+
describe 'example' do
|
416
|
+
it 'matches the pattern' do
|
417
|
+
subject.should match(/pattern/)
|
418
|
+
end
|
368
419
|
end
|
369
420
|
END
|
370
421
|
end
|
@@ -382,16 +433,20 @@ module Transpec
|
|
382
433
|
context 'when it is `=~/pattern/` form' do
|
383
434
|
let(:source) do
|
384
435
|
<<-END
|
385
|
-
|
386
|
-
|
436
|
+
describe 'example' do
|
437
|
+
it 'matches the pattern' do
|
438
|
+
subject.should=~/pattern/
|
439
|
+
end
|
387
440
|
end
|
388
441
|
END
|
389
442
|
end
|
390
443
|
|
391
444
|
let(:expected_source) do
|
392
445
|
<<-END
|
393
|
-
|
394
|
-
|
446
|
+
describe 'example' do
|
447
|
+
it 'matches the pattern' do
|
448
|
+
subject.should match(/pattern/)
|
449
|
+
end
|
395
450
|
end
|
396
451
|
END
|
397
452
|
end
|
@@ -404,16 +459,20 @@ module Transpec
|
|
404
459
|
context 'when it is `be =~ /pattern/` form' do
|
405
460
|
let(:source) do
|
406
461
|
<<-END
|
407
|
-
|
408
|
-
|
462
|
+
describe 'example' do
|
463
|
+
it 'matches the pattern' do
|
464
|
+
subject.should be =~ /pattern/
|
465
|
+
end
|
409
466
|
end
|
410
467
|
END
|
411
468
|
end
|
412
469
|
|
413
470
|
let(:expected_source) do
|
414
471
|
<<-END
|
415
|
-
|
416
|
-
|
472
|
+
describe 'example' do
|
473
|
+
it 'matches the pattern' do
|
474
|
+
subject.should match(/pattern/)
|
475
|
+
end
|
417
476
|
end
|
418
477
|
END
|
419
478
|
end
|
@@ -426,16 +485,20 @@ module Transpec
|
|
426
485
|
context 'when it is `=~ [1, 2]` form' do
|
427
486
|
let(:source) do
|
428
487
|
<<-END
|
429
|
-
|
430
|
-
|
488
|
+
describe 'example' do
|
489
|
+
it 'contains 1 and 2' do
|
490
|
+
subject.should =~ [1, 2]
|
491
|
+
end
|
431
492
|
end
|
432
493
|
END
|
433
494
|
end
|
434
495
|
|
435
496
|
let(:expected_source) do
|
436
497
|
<<-END
|
437
|
-
|
438
|
-
|
498
|
+
describe 'example' do
|
499
|
+
it 'contains 1 and 2' do
|
500
|
+
subject.should match_array([1, 2])
|
501
|
+
end
|
439
502
|
end
|
440
503
|
END
|
441
504
|
end
|
@@ -453,16 +516,20 @@ module Transpec
|
|
453
516
|
context 'when it is `=~[1, 2]` form' do
|
454
517
|
let(:source) do
|
455
518
|
<<-END
|
456
|
-
|
457
|
-
|
519
|
+
describe 'example' do
|
520
|
+
it 'contains 1 and 2' do
|
521
|
+
subject.should=~[1, 2]
|
522
|
+
end
|
458
523
|
end
|
459
524
|
END
|
460
525
|
end
|
461
526
|
|
462
527
|
let(:expected_source) do
|
463
528
|
<<-END
|
464
|
-
|
465
|
-
|
529
|
+
describe 'example' do
|
530
|
+
it 'contains 1 and 2' do
|
531
|
+
subject.should match_array([1, 2])
|
532
|
+
end
|
466
533
|
end
|
467
534
|
END
|
468
535
|
end
|
@@ -475,16 +542,20 @@ module Transpec
|
|
475
542
|
context 'when it is `be =~ [1, 2]` form' do
|
476
543
|
let(:source) do
|
477
544
|
<<-END
|
478
|
-
|
479
|
-
|
545
|
+
describe 'example' do
|
546
|
+
it 'contains 1 and 2' do
|
547
|
+
subject.should be =~ [1, 2]
|
548
|
+
end
|
480
549
|
end
|
481
550
|
END
|
482
551
|
end
|
483
552
|
|
484
553
|
let(:expected_source) do
|
485
554
|
<<-END
|
486
|
-
|
487
|
-
|
555
|
+
describe 'example' do
|
556
|
+
it 'contains 1 and 2' do
|
557
|
+
subject.should match_array([1, 2])
|
558
|
+
end
|
488
559
|
end
|
489
560
|
END
|
490
561
|
end
|
@@ -493,6 +564,94 @@ module Transpec
|
|
493
564
|
rewritten_source.should == expected_source
|
494
565
|
end
|
495
566
|
end
|
567
|
+
|
568
|
+
context 'when it is `=~ variable` form' do
|
569
|
+
context 'and runtime type of the variable is array' do
|
570
|
+
include_context 'dynamic analysis objects'
|
571
|
+
|
572
|
+
let(:source) do
|
573
|
+
<<-END
|
574
|
+
describe 'example' do
|
575
|
+
it 'contains 1 and 2' do
|
576
|
+
variable = [1, 2]
|
577
|
+
[2, 1].should =~ variable
|
578
|
+
end
|
579
|
+
end
|
580
|
+
END
|
581
|
+
end
|
582
|
+
|
583
|
+
let(:expected_source) do
|
584
|
+
<<-END
|
585
|
+
describe 'example' do
|
586
|
+
it 'contains 1 and 2' do
|
587
|
+
variable = [1, 2]
|
588
|
+
[2, 1].should match_array(variable)
|
589
|
+
end
|
590
|
+
end
|
591
|
+
END
|
592
|
+
end
|
593
|
+
|
594
|
+
it 'converts into `match_array(variable)` form' do
|
595
|
+
rewritten_source.should == expected_source
|
596
|
+
end
|
597
|
+
end
|
598
|
+
|
599
|
+
context 'and runtime type of the variable is regular expression' do
|
600
|
+
include_context 'dynamic analysis objects'
|
601
|
+
|
602
|
+
let(:source) do
|
603
|
+
<<-END
|
604
|
+
describe 'example' do
|
605
|
+
it 'matches to the pattern' do
|
606
|
+
variable = /^str/
|
607
|
+
'string'.should =~ variable
|
608
|
+
end
|
609
|
+
end
|
610
|
+
END
|
611
|
+
end
|
612
|
+
|
613
|
+
let(:expected_source) do
|
614
|
+
<<-END
|
615
|
+
describe 'example' do
|
616
|
+
it 'matches to the pattern' do
|
617
|
+
variable = /^str/
|
618
|
+
'string'.should match(variable)
|
619
|
+
end
|
620
|
+
end
|
621
|
+
END
|
622
|
+
end
|
623
|
+
|
624
|
+
it 'converts into `match(variable)` form' do
|
625
|
+
rewritten_source.should == expected_source
|
626
|
+
end
|
627
|
+
end
|
628
|
+
|
629
|
+
context 'and no runtime type information is provided' do
|
630
|
+
let(:source) do
|
631
|
+
<<-END
|
632
|
+
describe 'example' do
|
633
|
+
it 'matches the pattern' do
|
634
|
+
subject.should =~ variable
|
635
|
+
end
|
636
|
+
end
|
637
|
+
END
|
638
|
+
end
|
639
|
+
|
640
|
+
let(:expected_source) do
|
641
|
+
<<-END
|
642
|
+
describe 'example' do
|
643
|
+
it 'matches the pattern' do
|
644
|
+
subject.should match(variable)
|
645
|
+
end
|
646
|
+
end
|
647
|
+
END
|
648
|
+
end
|
649
|
+
|
650
|
+
it 'converts into `match(variable)` form' do
|
651
|
+
rewritten_source.should == expected_source
|
652
|
+
end
|
653
|
+
end
|
654
|
+
end
|
496
655
|
end
|
497
656
|
|
498
657
|
describe '#parenthesize!' do
|
@@ -505,8 +664,10 @@ module Transpec
|
|
505
664
|
context 'when its argument is already in parentheses' do
|
506
665
|
let(:source) do
|
507
666
|
<<-END
|
508
|
-
|
509
|
-
|
667
|
+
describe 'example' do
|
668
|
+
it 'is 1' do
|
669
|
+
subject.should eq(1)
|
670
|
+
end
|
510
671
|
end
|
511
672
|
END
|
512
673
|
end
|
@@ -519,8 +680,10 @@ module Transpec
|
|
519
680
|
context 'when its argument is not in parentheses' do
|
520
681
|
let(:source) do
|
521
682
|
<<-END
|
522
|
-
|
523
|
-
|
683
|
+
describe 'example' do
|
684
|
+
it 'is 1' do
|
685
|
+
subject.should eq 1
|
686
|
+
end
|
524
687
|
end
|
525
688
|
END
|
526
689
|
end
|
@@ -530,8 +693,10 @@ module Transpec
|
|
530
693
|
|
531
694
|
let(:expected_source) do
|
532
695
|
<<-END
|
533
|
-
|
534
|
-
|
696
|
+
describe 'example' do
|
697
|
+
it 'is 1' do
|
698
|
+
subject.should eq(1)
|
699
|
+
end
|
535
700
|
end
|
536
701
|
END
|
537
702
|
end
|
@@ -546,8 +711,10 @@ module Transpec
|
|
546
711
|
|
547
712
|
let(:expected_source) do
|
548
713
|
<<-END
|
549
|
-
|
550
|
-
|
714
|
+
describe 'example' do
|
715
|
+
it 'is 1' do
|
716
|
+
subject.should eq 1
|
717
|
+
end
|
551
718
|
end
|
552
719
|
END
|
553
720
|
end
|
@@ -561,16 +728,20 @@ module Transpec
|
|
561
728
|
context 'when its multiple arguments are not in parentheses' do
|
562
729
|
let(:source) do
|
563
730
|
<<-END
|
564
|
-
|
565
|
-
|
731
|
+
describe 'example' do
|
732
|
+
it 'contains 1 and 2' do
|
733
|
+
subject.should include 1, 2
|
734
|
+
end
|
566
735
|
end
|
567
736
|
END
|
568
737
|
end
|
569
738
|
|
570
739
|
let(:expected_source) do
|
571
740
|
<<-END
|
572
|
-
|
573
|
-
|
741
|
+
describe 'example' do
|
742
|
+
it 'contains 1 and 2' do
|
743
|
+
subject.should include(1, 2)
|
744
|
+
end
|
574
745
|
end
|
575
746
|
END
|
576
747
|
end
|
@@ -583,16 +754,20 @@ module Transpec
|
|
583
754
|
context 'when its argument is a string literal' do
|
584
755
|
let(:source) do
|
585
756
|
<<-END
|
586
|
-
|
587
|
-
|
757
|
+
describe 'example' do
|
758
|
+
it "is 'string'" do
|
759
|
+
subject.should eq 'string'
|
760
|
+
end
|
588
761
|
end
|
589
762
|
END
|
590
763
|
end
|
591
764
|
|
592
765
|
let(:expected_source) do
|
593
766
|
<<-END
|
594
|
-
|
595
|
-
|
767
|
+
describe 'example' do
|
768
|
+
it "is 'string'" do
|
769
|
+
subject.should eq('string')
|
770
|
+
end
|
596
771
|
end
|
597
772
|
END
|
598
773
|
end
|
@@ -605,10 +780,12 @@ module Transpec
|
|
605
780
|
context 'when its argument is a here document' do
|
606
781
|
let(:source) do
|
607
782
|
<<-END
|
608
|
-
|
609
|
-
|
610
|
-
|
611
|
-
|
783
|
+
describe 'example' do
|
784
|
+
it 'returns the document' do
|
785
|
+
subject.should eq <<-HEREDOC
|
786
|
+
foo
|
787
|
+
HEREDOC
|
788
|
+
end
|
612
789
|
end
|
613
790
|
END
|
614
791
|
end
|
@@ -630,10 +807,12 @@ module Transpec
|
|
630
807
|
context 'when its argument is a here document with chained method' do
|
631
808
|
let(:source) do
|
632
809
|
<<-END
|
633
|
-
|
634
|
-
|
635
|
-
|
636
|
-
|
810
|
+
describe 'example' do
|
811
|
+
it 'returns the document' do
|
812
|
+
subject.should eq <<-HEREDOC.gsub('foo', 'bar')
|
813
|
+
foo
|
814
|
+
HEREDOC
|
815
|
+
end
|
637
816
|
end
|
638
817
|
END
|
639
818
|
end
|