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
@@ -127,7 +127,7 @@ module Transpec
|
|
127
127
|
end
|
128
128
|
end
|
129
129
|
|
130
|
-
context '
|
130
|
+
context 'with expression `collection.should have(2).items`' do
|
131
131
|
let(:source) do
|
132
132
|
<<-END
|
133
133
|
describe 'example' do
|
@@ -150,7 +150,7 @@ module Transpec
|
|
150
150
|
|
151
151
|
let(:have_object) { should_object.have_matcher }
|
152
152
|
|
153
|
-
it 'converts
|
153
|
+
it 'converts to `collection.size.should == 2` form' do
|
154
154
|
have_object.convert_to_standard_expectation!
|
155
155
|
rewritten_source.should == expected_source
|
156
156
|
end
|
@@ -179,7 +179,7 @@ module Transpec
|
|
179
179
|
should_object.have_matcher.convert_to_standard_expectation!(parenthesize_matcher_arg)
|
180
180
|
end
|
181
181
|
|
182
|
-
it 'converts
|
182
|
+
it 'converts to `expect(collection.size).to eq(2)` form' do
|
183
183
|
rewritten_source.should == expected_source
|
184
184
|
end
|
185
185
|
|
@@ -201,7 +201,7 @@ module Transpec
|
|
201
201
|
END
|
202
202
|
end
|
203
203
|
|
204
|
-
it 'converts
|
204
|
+
it 'converts to `expect(collection.size).to eq 2` form' do
|
205
205
|
rewritten_source.should == expected_source
|
206
206
|
end
|
207
207
|
|
@@ -213,7 +213,7 @@ module Transpec
|
|
213
213
|
end
|
214
214
|
end
|
215
215
|
|
216
|
-
context '
|
216
|
+
context 'with expression `collection.should_not have(2).items`' do
|
217
217
|
let(:source) do
|
218
218
|
<<-END
|
219
219
|
describe 'example' do
|
@@ -236,7 +236,7 @@ module Transpec
|
|
236
236
|
|
237
237
|
let(:have_object) { should_object.have_matcher }
|
238
238
|
|
239
|
-
it 'converts
|
239
|
+
it 'converts to `collection.size.should_not == 2` form' do
|
240
240
|
have_object.convert_to_standard_expectation!
|
241
241
|
rewritten_source.should == expected_source
|
242
242
|
end
|
@@ -248,7 +248,7 @@ module Transpec
|
|
248
248
|
end
|
249
249
|
end
|
250
250
|
|
251
|
-
context '
|
251
|
+
context 'with expression `collection.should have_at_least(2).items`' do
|
252
252
|
let(:source) do
|
253
253
|
<<-END
|
254
254
|
describe 'example' do
|
@@ -271,7 +271,7 @@ module Transpec
|
|
271
271
|
|
272
272
|
let(:have_object) { should_object.have_matcher }
|
273
273
|
|
274
|
-
it 'converts
|
274
|
+
it 'converts to `collection.size.should >= 2` form' do
|
275
275
|
have_object.convert_to_standard_expectation!
|
276
276
|
rewritten_source.should == expected_source
|
277
277
|
end
|
@@ -283,7 +283,7 @@ module Transpec
|
|
283
283
|
end
|
284
284
|
end
|
285
285
|
|
286
|
-
context '
|
286
|
+
context 'with expression `collection.should have_at_most(2).items`' do
|
287
287
|
let(:source) do
|
288
288
|
<<-END
|
289
289
|
describe 'example' do
|
@@ -306,7 +306,7 @@ module Transpec
|
|
306
306
|
|
307
307
|
let(:have_object) { should_object.have_matcher }
|
308
308
|
|
309
|
-
it 'converts
|
309
|
+
it 'converts to `collection.size.should >= 2` form' do
|
310
310
|
have_object.convert_to_standard_expectation!
|
311
311
|
rewritten_source.should == expected_source
|
312
312
|
end
|
@@ -318,7 +318,7 @@ module Transpec
|
|
318
318
|
end
|
319
319
|
end
|
320
320
|
|
321
|
-
context '
|
321
|
+
context 'with expression `expect(collection).to have(2).items`' do
|
322
322
|
let(:have_object) { expect_object.have_matcher }
|
323
323
|
|
324
324
|
context 'with runtime information' do
|
@@ -357,7 +357,7 @@ module Transpec
|
|
357
357
|
END
|
358
358
|
end
|
359
359
|
|
360
|
-
it 'converts
|
360
|
+
it 'converts to `expect(collection.count).to eq(2)` form' do
|
361
361
|
have_object.convert_to_standard_expectation!
|
362
362
|
rewritten_source.should == expected_source
|
363
363
|
end
|
@@ -393,7 +393,7 @@ module Transpec
|
|
393
393
|
END
|
394
394
|
end
|
395
395
|
|
396
|
-
it 'converts
|
396
|
+
it 'converts to `expect(collection.size).to eq(2)` form' do
|
397
397
|
have_object.convert_to_standard_expectation!
|
398
398
|
rewritten_source.should == expected_source
|
399
399
|
end
|
@@ -413,7 +413,7 @@ module Transpec
|
|
413
413
|
end
|
414
414
|
end
|
415
415
|
|
416
|
-
context '
|
416
|
+
context 'with expression `expect(collection).not_to have(2).items`' do
|
417
417
|
let(:source) do
|
418
418
|
<<-END
|
419
419
|
describe 'example' do
|
@@ -436,7 +436,7 @@ module Transpec
|
|
436
436
|
|
437
437
|
let(:have_object) { expect_object.have_matcher }
|
438
438
|
|
439
|
-
it 'converts
|
439
|
+
it 'converts to `expect(collection.size).not_to eq(2)` form' do
|
440
440
|
have_object.convert_to_standard_expectation!
|
441
441
|
rewritten_source.should == expected_source
|
442
442
|
end
|
@@ -448,7 +448,7 @@ module Transpec
|
|
448
448
|
end
|
449
449
|
end
|
450
450
|
|
451
|
-
context '
|
451
|
+
context 'with expression `expect(collection).to have_at_least(2).items`' do
|
452
452
|
let(:source) do
|
453
453
|
<<-END
|
454
454
|
describe 'example' do
|
@@ -471,7 +471,7 @@ module Transpec
|
|
471
471
|
|
472
472
|
let(:have_object) { expect_object.have_matcher }
|
473
473
|
|
474
|
-
it 'converts
|
474
|
+
it 'converts to `expect(collection.size).to be >= 2` form' do
|
475
475
|
have_object.convert_to_standard_expectation!
|
476
476
|
rewritten_source.should == expected_source
|
477
477
|
end
|
@@ -483,7 +483,7 @@ module Transpec
|
|
483
483
|
end
|
484
484
|
end
|
485
485
|
|
486
|
-
context '
|
486
|
+
context 'with expression `expect(collection).to have_at_most(2).items`' do
|
487
487
|
let(:source) do
|
488
488
|
<<-END
|
489
489
|
describe 'example' do
|
@@ -506,7 +506,7 @@ module Transpec
|
|
506
506
|
|
507
507
|
let(:have_object) { expect_object.have_matcher }
|
508
508
|
|
509
|
-
it 'converts
|
509
|
+
it 'converts to `expect(collection.size).to be <= 2` form' do
|
510
510
|
have_object.convert_to_standard_expectation!
|
511
511
|
rewritten_source.should == expected_source
|
512
512
|
end
|
@@ -518,7 +518,7 @@ module Transpec
|
|
518
518
|
end
|
519
519
|
end
|
520
520
|
|
521
|
-
context '
|
521
|
+
context 'with expression `expect(obj).to have(2).words`' do
|
522
522
|
let(:have_object) { expect_object.have_matcher }
|
523
523
|
|
524
524
|
context 'with runtime information' do
|
@@ -558,7 +558,7 @@ module Transpec
|
|
558
558
|
END
|
559
559
|
end
|
560
560
|
|
561
|
-
it 'converts
|
561
|
+
it 'converts to `expect(obj.words.size).to eq(2)` form' do
|
562
562
|
have_object.convert_to_standard_expectation!
|
563
563
|
rewritten_source.should == expected_source
|
564
564
|
end
|
@@ -615,7 +615,7 @@ module Transpec
|
|
615
615
|
END
|
616
616
|
end
|
617
617
|
|
618
|
-
it 'converts
|
618
|
+
it 'converts to `expect(obj.words.count).to eq(2)` form' do
|
619
619
|
have_object.convert_to_standard_expectation!
|
620
620
|
rewritten_source.should == expected_source
|
621
621
|
end
|
@@ -650,7 +650,7 @@ module Transpec
|
|
650
650
|
END
|
651
651
|
end
|
652
652
|
|
653
|
-
it 'converts
|
653
|
+
it 'converts to `expect(obj.size).to eq(2)` form' do
|
654
654
|
have_object.convert_to_standard_expectation!
|
655
655
|
rewritten_source.should == expected_source
|
656
656
|
end
|
@@ -697,7 +697,7 @@ module Transpec
|
|
697
697
|
END
|
698
698
|
end
|
699
699
|
|
700
|
-
it 'converts
|
700
|
+
it 'converts to `expect(obj.send(:words).size).to eq(2)` form' do
|
701
701
|
have_object.convert_to_standard_expectation!
|
702
702
|
rewritten_source.should == expected_source
|
703
703
|
end
|
@@ -744,7 +744,7 @@ module Transpec
|
|
744
744
|
END
|
745
745
|
end
|
746
746
|
|
747
|
-
it 'converts
|
747
|
+
it 'converts to `expect(obj.size).to eq(2)` form' do
|
748
748
|
have_object.convert_to_standard_expectation!
|
749
749
|
rewritten_source.should == expected_source
|
750
750
|
end
|
@@ -757,7 +757,7 @@ module Transpec
|
|
757
757
|
end
|
758
758
|
end
|
759
759
|
|
760
|
-
context '
|
760
|
+
context 'with expression `expect(obj).to have(1).word`' do
|
761
761
|
let(:have_object) { expect_object.have_matcher }
|
762
762
|
|
763
763
|
context 'with runtime information' do
|
@@ -801,7 +801,7 @@ module Transpec
|
|
801
801
|
END
|
802
802
|
end
|
803
803
|
|
804
|
-
it 'converts
|
804
|
+
it 'converts to `expect(obj.words.size).to eq(1)` form' do
|
805
805
|
have_object.convert_to_standard_expectation!
|
806
806
|
rewritten_source.should == expected_source
|
807
807
|
end
|
@@ -846,7 +846,7 @@ module Transpec
|
|
846
846
|
END
|
847
847
|
end
|
848
848
|
|
849
|
-
it 'converts
|
849
|
+
it 'converts to `expect(obj.size).to eq(1)` form' do
|
850
850
|
have_object.convert_to_standard_expectation!
|
851
851
|
rewritten_source.should == expected_source
|
852
852
|
end
|
@@ -897,7 +897,7 @@ module Transpec
|
|
897
897
|
END
|
898
898
|
end
|
899
899
|
|
900
|
-
it 'converts
|
900
|
+
it 'converts to `expect(obj.size).to eq(1)` form' do
|
901
901
|
have_object.convert_to_standard_expectation!
|
902
902
|
rewritten_source.should == expected_source
|
903
903
|
end
|
@@ -910,7 +910,7 @@ module Transpec
|
|
910
910
|
end
|
911
911
|
end
|
912
912
|
|
913
|
-
context '
|
913
|
+
context 'with expression `expect(obj).to have(2).errors_on(:name)`' do
|
914
914
|
let(:have_object) { expect_object.have_matcher }
|
915
915
|
|
916
916
|
context 'with runtime information' do
|
@@ -949,7 +949,7 @@ module Transpec
|
|
949
949
|
END
|
950
950
|
end
|
951
951
|
|
952
|
-
it 'converts
|
952
|
+
it 'converts to `expect(obj.errors_on(:name).size).to eq(2)` form' do
|
953
953
|
have_object.convert_to_standard_expectation!
|
954
954
|
rewritten_source.should == expected_source
|
955
955
|
end
|
@@ -999,7 +999,7 @@ module Transpec
|
|
999
999
|
END
|
1000
1000
|
end
|
1001
1001
|
|
1002
|
-
it 'converts
|
1002
|
+
it 'converts to `expect(obj.send(:errors_on, :name).size).to eq(2)` form' do
|
1003
1003
|
have_object.convert_to_standard_expectation!
|
1004
1004
|
rewritten_source.should == expected_source
|
1005
1005
|
end
|
@@ -1046,7 +1046,7 @@ module Transpec
|
|
1046
1046
|
END
|
1047
1047
|
end
|
1048
1048
|
|
1049
|
-
it 'converts
|
1049
|
+
it 'converts to `expect(obj.errors_on(:name).size).to eq(2)` form' do
|
1050
1050
|
have_object.convert_to_standard_expectation!
|
1051
1051
|
rewritten_source.should == expected_source
|
1052
1052
|
end
|
@@ -1060,7 +1060,7 @@ module Transpec
|
|
1060
1060
|
end
|
1061
1061
|
end
|
1062
1062
|
|
1063
|
-
context '
|
1063
|
+
context 'with expression `expect(method_returns_collection :some_arg).to have(2).items`' do
|
1064
1064
|
let(:source) do
|
1065
1065
|
<<-END
|
1066
1066
|
describe 'example' do
|
@@ -1083,13 +1083,13 @@ module Transpec
|
|
1083
1083
|
|
1084
1084
|
let(:have_object) { expect_object.have_matcher }
|
1085
1085
|
|
1086
|
-
it 'converts
|
1086
|
+
it 'converts to `expect(method_returns_collection(:some_arg).size).to eq(2)` form' do
|
1087
1087
|
have_object.convert_to_standard_expectation!
|
1088
1088
|
rewritten_source.should == expected_source
|
1089
1089
|
end
|
1090
1090
|
end
|
1091
1091
|
|
1092
|
-
context '
|
1092
|
+
context 'with expression `expect(method_returns_collection(:some_arg) { do_something }).to have(2).items`' do
|
1093
1093
|
let(:source) do
|
1094
1094
|
<<-END
|
1095
1095
|
describe 'example' do
|
@@ -1112,13 +1112,13 @@ module Transpec
|
|
1112
1112
|
|
1113
1113
|
let(:have_object) { expect_object.have_matcher }
|
1114
1114
|
|
1115
|
-
it 'converts
|
1115
|
+
it 'converts to `expect(method_returns_collection(:some_arg) { do_something }.size).to eq(2)` form' do
|
1116
1116
|
have_object.convert_to_standard_expectation!
|
1117
1117
|
rewritten_source.should == expected_source
|
1118
1118
|
end
|
1119
1119
|
end
|
1120
1120
|
|
1121
|
-
context "
|
1121
|
+
context "with expression `expect(hash['some_key']).to have(2).items`" do
|
1122
1122
|
let(:source) do
|
1123
1123
|
<<-END
|
1124
1124
|
describe 'example' do
|
@@ -1141,13 +1141,13 @@ module Transpec
|
|
1141
1141
|
|
1142
1142
|
let(:have_object) { expect_object.have_matcher }
|
1143
1143
|
|
1144
|
-
fit "converts
|
1144
|
+
fit "converts to `expect(hash['some_key'].size).to eq(2)` form" do
|
1145
1145
|
have_object.convert_to_standard_expectation!
|
1146
1146
|
rewritten_source.should == expected_source
|
1147
1147
|
end
|
1148
1148
|
end
|
1149
1149
|
|
1150
|
-
context '
|
1150
|
+
context 'with expression `it { should have(2).items }`' do
|
1151
1151
|
let(:source) do
|
1152
1152
|
<<-END
|
1153
1153
|
describe 'example' do
|
@@ -1166,7 +1166,7 @@ module Transpec
|
|
1166
1166
|
|
1167
1167
|
let(:have_object) { oneliner_should_object.have_matcher }
|
1168
1168
|
|
1169
|
-
it "converts
|
1169
|
+
it "converts to `it { should == 2 }` form since there's no subject" do
|
1170
1170
|
have_object.convert_to_standard_expectation!
|
1171
1171
|
rewritten_source.should == expected_source
|
1172
1172
|
end
|
@@ -39,7 +39,7 @@ module Transpec
|
|
39
39
|
end
|
40
40
|
end
|
41
41
|
|
42
|
-
context '
|
42
|
+
context 'with expression `its(:size) { ... }`' do
|
43
43
|
let(:source) do
|
44
44
|
<<-END
|
45
45
|
describe 'example' do
|
@@ -63,7 +63,7 @@ module Transpec
|
|
63
63
|
END
|
64
64
|
end
|
65
65
|
|
66
|
-
it "converts
|
66
|
+
it "converts to `describe '#size' do subject { super().size }; it { ... } end` form" do
|
67
67
|
rewritten_source.should == expected_source
|
68
68
|
end
|
69
69
|
|
@@ -136,7 +136,7 @@ module Transpec
|
|
136
136
|
end
|
137
137
|
end
|
138
138
|
|
139
|
-
context "
|
139
|
+
context "with expression `its('size') { ... }`" do
|
140
140
|
let(:source) do
|
141
141
|
<<-END
|
142
142
|
describe 'example' do
|
@@ -160,7 +160,7 @@ module Transpec
|
|
160
160
|
END
|
161
161
|
end
|
162
162
|
|
163
|
-
it "converts
|
163
|
+
it "converts to `describe '#size' do subject { super().size }; it { ... } end` form" do
|
164
164
|
rewritten_source.should == expected_source
|
165
165
|
end
|
166
166
|
|
@@ -170,7 +170,7 @@ module Transpec
|
|
170
170
|
end
|
171
171
|
end
|
172
172
|
|
173
|
-
context "
|
173
|
+
context "with expression `its('size.odd?') { ... }`" do
|
174
174
|
let(:source) do
|
175
175
|
<<-END
|
176
176
|
describe 'example' do
|
@@ -197,7 +197,7 @@ module Transpec
|
|
197
197
|
END
|
198
198
|
end
|
199
199
|
|
200
|
-
it 'converts
|
200
|
+
it 'converts to nested #describe' do
|
201
201
|
rewritten_source.should == expected_source
|
202
202
|
end
|
203
203
|
|
@@ -207,7 +207,7 @@ module Transpec
|
|
207
207
|
end
|
208
208
|
end
|
209
209
|
|
210
|
-
context '
|
210
|
+
context 'with expression `its([:foo]) { ... }`' do
|
211
211
|
let(:source) do
|
212
212
|
<<-END
|
213
213
|
describe 'example' do
|
@@ -231,7 +231,7 @@ module Transpec
|
|
231
231
|
END
|
232
232
|
end
|
233
233
|
|
234
|
-
it "converts
|
234
|
+
it "converts to `describe '[:foo]' do subject { super()[:foo] }; it { ... } end` form" do
|
235
235
|
rewritten_source.should == expected_source
|
236
236
|
end
|
237
237
|
|
@@ -241,7 +241,7 @@ module Transpec
|
|
241
241
|
end
|
242
242
|
end
|
243
243
|
|
244
|
-
context "
|
244
|
+
context "with expression `its(['foo']) { ... }`" do
|
245
245
|
let(:source) do
|
246
246
|
<<-END
|
247
247
|
describe 'example' do
|
@@ -265,7 +265,7 @@ module Transpec
|
|
265
265
|
END
|
266
266
|
end
|
267
267
|
|
268
|
-
it "converts
|
268
|
+
it "converts to `describe \"['foo']\" do subject { super()['foo'] }; it { ... } end` form" do
|
269
269
|
rewritten_source.should == expected_source
|
270
270
|
end
|
271
271
|
|
@@ -275,7 +275,7 @@ module Transpec
|
|
275
275
|
end
|
276
276
|
end
|
277
277
|
|
278
|
-
context '
|
278
|
+
context 'with expression `its([3, 2]) { ... }`' do
|
279
279
|
let(:source) do
|
280
280
|
<<-END
|
281
281
|
describe 'example' do
|
@@ -299,7 +299,7 @@ module Transpec
|
|
299
299
|
END
|
300
300
|
end
|
301
301
|
|
302
|
-
it "converts
|
302
|
+
it "converts to `describe '[3, 2]' do subject { super()[3, 2] }; it { ... } end` form" do
|
303
303
|
rewritten_source.should == expected_source
|
304
304
|
end
|
305
305
|
|
@@ -309,7 +309,7 @@ module Transpec
|
|
309
309
|
end
|
310
310
|
end
|
311
311
|
|
312
|
-
context '
|
312
|
+
context 'with expression `its(attribute) { ... }`' do
|
313
313
|
let(:source) do
|
314
314
|
<<-END
|
315
315
|
describe 'example' do
|
@@ -343,7 +343,7 @@ module Transpec
|
|
343
343
|
END
|
344
344
|
end
|
345
345
|
|
346
|
-
it 'converts
|
346
|
+
it 'converts to `describe attribute do subject { super().send(attribute) }; it { ... } end` form' do
|
347
347
|
rewritten_source.should == expected_source
|
348
348
|
end
|
349
349
|
|
@@ -353,7 +353,7 @@ module Transpec
|
|
353
353
|
end
|
354
354
|
end
|
355
355
|
|
356
|
-
context '
|
356
|
+
context 'with expression `its([1, length]) { ... }`' do
|
357
357
|
let(:source) do
|
358
358
|
<<-END
|
359
359
|
describe 'example' do
|
@@ -387,7 +387,7 @@ module Transpec
|
|
387
387
|
END
|
388
388
|
end
|
389
389
|
|
390
|
-
it 'converts
|
390
|
+
it 'converts to `describe [1, length] do subject { super()[1, length] }; it { ... } end` form' do
|
391
391
|
rewritten_source.should == expected_source
|
392
392
|
end
|
393
393
|
|
@@ -22,7 +22,7 @@ module Transpec
|
|
22
22
|
[:failure_message_for_should, :failure_message],
|
23
23
|
[:failure_message_for_should_not, :failure_message_when_negated]
|
24
24
|
].each do |target_method, converted_method|
|
25
|
-
context "
|
25
|
+
context "with expression `#{target_method} { }`" do
|
26
26
|
let(:source) do
|
27
27
|
<<-END
|
28
28
|
RSpec::Matchers.define :be_awesome do |expected|
|
@@ -43,7 +43,7 @@ module Transpec
|
|
43
43
|
END
|
44
44
|
end
|
45
45
|
|
46
|
-
it "converts
|
46
|
+
it "converts to `#{converted_method} { }` form" do
|
47
47
|
rewritten_source.should == expected_source
|
48
48
|
end
|
49
49
|
|