transpec 2.2.5 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/lib/transpec/conversion_error.rb +5 -5
- data/lib/transpec/converter.rb +14 -12
- data/lib/transpec/record.rb +88 -31
- data/lib/transpec/report.rb +19 -11
- data/lib/transpec/rspec_version.rb +9 -0
- data/lib/transpec/syntax/be_boolean.rb +2 -2
- data/lib/transpec/syntax/be_close.rb +1 -1
- data/lib/transpec/syntax/current_example.rb +35 -17
- data/lib/transpec/syntax/double.rb +1 -1
- data/lib/transpec/syntax/example.rb +0 -4
- data/lib/transpec/syntax/example_group.rb +11 -11
- data/lib/transpec/syntax/have/{have_record.rb → record_builder.rb} +15 -17
- data/lib/transpec/syntax/have.rb +2 -2
- data/lib/transpec/syntax/hook.rb +3 -3
- data/lib/transpec/syntax/its.rb +25 -17
- data/lib/transpec/syntax/matcher_definition.rb +1 -2
- data/lib/transpec/syntax/method_stub.rb +44 -51
- data/lib/transpec/syntax/mixin/any_instance_block.rb +8 -6
- data/lib/transpec/syntax/mixin/useless_and_return.rb +9 -7
- data/lib/transpec/syntax/oneliner_should.rb +29 -27
- data/lib/transpec/syntax/operator.rb +3 -3
- data/lib/transpec/syntax/pending.rb +0 -4
- data/lib/transpec/syntax/raise_error.rb +35 -15
- data/lib/transpec/syntax/receive.rb +6 -6
- data/lib/transpec/syntax/rspec_configure/config_modification.rb +39 -5
- data/lib/transpec/syntax/rspec_configure/framework.rb +27 -7
- data/lib/transpec/syntax/rspec_configure/mocks.rb +2 -2
- data/lib/transpec/syntax/rspec_configure.rb +35 -4
- data/lib/transpec/syntax/should.rb +35 -20
- data/lib/transpec/syntax/should_receive.rb +30 -27
- data/lib/transpec/syntax.rb +10 -0
- data/lib/transpec/version.rb +2 -2
- data/spec/integration/configuration_modification_spec.rb +43 -3
- data/spec/transpec/record_spec.rb +113 -18
- data/spec/transpec/report_spec.rb +15 -6
- data/spec/transpec/rspec_version_spec.rb +5 -0
- data/spec/transpec/syntax/be_boolean_spec.rb +10 -10
- data/spec/transpec/syntax/be_close_spec.rb +2 -2
- data/spec/transpec/syntax/current_example_spec.rb +6 -6
- data/spec/transpec/syntax/double_spec.rb +2 -2
- data/spec/transpec/syntax/example_group_spec.rb +4 -4
- data/spec/transpec/syntax/example_spec.rb +8 -8
- data/spec/transpec/syntax/have_spec.rb +44 -44
- data/spec/transpec/syntax/hook_spec.rb +8 -8
- 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 +36 -36
- data/spec/transpec/syntax/oneliner_should_spec.rb +26 -26
- data/spec/transpec/syntax/operator_spec.rb +18 -18
- data/spec/transpec/syntax/pending_spec.rb +6 -6
- data/spec/transpec/syntax/raise_error_spec.rb +10 -10
- data/spec/transpec/syntax/receive_spec.rb +20 -20
- data/spec/transpec/syntax/rspec_configure_spec.rb +202 -18
- data/spec/transpec/syntax/should_receive_spec.rb +30 -30
- data/spec/transpec/syntax/should_spec.rb +8 -8
- data/tasks/fixtures/mail/2.99.0/COMMIT_EDITMSG +1 -1
- data/tasks/fixtures/mail/3.0.0/COMMIT_EDITMSG +5 -2
- data/tasks/fixtures/twitter/2.99.0/COMMIT_EDITMSG +1 -1
- data/tasks/fixtures/twitter/3.0.0/COMMIT_EDITMSG +2 -2
- metadata +2 -2
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
require 'spec_helper'
|
4
4
|
require 'transpec/syntax/rspec_configure'
|
5
|
+
require 'transpec/rspec_version'
|
5
6
|
|
6
7
|
module Transpec
|
7
8
|
class Syntax
|
@@ -9,6 +10,8 @@ module Transpec
|
|
9
10
|
include_context 'parsed objects'
|
10
11
|
include_context 'syntax object', RSpecConfigure, :rspec_configure
|
11
12
|
|
13
|
+
let(:record) { rspec_configure.report.records.first }
|
14
|
+
|
12
15
|
context 'when multiple configurations are added' do
|
13
16
|
before do
|
14
17
|
rspec_configure.expose_dsl_globally = true
|
@@ -53,31 +56,172 @@ module Transpec
|
|
53
56
|
end
|
54
57
|
end
|
55
58
|
|
56
|
-
describe '#
|
59
|
+
describe '#convert_deprecated_options!' do
|
57
60
|
before do
|
58
|
-
rspec_configure.
|
61
|
+
rspec_configure.convert_deprecated_options!(RSpecVersion.new('3.0.0'))
|
59
62
|
end
|
60
63
|
|
61
|
-
|
64
|
+
[
|
65
|
+
[:output, :output_stream],
|
66
|
+
[:out, :output_stream],
|
67
|
+
[:filename_pattern, :pattern],
|
68
|
+
[:backtrace_cleaner, :backtrace_formatter],
|
69
|
+
[:backtrace_clean_patterns, :backtrace_exclusion_patterns],
|
70
|
+
[:warnings, :warnings?]
|
71
|
+
].each do |old_config, new_config|
|
72
|
+
context "with `c.#{old_config}`" do
|
73
|
+
let(:source) do
|
74
|
+
<<-END
|
75
|
+
RSpec.configure do |config|
|
76
|
+
if config.#{old_config} == something
|
77
|
+
do_something
|
78
|
+
end
|
79
|
+
end
|
80
|
+
END
|
81
|
+
end
|
62
82
|
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
83
|
+
let(:expected_source) do
|
84
|
+
<<-END
|
85
|
+
RSpec.configure do |config|
|
86
|
+
if config.#{new_config} == something
|
87
|
+
do_something
|
88
|
+
end
|
89
|
+
end
|
90
|
+
END
|
67
91
|
end
|
68
|
-
|
92
|
+
|
93
|
+
it "converts to `c.#{new_config}`" do
|
94
|
+
rewritten_source.should == expected_source
|
95
|
+
end
|
96
|
+
|
97
|
+
it 'adds record of conversion ' \
|
98
|
+
"`RSpec.configure { |c| c.#{old_config} }` -> " \
|
99
|
+
"`RSpec.configure { |c| c.#{new_config} }`" do
|
100
|
+
record.type.should == :conversion
|
101
|
+
record.old_syntax.should == "RSpec.configure { |c| c.#{old_config} }"
|
102
|
+
record.new_syntax.should == "RSpec.configure { |c| c.#{new_config} }"
|
103
|
+
end
|
104
|
+
end
|
69
105
|
end
|
70
106
|
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
107
|
+
[
|
108
|
+
[:output, :output_stream],
|
109
|
+
[:out, :output_stream],
|
110
|
+
[:filename_pattern, :pattern],
|
111
|
+
[:backtrace_clean_patterns, :backtrace_exclusion_patterns],
|
112
|
+
[:color_enabled, :color]
|
113
|
+
].each do |old_config, new_config|
|
114
|
+
context "with `c.#{old_config} = something`" do
|
115
|
+
let(:source) do
|
116
|
+
<<-END
|
117
|
+
RSpec.configure do |config|
|
118
|
+
config.#{old_config} = something
|
119
|
+
end
|
120
|
+
END
|
75
121
|
end
|
76
|
-
|
122
|
+
|
123
|
+
let(:expected_source) do
|
124
|
+
<<-END
|
125
|
+
RSpec.configure do |config|
|
126
|
+
config.#{new_config} = something
|
127
|
+
end
|
128
|
+
END
|
129
|
+
end
|
130
|
+
|
131
|
+
it "converts to `c.#{new_config} = something`" do
|
132
|
+
rewritten_source.should == expected_source
|
133
|
+
end
|
134
|
+
|
135
|
+
it 'adds record of conversion ' \
|
136
|
+
"`RSpec.configure { |c| c.#{old_config} = something }` -> " \
|
137
|
+
"`RSpec.configure { |c| c.#{new_config} = something }`" do
|
138
|
+
record.type.should == :conversion
|
139
|
+
record.old_syntax.should == "RSpec.configure { |c| c.#{old_config} = something }"
|
140
|
+
record.new_syntax.should == "RSpec.configure { |c| c.#{new_config} = something }"
|
141
|
+
end
|
142
|
+
end
|
77
143
|
end
|
78
144
|
|
79
|
-
|
80
|
-
|
145
|
+
context 'with `c.color?(io)`' do
|
146
|
+
let(:source) do
|
147
|
+
<<-END
|
148
|
+
RSpec.configure do |config|
|
149
|
+
if config.color?($stdout)
|
150
|
+
do_something
|
151
|
+
end
|
152
|
+
end
|
153
|
+
END
|
154
|
+
end
|
155
|
+
|
156
|
+
let(:expected_source) do
|
157
|
+
<<-END
|
158
|
+
RSpec.configure do |config|
|
159
|
+
if config.color_enabled?($stdout)
|
160
|
+
do_something
|
161
|
+
end
|
162
|
+
end
|
163
|
+
END
|
164
|
+
end
|
165
|
+
|
166
|
+
it 'convertes to `c.color_enabled?(io)`' do
|
167
|
+
rewritten_source.should == expected_source
|
168
|
+
end
|
169
|
+
end
|
170
|
+
end
|
171
|
+
|
172
|
+
describe '#expose_dsl_globally=' do
|
173
|
+
before do
|
174
|
+
rspec_configure.expose_dsl_globally = false
|
175
|
+
end
|
176
|
+
|
177
|
+
context 'when #expose_dsl_globally= already exists' do
|
178
|
+
context 'and the current value is same as the new value' do
|
179
|
+
let(:source) do
|
180
|
+
<<-END
|
181
|
+
RSpec.configure do |config|
|
182
|
+
config.expose_dsl_globally = false
|
183
|
+
end
|
184
|
+
END
|
185
|
+
end
|
186
|
+
|
187
|
+
it 'does nothing' do
|
188
|
+
rewritten_source.should == source
|
189
|
+
end
|
190
|
+
|
191
|
+
it 'reports nothing' do
|
192
|
+
record.should be_nil
|
193
|
+
end
|
194
|
+
end
|
195
|
+
|
196
|
+
context 'and the current value is different from the new value' do
|
197
|
+
let(:source) do
|
198
|
+
<<-END
|
199
|
+
RSpec.configure do |config|
|
200
|
+
config.expose_dsl_globally = true
|
201
|
+
end
|
202
|
+
END
|
203
|
+
end
|
204
|
+
|
205
|
+
let(:expected_source) do
|
206
|
+
<<-END
|
207
|
+
RSpec.configure do |config|
|
208
|
+
config.expose_dsl_globally = false
|
209
|
+
end
|
210
|
+
END
|
211
|
+
end
|
212
|
+
|
213
|
+
it 'rewrites the value' do
|
214
|
+
rewritten_source.should == expected_source
|
215
|
+
end
|
216
|
+
|
217
|
+
it 'adds record of modification ' \
|
218
|
+
'`RSpec.configure { |c| c.expose_dsl_globally = true }` -> ' \
|
219
|
+
'`RSpec.configure { |c| c.expose_dsl_globally = false }`' do
|
220
|
+
record.type.should == :modification
|
221
|
+
record.old_syntax.should == 'RSpec.configure { |c| c.expose_dsl_globally = true }'
|
222
|
+
record.new_syntax.should == 'RSpec.configure { |c| c.expose_dsl_globally = false }'
|
223
|
+
end
|
224
|
+
end
|
81
225
|
end
|
82
226
|
|
83
227
|
context 'when #expose_dsl_globally= does not exist' do
|
@@ -98,7 +242,7 @@ module Transpec
|
|
98
242
|
# For backwards compatibility this defaults to `true`.
|
99
243
|
#
|
100
244
|
# https://relishapp.com/rspec/rspec-core/v/3-0/docs/configuration/global-namespace-dsl
|
101
|
-
config.expose_dsl_globally =
|
245
|
+
config.expose_dsl_globally = false
|
102
246
|
end
|
103
247
|
END
|
104
248
|
end
|
@@ -106,9 +250,14 @@ module Transpec
|
|
106
250
|
it 'adds #expose_dsl_globally= statement along with comment' do
|
107
251
|
rewritten_source.should == expected_source
|
108
252
|
end
|
253
|
+
|
254
|
+
it 'adds record of addition `RSpec.configure { |c| c.expose_dsl_globally = value }`' do
|
255
|
+
record.type.should == :addition
|
256
|
+
record.new_syntax.should == 'RSpec.configure { |c| c.expose_dsl_globally = false }'
|
257
|
+
end
|
109
258
|
end
|
110
259
|
|
111
|
-
context 'when there are already some configurations' do
|
260
|
+
context 'when there are already some other configurations' do
|
112
261
|
let(:source) do
|
113
262
|
<<-END
|
114
263
|
RSpec.configure do |config|
|
@@ -129,7 +278,7 @@ module Transpec
|
|
129
278
|
# For backwards compatibility this defaults to `true`.
|
130
279
|
#
|
131
280
|
# https://relishapp.com/rspec/rspec-core/v/3-0/docs/configuration/global-namespace-dsl
|
132
|
-
config.expose_dsl_globally =
|
281
|
+
config.expose_dsl_globally = false
|
133
282
|
end
|
134
283
|
END
|
135
284
|
end
|
@@ -173,6 +322,11 @@ module Transpec
|
|
173
322
|
it 'adds #infer_spec_type_from_file_location! statement along with comment' do
|
174
323
|
rewritten_source.should == expected_source
|
175
324
|
end
|
325
|
+
|
326
|
+
it 'adds record of addition `RSpec.configure { |c| c.expose_dsl_globally = value }`' do
|
327
|
+
record.type.should == :addition
|
328
|
+
record.new_syntax.should == 'RSpec.configure { |c| c.infer_spec_type_from_file_location! }'
|
329
|
+
end
|
176
330
|
end
|
177
331
|
|
178
332
|
context 'when #infer_spec_type_from_file_location! already exists' do
|
@@ -187,6 +341,10 @@ module Transpec
|
|
187
341
|
it 'does nothing' do
|
188
342
|
rewritten_source.should == source
|
189
343
|
end
|
344
|
+
|
345
|
+
it 'reports nothing' do
|
346
|
+
record.should be_nil
|
347
|
+
end
|
190
348
|
end
|
191
349
|
|
192
350
|
context 'with runtime information' do
|
@@ -509,6 +667,16 @@ module Transpec
|
|
509
667
|
it 'rewrites the setter argument to `true`' do
|
510
668
|
rewritten_source.should == expected_source
|
511
669
|
end
|
670
|
+
|
671
|
+
# rubocop:disable LineLength
|
672
|
+
it 'adds record of modification ' \
|
673
|
+
'`RSpec.configure { |c| c.mock_with :rspec { |m| m.yield_receiver_to_any_instance_implementation_blocks = foo } }` ->' \
|
674
|
+
'`RSpec.configure { |c| c.mock_with :rspec { |m| m.yield_receiver_to_any_instance_implementation_blocks = true } }`' do
|
675
|
+
record.type.should == :modification
|
676
|
+
record.old_syntax.should == 'RSpec.configure { |c| c.mock_with :rspec { |m| m.yield_receiver_to_any_instance_implementation_blocks = foo } }'
|
677
|
+
record.new_syntax.should == 'RSpec.configure { |c| c.mock_with :rspec { |m| m.yield_receiver_to_any_instance_implementation_blocks = true } }'
|
678
|
+
end
|
679
|
+
# rubocop:enable LineLength
|
512
680
|
end
|
513
681
|
|
514
682
|
context 'when false is passed' do
|
@@ -562,6 +730,14 @@ module Transpec
|
|
562
730
|
it 'adds #yield_receiver_to_any_instance_implementation_blocks= statement along with comment' do
|
563
731
|
rewritten_source.should == expected_source
|
564
732
|
end
|
733
|
+
|
734
|
+
# rubocop:disable LineLength
|
735
|
+
it 'adds record of addition ' \
|
736
|
+
'`RSpec.configure { |c| c.mock_with :rspec { |m| m.yield_receiver_to_any_instance_implementation_blocks = true } }`' do
|
737
|
+
record.type.should == :addition
|
738
|
+
record.new_syntax.should == 'RSpec.configure { |c| c.mock_with :rspec { |m| m.yield_receiver_to_any_instance_implementation_blocks = true } }'
|
739
|
+
end
|
740
|
+
# rubocop:enable LineLength
|
565
741
|
end
|
566
742
|
|
567
743
|
context 'when #mock_with block does not exist' do
|
@@ -596,6 +772,14 @@ module Transpec
|
|
596
772
|
rewritten_source.should == expected_source
|
597
773
|
end
|
598
774
|
|
775
|
+
# rubocop:disable LineLength
|
776
|
+
it 'adds record of addition ' \
|
777
|
+
'`RSpec.configure { |c| c.mock_with :rspec { |m| m.yield_receiver_to_any_instance_implementation_blocks = true } }`' do
|
778
|
+
record.type.should == :addition
|
779
|
+
record.new_syntax.should == 'RSpec.configure { |c| c.mock_with :rspec { |m| m.yield_receiver_to_any_instance_implementation_blocks = true } }'
|
780
|
+
end
|
781
|
+
# rubocop:enable LineLength
|
782
|
+
|
599
783
|
context "when RSpec.configure's block argument name is `mocks`" do
|
600
784
|
let(:source) do
|
601
785
|
<<-END
|
@@ -40,8 +40,8 @@ module Transpec
|
|
40
40
|
|
41
41
|
it 'adds record `obj.should_receive(:message)` -> `expect(obj).to receive(:message)`' do
|
42
42
|
should_receive_object.expectize!
|
43
|
-
record.
|
44
|
-
record.
|
43
|
+
record.old_syntax.should == 'obj.should_receive(:message)'
|
44
|
+
record.new_syntax.should == 'expect(obj).to receive(:message)'
|
45
45
|
end
|
46
46
|
|
47
47
|
context 'when the statement continues over multi lines' do
|
@@ -181,8 +181,8 @@ module Transpec
|
|
181
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
|
-
record.
|
185
|
-
record.
|
184
|
+
record.old_syntax.should == 'obj.should_not_receive(:message)'
|
185
|
+
record.new_syntax.should == 'expect(obj).not_to receive(:message)'
|
186
186
|
end
|
187
187
|
|
188
188
|
context 'and "to_not" is passed as negative form' do
|
@@ -204,8 +204,8 @@ module Transpec
|
|
204
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
|
-
record.
|
208
|
-
record.
|
207
|
+
record.old_syntax.should == 'obj.should_not_receive(:message)'
|
208
|
+
record.new_syntax.should == 'expect(obj).to_not receive(:message)'
|
209
209
|
end
|
210
210
|
end
|
211
211
|
end
|
@@ -429,8 +429,8 @@ module Transpec
|
|
429
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
|
-
record.
|
433
|
-
record.
|
432
|
+
record.old_syntax.should == 'Klass.any_instance.should_receive(:message)'
|
433
|
+
record.new_syntax.should == 'expect_any_instance_of(Klass).to receive(:message)'
|
434
434
|
end
|
435
435
|
|
436
436
|
context 'when the statement continues over multi lines' do
|
@@ -503,8 +503,8 @@ module Transpec
|
|
503
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
|
-
record.
|
507
|
-
record.
|
506
|
+
record.old_syntax.should == 'Klass.any_instance.should_receive(:message)'
|
507
|
+
record.new_syntax.should == 'expect_any_instance_of(Klass).to receive(:message)'
|
508
508
|
end
|
509
509
|
end
|
510
510
|
|
@@ -541,8 +541,8 @@ module Transpec
|
|
541
541
|
it 'adds record `Klass.any_instance.should_receive(:message)` ' \
|
542
542
|
'-> `expect_any_instance_of(Klass).to receive(:message)`' do
|
543
543
|
should_receive_object.expectize!
|
544
|
-
record.
|
545
|
-
record.
|
544
|
+
record.old_syntax.should == 'Klass.any_instance.should_receive(:message)'
|
545
|
+
record.new_syntax.should == 'expect_any_instance_of(Klass).to receive(:message)'
|
546
546
|
end
|
547
547
|
end
|
548
548
|
|
@@ -583,8 +583,8 @@ module Transpec
|
|
583
583
|
it 'adds record `Klass.any_instance.should_receive(:message)` ' \
|
584
584
|
'-> `expect_any_instance_of(Klass).to receive(:message)`' do
|
585
585
|
should_receive_object.expectize!
|
586
|
-
record.
|
587
|
-
record.
|
586
|
+
record.old_syntax.should == 'Klass.any_instance.should_receive(:message)'
|
587
|
+
record.new_syntax.should == 'expect_any_instance_of(Klass).to receive(:message)'
|
588
588
|
end
|
589
589
|
end
|
590
590
|
end
|
@@ -694,8 +694,8 @@ module Transpec
|
|
694
694
|
it 'adds record ' \
|
695
695
|
'`obj.should_receive(:message).any_number_of_times` -> `allow(obj).to receive(:message)`' do
|
696
696
|
should_receive_object.allowize_useless_expectation!
|
697
|
-
record.
|
698
|
-
record.
|
697
|
+
record.old_syntax.should == 'obj.should_receive(:message).any_number_of_times'
|
698
|
+
record.new_syntax.should == 'allow(obj).to receive(:message)'
|
699
699
|
end
|
700
700
|
|
701
701
|
context 'and #allow and #receive are not available in the context' do
|
@@ -796,8 +796,8 @@ module Transpec
|
|
796
796
|
it 'adds record `Klass.any_instance.should_receive(:message).any_number_of_times` ' \
|
797
797
|
'-> `allow_any_instance_of(Klass).to receive(:message)`' do
|
798
798
|
should_receive_object.allowize_useless_expectation!
|
799
|
-
record.
|
800
|
-
record.
|
799
|
+
record.old_syntax.should == 'Klass.any_instance.should_receive(:message).any_number_of_times'
|
800
|
+
record.new_syntax.should == 'allow_any_instance_of(Klass).to receive(:message)'
|
801
801
|
end
|
802
802
|
end
|
803
803
|
|
@@ -830,8 +830,8 @@ module Transpec
|
|
830
830
|
it 'adds record `Klass.any_instance.should_receive(:message).any_number_of_times` ' \
|
831
831
|
'-> `allow_any_instance_of(Klass).to receive(:message)`' do
|
832
832
|
should_receive_object.allowize_useless_expectation!
|
833
|
-
record.
|
834
|
-
record.
|
833
|
+
record.old_syntax.should == 'Klass.any_instance.should_receive(:message).any_number_of_times'
|
834
|
+
record.new_syntax.should == 'allow_any_instance_of(Klass).to receive(:message)'
|
835
835
|
end
|
836
836
|
end
|
837
837
|
|
@@ -864,8 +864,8 @@ module Transpec
|
|
864
864
|
it 'adds record ' \
|
865
865
|
'`obj.should_receive(:message).at_least(0)` -> `allow(obj).to receive(:message)`' do
|
866
866
|
should_receive_object.allowize_useless_expectation!
|
867
|
-
record.
|
868
|
-
record.
|
867
|
+
record.old_syntax.should == 'obj.should_receive(:message).at_least(0)'
|
868
|
+
record.new_syntax.should == 'allow(obj).to receive(:message)'
|
869
869
|
end
|
870
870
|
end
|
871
871
|
|
@@ -898,8 +898,8 @@ module Transpec
|
|
898
898
|
it 'adds record `Klass.any_instance.should_receive(:message).at_least(0)` ' \
|
899
899
|
'-> `allow_any_instance_of(Klass).to receive(:message)`' do
|
900
900
|
should_receive_object.allowize_useless_expectation!
|
901
|
-
record.
|
902
|
-
record.
|
901
|
+
record.old_syntax.should == 'Klass.any_instance.should_receive(:message).at_least(0)'
|
902
|
+
record.new_syntax.should == 'allow_any_instance_of(Klass).to receive(:message)'
|
903
903
|
end
|
904
904
|
end
|
905
905
|
|
@@ -953,8 +953,8 @@ module Transpec
|
|
953
953
|
|
954
954
|
it 'adds record ' \
|
955
955
|
'`obj.should_receive(:message).any_number_of_times` -> `obj.stub(:message)`' do
|
956
|
-
record.
|
957
|
-
record.
|
956
|
+
record.old_syntax.should == 'obj.should_receive(:message).any_number_of_times'
|
957
|
+
record.new_syntax.should == 'obj.stub(:message)'
|
958
958
|
end
|
959
959
|
end
|
960
960
|
|
@@ -1007,8 +1007,8 @@ module Transpec
|
|
1007
1007
|
|
1008
1008
|
it 'adds record ' \
|
1009
1009
|
'`obj.should_receive(:message).and_return { value }` -> `obj.should_receive(:message) { value }`' do
|
1010
|
-
record.
|
1011
|
-
record.
|
1010
|
+
record.old_syntax.should == 'obj.should_receive(:message).and_return { value }'
|
1011
|
+
record.new_syntax.should == 'obj.should_receive(:message) { value }'
|
1012
1012
|
end
|
1013
1013
|
end
|
1014
1014
|
end
|
@@ -1047,8 +1047,8 @@ module Transpec
|
|
1047
1047
|
|
1048
1048
|
it 'adds record `Klass.any_instance.should_receive(:message) { |arg| }` ' \
|
1049
1049
|
'-> `Klass.any_instance.should_receive(:message) { |instance, arg| }`' do
|
1050
|
-
record.
|
1051
|
-
record.
|
1050
|
+
record.old_syntax.should == 'Klass.any_instance.should_receive(:message) { |arg| }'
|
1051
|
+
record.new_syntax.should == 'Klass.any_instance.should_receive(:message) { |instance, arg| }'
|
1052
1052
|
end
|
1053
1053
|
end
|
1054
1054
|
|
@@ -182,8 +182,8 @@ module Transpec
|
|
182
182
|
|
183
183
|
it 'adds record `obj.should` -> `expect(obj).to`' do
|
184
184
|
should_object.expectize!
|
185
|
-
record.
|
186
|
-
record.
|
185
|
+
record.old_syntax.should == 'obj.should'
|
186
|
+
record.new_syntax.should == 'expect(obj).to'
|
187
187
|
end
|
188
188
|
|
189
189
|
context 'and #expect is available in the context by including RSpec::Matchers' do
|
@@ -313,8 +313,8 @@ module Transpec
|
|
313
313
|
|
314
314
|
it 'adds record `obj.should_not` -> `expect(obj).not_to`' do
|
315
315
|
should_object.expectize!
|
316
|
-
record.
|
317
|
-
record.
|
316
|
+
record.old_syntax.should == 'obj.should_not'
|
317
|
+
record.new_syntax.should == 'expect(obj).not_to'
|
318
318
|
end
|
319
319
|
|
320
320
|
context 'and "to_not" is passed as negative form' do
|
@@ -335,8 +335,8 @@ module Transpec
|
|
335
335
|
|
336
336
|
it 'adds record `obj.should_not` -> `expect(obj).to_not`' do
|
337
337
|
should_object.expectize!('to_not')
|
338
|
-
record.
|
339
|
-
record.
|
338
|
+
record.old_syntax.should == 'obj.should_not'
|
339
|
+
record.new_syntax.should == 'expect(obj).to_not'
|
340
340
|
end
|
341
341
|
end
|
342
342
|
end
|
@@ -430,8 +430,8 @@ module Transpec
|
|
430
430
|
|
431
431
|
it "adds record `#{method} { }.should` -> `expect { }.to`" do
|
432
432
|
should_object.expectize!
|
433
|
-
record.
|
434
|
-
record.
|
433
|
+
record.old_syntax.should == "#{method} { }.should"
|
434
|
+
record.new_syntax.should == 'expect { }.to'
|
435
435
|
end
|
436
436
|
end
|
437
437
|
end
|
@@ -1,6 +1,6 @@
|
|
1
|
-
Convert specs to RSpec 3.0.
|
1
|
+
Convert specs to RSpec 3.0.1 syntax with Transpec
|
2
2
|
|
3
|
-
This conversion is done by Transpec 2.2.
|
3
|
+
This conversion is done by Transpec 2.2.5 with the following command:
|
4
4
|
transpec --force --convert example_group,hook_scope
|
5
5
|
|
6
6
|
* 82 conversions
|
@@ -27,4 +27,7 @@ This conversion is done by Transpec 2.2.0 with the following command:
|
|
27
27
|
from: obj.stub(:message => value)
|
28
28
|
to: allow(obj).to receive_messages(:message => value)
|
29
29
|
|
30
|
+
* 1 addition
|
31
|
+
of: RSpec.configure { |c| c.expose_dsl_globally = false }
|
32
|
+
|
30
33
|
For more details: https://github.com/yujinakayama/transpec#supported-conversions
|
@@ -1,6 +1,6 @@
|
|
1
|
-
Convert specs to RSpec 3.0.
|
1
|
+
Convert specs to RSpec 3.0.1 syntax with Transpec
|
2
2
|
|
3
|
-
This conversion is done by Transpec 2.2.
|
3
|
+
This conversion is done by Transpec 2.2.5 with the following command:
|
4
4
|
transpec --force --convert example_group,hook_scope
|
5
5
|
|
6
6
|
* 54 conversions
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: transpec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yuji Nakayama
|
@@ -288,7 +288,7 @@ files:
|
|
288
288
|
- lib/transpec/syntax/expect.rb
|
289
289
|
- lib/transpec/syntax/have.rb
|
290
290
|
- lib/transpec/syntax/have/dynamic_analysis.rb
|
291
|
-
- lib/transpec/syntax/have/
|
291
|
+
- lib/transpec/syntax/have/record_builder.rb
|
292
292
|
- lib/transpec/syntax/have/source_builder.rb
|
293
293
|
- lib/transpec/syntax/hook.rb
|
294
294
|
- lib/transpec/syntax/its.rb
|