transpec 1.7.0 → 1.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +1 -1
- data/CHANGELOG.md +4 -0
- data/README.md +66 -25
- data/README.md.erb +65 -24
- data/lib/transpec/cli.rb +2 -1
- data/lib/transpec/configuration.rb +1 -0
- data/lib/transpec/converter.rb +7 -1
- data/lib/transpec/option_parser.rb +15 -1
- data/lib/transpec/syntax/have.rb +2 -13
- data/lib/transpec/syntax/method_stub.rb +7 -17
- data/lib/transpec/syntax/mixin/any_instance_block.rb +14 -0
- data/lib/transpec/syntax/mixin/owned_matcher.rb +27 -0
- data/lib/transpec/syntax/receive.rb +2 -13
- data/lib/transpec/syntax/rspec_configure.rb +8 -2
- data/lib/transpec/syntax/rspec_configure/expectations.rb +1 -1
- data/lib/transpec/syntax/rspec_configure/framework.rb +114 -105
- data/lib/transpec/syntax/rspec_configure/mocks.rb +1 -1
- data/lib/transpec/syntax/should_receive.rb +17 -37
- data/lib/transpec/util.rb +6 -0
- data/lib/transpec/version.rb +1 -1
- data/spec/transpec/configuration_spec.rb +1 -0
- data/spec/transpec/converter_spec.rb +61 -5
- data/spec/transpec/option_parser_spec.rb +9 -0
- data/spec/transpec/syntax/have_spec.rb +3 -3
- data/spec/transpec/syntax/method_stub_spec.rb +42 -10
- data/spec/transpec/syntax/oneliner_should_spec.rb +12 -12
- data/spec/transpec/syntax/raise_error_spec.rb +5 -5
- data/spec/transpec/syntax/receive_spec.rb +4 -4
- data/spec/transpec/syntax/rspec_configure_spec.rb +1 -1
- data/spec/transpec/syntax/should_receive_spec.rb +13 -13
- data/tasks/readme.rake +2 -1
- data/transpec.gemspec +1 -1
- metadata +11 -4
@@ -223,7 +223,7 @@ module Transpec
|
|
223
223
|
rewritten_source.should == expected_source
|
224
224
|
end
|
225
225
|
|
226
|
-
it 'adds record '
|
226
|
+
it 'adds record ' \
|
227
227
|
'`expect { }.not_to raise_error(SpecificErrorClass)` -> `expect { }.not_to raise_error`' do
|
228
228
|
record.original_syntax.should == 'expect { }.not_to raise_error(SpecificErrorClass)'
|
229
229
|
record.converted_syntax.should == 'expect { }.not_to raise_error'
|
@@ -281,7 +281,7 @@ module Transpec
|
|
281
281
|
rewritten_source.should == expected_source
|
282
282
|
end
|
283
283
|
|
284
|
-
it 'adds record '
|
284
|
+
it 'adds record ' \
|
285
285
|
'`expect { }.not_to raise_error(SpecificErrorClass)` -> `expect { }.not_to raise_error`' do
|
286
286
|
record.original_syntax.should == 'expect { }.not_to raise_error(SpecificErrorClass)'
|
287
287
|
record.converted_syntax.should == 'expect { }.not_to raise_error'
|
@@ -313,7 +313,7 @@ module Transpec
|
|
313
313
|
rewritten_source.should == expected_source
|
314
314
|
end
|
315
315
|
|
316
|
-
it 'adds record '
|
316
|
+
it 'adds record ' \
|
317
317
|
'`expect { }.not_to raise_error(SpecificErrorClass)` -> `expect { }.not_to raise_error`' do
|
318
318
|
record.original_syntax.should == 'expect { }.not_to raise_error(SpecificErrorClass)'
|
319
319
|
record.converted_syntax.should == 'expect { }.not_to raise_error'
|
@@ -345,7 +345,7 @@ module Transpec
|
|
345
345
|
rewritten_source.should == expected_source
|
346
346
|
end
|
347
347
|
|
348
|
-
it 'adds record '
|
348
|
+
it 'adds record ' \
|
349
349
|
'`expect { }.not_to raise_error(SpecificErrorClass, message)` -> `expect { }.not_to raise_error`' do
|
350
350
|
record.original_syntax.should == 'expect { }.not_to raise_error(SpecificErrorClass, message)'
|
351
351
|
record.converted_syntax.should == 'expect { }.not_to raise_error'
|
@@ -377,7 +377,7 @@ module Transpec
|
|
377
377
|
rewritten_source.should == expected_source
|
378
378
|
end
|
379
379
|
|
380
|
-
it 'adds record '
|
380
|
+
it 'adds record ' \
|
381
381
|
'`expect { }.not_to raise_error(message)` -> `expect { }.not_to raise_error`' do
|
382
382
|
record.original_syntax.should == 'expect { }.not_to raise_error(message)'
|
383
383
|
record.converted_syntax.should == 'expect { }.not_to raise_error'
|
@@ -49,7 +49,7 @@ module Transpec
|
|
49
49
|
rewritten_source.should == expected_source
|
50
50
|
end
|
51
51
|
|
52
|
-
it 'adds record `expect_any_instance_of(Klass).to receive(:message) { |arg| }` '
|
52
|
+
it 'adds record `expect_any_instance_of(Klass).to receive(:message) { |arg| }` ' \
|
53
53
|
'-> `Klass.any_instance.should_receive(:message) { |instance, arg| }`' do
|
54
54
|
record.original_syntax.should == 'expect_any_instance_of(Klass).to receive(:message) { |arg| }'
|
55
55
|
record.converted_syntax.should == 'expect_any_instance_of(Klass).to receive(:message) { |instance, arg| }'
|
@@ -83,7 +83,7 @@ module Transpec
|
|
83
83
|
rewritten_source.should == expected_source
|
84
84
|
end
|
85
85
|
|
86
|
-
it 'adds record `expect_any_instance_of(Klass).to receive(:message) { |arg| }` '
|
86
|
+
it 'adds record `expect_any_instance_of(Klass).to receive(:message) { |arg| }` ' \
|
87
87
|
'-> `Klass.any_instance.should_receive(:message) { |instance, arg| }`' do
|
88
88
|
record.original_syntax.should == 'expect_any_instance_of(Klass).to receive(:message) { |arg| }'
|
89
89
|
record.converted_syntax.should == 'expect_any_instance_of(Klass).to receive(:message) { |instance, arg| }'
|
@@ -172,7 +172,7 @@ module Transpec
|
|
172
172
|
rewritten_source.should == expected_source
|
173
173
|
end
|
174
174
|
|
175
|
-
it 'adds record `allow_any_instance_of(Klass).to receive(:message) { |arg| }` '
|
175
|
+
it 'adds record `allow_any_instance_of(Klass).to receive(:message) { |arg| }` ' \
|
176
176
|
'-> `Klass.any_instance.should_receive(:message) { |instance, arg| }`' do
|
177
177
|
record.original_syntax.should == 'allow_any_instance_of(Klass).to receive(:message) { |arg| }'
|
178
178
|
record.converted_syntax.should == 'allow_any_instance_of(Klass).to receive(:message) { |instance, arg| }'
|
@@ -206,7 +206,7 @@ module Transpec
|
|
206
206
|
rewritten_source.should == expected_source
|
207
207
|
end
|
208
208
|
|
209
|
-
it 'adds record `allow_any_instance_of(Klass).to receive(:message) { |arg| }` '
|
209
|
+
it 'adds record `allow_any_instance_of(Klass).to receive(:message) { |arg| }` ' \
|
210
210
|
'-> `Klass.any_instance.should_receive(:message) { |instance, arg| }`' do
|
211
211
|
record.original_syntax.should == 'allow_any_instance_of(Klass).to receive(:message) { |arg| }'
|
212
212
|
record.converted_syntax.should == 'allow_any_instance_of(Klass).to receive(:message) { |instance, arg| }'
|
@@ -178,7 +178,7 @@ module Transpec
|
|
178
178
|
rewritten_source.should == expected_source
|
179
179
|
end
|
180
180
|
|
181
|
-
it 'adds record '
|
181
|
+
it 'adds record ' \
|
182
182
|
'`obj.should_not_receive(:message)` -> `expect(obj).not_to receive(:message)`' do
|
183
183
|
should_receive_object.expectize!
|
184
184
|
record.original_syntax.should == 'obj.should_not_receive(:message)'
|
@@ -201,7 +201,7 @@ module Transpec
|
|
201
201
|
rewritten_source.should == expected_source
|
202
202
|
end
|
203
203
|
|
204
|
-
it 'adds record '
|
204
|
+
it 'adds record ' \
|
205
205
|
'`obj.should_not_receive(:message)` -> `expect(obj).to_not receive(:message)`' do
|
206
206
|
should_receive_object.expectize!('to_not')
|
207
207
|
record.original_syntax.should == 'obj.should_not_receive(:message)'
|
@@ -426,7 +426,7 @@ module Transpec
|
|
426
426
|
rewritten_source.should == expected_source
|
427
427
|
end
|
428
428
|
|
429
|
-
it 'adds record `Klass.any_instance.should_receive(:message)` '
|
429
|
+
it 'adds record `Klass.any_instance.should_receive(:message)` ' \
|
430
430
|
'-> `expect_any_instance_of(Klass).to receive(:message)`' do
|
431
431
|
should_receive_object.expectize!
|
432
432
|
record.original_syntax.should == 'Klass.any_instance.should_receive(:message)'
|
@@ -500,7 +500,7 @@ module Transpec
|
|
500
500
|
rewritten_source.should == expected_source
|
501
501
|
end
|
502
502
|
|
503
|
-
it 'adds record `Klass.any_instance.should_receive(:message)` '
|
503
|
+
it 'adds record `Klass.any_instance.should_receive(:message)` ' \
|
504
504
|
'-> `expect_any_instance_of(Klass).to receive(:message)`' do
|
505
505
|
should_receive_object.expectize!
|
506
506
|
record.original_syntax.should == 'Klass.any_instance.should_receive(:message)'
|
@@ -508,7 +508,7 @@ module Transpec
|
|
508
508
|
end
|
509
509
|
end
|
510
510
|
|
511
|
-
context 'when it is `variable.any_instance.should_receive(:method)` form '
|
511
|
+
context 'when it is `variable.any_instance.should_receive(:method)` form ' \
|
512
512
|
'and the variable is an AnyInstance::Recorder' do
|
513
513
|
context 'with runtime information' do
|
514
514
|
include_context 'dynamic analysis objects'
|
@@ -542,7 +542,7 @@ module Transpec
|
|
542
542
|
rewritten_source.should == expected_source
|
543
543
|
end
|
544
544
|
|
545
|
-
it 'adds record `Klass.any_instance.should_receive(:message)` '
|
545
|
+
it 'adds record `Klass.any_instance.should_receive(:message)` ' \
|
546
546
|
'-> `expect_any_instance_of(Klass).to receive(:message)`' do
|
547
547
|
should_receive_object.expectize!
|
548
548
|
record.original_syntax.should == 'Klass.any_instance.should_receive(:message)'
|
@@ -653,7 +653,7 @@ module Transpec
|
|
653
653
|
rewritten_source.should == expected_source
|
654
654
|
end
|
655
655
|
|
656
|
-
it 'adds record '
|
656
|
+
it 'adds record ' \
|
657
657
|
'`obj.should_receive(:message).any_number_of_times` -> `allow(obj).to receive(:message)`' do
|
658
658
|
should_receive_object.allowize_useless_expectation!
|
659
659
|
record.original_syntax.should == 'obj.should_receive(:message).any_number_of_times'
|
@@ -755,7 +755,7 @@ module Transpec
|
|
755
755
|
rewritten_source.should == expected_source
|
756
756
|
end
|
757
757
|
|
758
|
-
it 'adds record `Klass.any_instance.should_receive(:message).any_number_of_times` '
|
758
|
+
it 'adds record `Klass.any_instance.should_receive(:message).any_number_of_times` ' \
|
759
759
|
'-> `allow_any_instance_of(Klass).to receive(:message)`' do
|
760
760
|
should_receive_object.allowize_useless_expectation!
|
761
761
|
record.original_syntax.should == 'Klass.any_instance.should_receive(:message).any_number_of_times'
|
@@ -789,7 +789,7 @@ module Transpec
|
|
789
789
|
rewritten_source.should == expected_source
|
790
790
|
end
|
791
791
|
|
792
|
-
it 'adds record `Klass.any_instance.should_receive(:message).any_number_of_times` '
|
792
|
+
it 'adds record `Klass.any_instance.should_receive(:message).any_number_of_times` ' \
|
793
793
|
'-> `allow_any_instance_of(Klass).to receive(:message)`' do
|
794
794
|
should_receive_object.allowize_useless_expectation!
|
795
795
|
record.original_syntax.should == 'Klass.any_instance.should_receive(:message).any_number_of_times'
|
@@ -823,7 +823,7 @@ module Transpec
|
|
823
823
|
rewritten_source.should == expected_source
|
824
824
|
end
|
825
825
|
|
826
|
-
it 'adds record '
|
826
|
+
it 'adds record ' \
|
827
827
|
'`obj.should_receive(:message).at_least(0)` -> `allow(obj).to receive(:message)`' do
|
828
828
|
should_receive_object.allowize_useless_expectation!
|
829
829
|
record.original_syntax.should == 'obj.should_receive(:message).at_least(0)'
|
@@ -857,7 +857,7 @@ module Transpec
|
|
857
857
|
rewritten_source.should == expected_source
|
858
858
|
end
|
859
859
|
|
860
|
-
it 'adds record `Klass.any_instance.should_receive(:message).at_least(0)` '
|
860
|
+
it 'adds record `Klass.any_instance.should_receive(:message).at_least(0)` ' \
|
861
861
|
'-> `allow_any_instance_of(Klass).to receive(:message)`' do
|
862
862
|
should_receive_object.allowize_useless_expectation!
|
863
863
|
record.original_syntax.should == 'Klass.any_instance.should_receive(:message).at_least(0)'
|
@@ -913,7 +913,7 @@ module Transpec
|
|
913
913
|
rewritten_source.should == expected_source
|
914
914
|
end
|
915
915
|
|
916
|
-
it 'adds record '
|
916
|
+
it 'adds record ' \
|
917
917
|
'`obj.should_receive(:message).any_number_of_times` -> `obj.stub(:message)`' do
|
918
918
|
record.original_syntax.should == 'obj.should_receive(:message).any_number_of_times'
|
919
919
|
record.converted_syntax.should == 'obj.stub(:message)'
|
@@ -969,7 +969,7 @@ module Transpec
|
|
969
969
|
rewritten_source.should == expected_source
|
970
970
|
end
|
971
971
|
|
972
|
-
it 'adds record `Klass.any_instance.should_receive(:message) { |arg| }` '
|
972
|
+
it 'adds record `Klass.any_instance.should_receive(:message) { |arg| }` ' \
|
973
973
|
'-> `Klass.any_instance.should_receive(:message) { |instance, arg| }`' do
|
974
974
|
record.original_syntax.should == 'Klass.any_instance.should_receive(:message) { |arg| }'
|
975
975
|
record.converted_syntax.should == 'Klass.any_instance.should_receive(:message) { |instance, arg| }'
|
data/tasks/readme.rake
CHANGED
data/transpec.gemspec
CHANGED
@@ -24,7 +24,7 @@ Gem::Specification.new do |spec|
|
|
24
24
|
|
25
25
|
spec.add_runtime_dependency 'parser', '>= 2.1.3', '< 3.0'
|
26
26
|
spec.add_runtime_dependency 'bundler', '~> 1.3'
|
27
|
-
spec.add_runtime_dependency 'rainbow', '
|
27
|
+
spec.add_runtime_dependency 'rainbow', '>= 1.99.1', '< 3.0'
|
28
28
|
spec.add_runtime_dependency 'json', '~> 1.8'
|
29
29
|
spec.add_runtime_dependency 'activesupport', '~> 4.0'
|
30
30
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: transpec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yuji Nakayama
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-02-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: parser
|
@@ -48,16 +48,22 @@ dependencies:
|
|
48
48
|
name: rainbow
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|
50
50
|
requirements:
|
51
|
-
- - "
|
51
|
+
- - ">="
|
52
52
|
- !ruby/object:Gem::Version
|
53
53
|
version: 1.99.1
|
54
|
+
- - "<"
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: '3.0'
|
54
57
|
type: :runtime
|
55
58
|
prerelease: false
|
56
59
|
version_requirements: !ruby/object:Gem::Requirement
|
57
60
|
requirements:
|
58
|
-
- - "
|
61
|
+
- - ">="
|
59
62
|
- !ruby/object:Gem::Version
|
60
63
|
version: 1.99.1
|
64
|
+
- - "<"
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: '3.0'
|
61
67
|
- !ruby/object:Gem::Dependency
|
62
68
|
name: json
|
63
69
|
requirement: !ruby/object:Gem::Requirement
|
@@ -263,6 +269,7 @@ files:
|
|
263
269
|
- lib/transpec/syntax/mixin/have_matcher_owner.rb
|
264
270
|
- lib/transpec/syntax/mixin/monkey_patch.rb
|
265
271
|
- lib/transpec/syntax/mixin/monkey_patch_any_instance.rb
|
272
|
+
- lib/transpec/syntax/mixin/owned_matcher.rb
|
266
273
|
- lib/transpec/syntax/mixin/send.rb
|
267
274
|
- lib/transpec/syntax/mixin/should_base.rb
|
268
275
|
- lib/transpec/syntax/oneliner_should.rb
|