transpec 1.12.0 → 1.13.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 +103 -99
- data/README.md +52 -8
- data/README.md.erb +240 -95
- data/Rakefile +3 -1
- data/lib/transpec/base_rewriter.rb +1 -1
- data/lib/transpec/cli.rb +2 -1
- data/lib/transpec/converter.rb +9 -65
- data/lib/transpec/spec_suite.rb +3 -36
- data/lib/transpec/syntax.rb +61 -4
- data/lib/transpec/util.rb +0 -6
- data/lib/transpec/version.rb +1 -1
- data/spec/transpec/cli_spec.rb +6 -11
- data/spec/transpec/converter_spec.rb +0 -173
- data/spec/transpec/dynamic_analyzer_spec.rb +1 -1
- data/spec/transpec/record_spec.rb +15 -0
- data/spec/transpec_spec.rb +8 -0
- data/tasks/lib/test.rb +1 -0
- data/tasks/readme.rake +115 -46
- data/tasks/test.rake +2 -6
- metadata +3 -2
data/Rakefile
CHANGED
data/lib/transpec/cli.rb
CHANGED
@@ -85,7 +85,8 @@ module Transpec
|
|
85
85
|
def fail_if_should_not_continue!
|
86
86
|
unless configuration.forced?
|
87
87
|
if Git.command_available? && Git.inside_of_repository? && !Git.clean?
|
88
|
-
fail 'The current Git repository is not clean. Aborting.'
|
88
|
+
fail 'The current Git repository is not clean. Aborting. ' \
|
89
|
+
'If you want to proceed forcibly, use -f/--force option.'
|
89
90
|
end
|
90
91
|
end
|
91
92
|
|
data/lib/transpec/converter.rb
CHANGED
@@ -11,6 +11,8 @@ Transpec::Syntax.require_all
|
|
11
11
|
|
12
12
|
module Transpec
|
13
13
|
class Converter < BaseRewriter # rubocop:disable ClassLength
|
14
|
+
include Syntax::Dispatcher
|
15
|
+
|
14
16
|
attr_reader :spec_suite, :configuration, :rspec_version, :report
|
15
17
|
|
16
18
|
alias_method :convert_file!, :rewrite_file!
|
@@ -30,30 +32,14 @@ module Transpec
|
|
30
32
|
|
31
33
|
def process(ast, source_rewriter)
|
32
34
|
return unless ast
|
33
|
-
ast.each_node do |node|
|
34
|
-
dispatch_node(node, source_rewriter)
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
def dispatch_node(node, source_rewriter)
|
39
|
-
Syntax.standalone_syntaxes.each do |syntax_class|
|
40
|
-
syntax = syntax_class.new(node, source_rewriter, runtime_data, report)
|
41
|
-
next unless syntax.conversion_target?
|
42
|
-
dispatch_syntax(syntax)
|
43
|
-
break
|
44
|
-
end
|
45
|
-
rescue OverlappedRewriteError # rubocop:disable HandleExceptions
|
46
|
-
rescue ConversionError => error
|
47
|
-
report.conversion_errors << error
|
48
|
-
end
|
49
35
|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
36
|
+
ast.each_node do |node|
|
37
|
+
begin
|
38
|
+
dispatch_node(node, source_rewriter, runtime_data, report)
|
39
|
+
rescue OverlappedRewriteError # rubocop:disable HandleExceptions
|
40
|
+
rescue ConversionError => error
|
41
|
+
report.conversion_errors << error
|
42
|
+
end
|
57
43
|
end
|
58
44
|
end
|
59
45
|
|
@@ -78,12 +64,6 @@ module Transpec
|
|
78
64
|
end
|
79
65
|
end
|
80
66
|
|
81
|
-
def process_expect(expect)
|
82
|
-
end
|
83
|
-
|
84
|
-
def process_allow(allow)
|
85
|
-
end
|
86
|
-
|
87
67
|
def process_should_receive(should_receive)
|
88
68
|
if should_receive.useless_expectation?
|
89
69
|
if configuration.convert_deprecated_method?
|
@@ -98,8 +78,6 @@ module Transpec
|
|
98
78
|
elsif configuration.convert_should_receive?
|
99
79
|
should_receive.expectize!(configuration.negative_form_of_to)
|
100
80
|
end
|
101
|
-
|
102
|
-
process_messaging_host(should_receive)
|
103
81
|
end
|
104
82
|
|
105
83
|
def process_double(double)
|
@@ -120,8 +98,6 @@ module Transpec
|
|
120
98
|
end
|
121
99
|
|
122
100
|
method_stub.remove_no_message_allowance! if configuration.convert_deprecated_method?
|
123
|
-
|
124
|
-
process_messaging_host(method_stub)
|
125
101
|
end
|
126
102
|
|
127
103
|
def process_operator(operator)
|
@@ -131,10 +107,6 @@ module Transpec
|
|
131
107
|
operator.convert_operator!(configuration.parenthesize_matcher_arg?)
|
132
108
|
end
|
133
109
|
|
134
|
-
def process_receive(receive)
|
135
|
-
process_messaging_host(receive)
|
136
|
-
end
|
137
|
-
|
138
110
|
def process_be_boolean(be_boolean)
|
139
111
|
return unless rspec_version.be_truthy_available?
|
140
112
|
return unless configuration.convert_deprecated_method?
|
@@ -190,14 +162,6 @@ module Transpec
|
|
190
162
|
def process_rspec_configure(rspec_configure)
|
191
163
|
return unless spec_suite.main_rspec_configure_node?(rspec_configure.node)
|
192
164
|
|
193
|
-
if need_to_modify_expectation_syntax_configuration?(rspec_configure)
|
194
|
-
rspec_configure.expectations.syntaxes = :expect
|
195
|
-
end
|
196
|
-
|
197
|
-
if need_to_modify_mock_syntax_configuration?(rspec_configure)
|
198
|
-
rspec_configure.mocks.syntaxes = :expect
|
199
|
-
end
|
200
|
-
|
201
165
|
if rspec_version.non_monkey_patch_example_group_available? &&
|
202
166
|
configuration.convert_example_group?
|
203
167
|
rspec_configure.expose_dsl_globally = false
|
@@ -219,11 +183,6 @@ module Transpec
|
|
219
183
|
hook.convert_scope_name!
|
220
184
|
end
|
221
185
|
|
222
|
-
def process_messaging_host(messaging_host)
|
223
|
-
process_useless_and_return(messaging_host)
|
224
|
-
process_any_instance_block(messaging_host)
|
225
|
-
end
|
226
|
-
|
227
186
|
def process_useless_and_return(messaging_host)
|
228
187
|
return unless messaging_host
|
229
188
|
return unless configuration.convert_deprecated_method?
|
@@ -242,20 +201,5 @@ module Transpec
|
|
242
201
|
rspec_version.rspec_2_99? && configuration.convert_deprecated_method? &&
|
243
202
|
spec_suite.need_to_modify_yield_receiver_to_any_instance_implementation_blocks_config?
|
244
203
|
end
|
245
|
-
|
246
|
-
def need_to_modify_expectation_syntax_configuration?(rspec_configure)
|
247
|
-
return false unless configuration.convert_should?
|
248
|
-
rspec_configure.expectations.syntaxes == [:should]
|
249
|
-
rescue Syntax::RSpecConfigure::Framework::UnknownSyntaxError
|
250
|
-
false
|
251
|
-
end
|
252
|
-
|
253
|
-
def need_to_modify_mock_syntax_configuration?(rspec_configure)
|
254
|
-
return false if !configuration.convert_should_receive? &&
|
255
|
-
!configuration.convert_stub?
|
256
|
-
rspec_configure.mocks.syntaxes == [:should]
|
257
|
-
rescue Syntax::RSpecConfigure::Framework::UnknownSyntaxError
|
258
|
-
false
|
259
|
-
end
|
260
204
|
end
|
261
205
|
end
|
data/lib/transpec/spec_suite.rb
CHANGED
@@ -8,6 +8,8 @@ Transpec::Syntax.require_all
|
|
8
8
|
|
9
9
|
module Transpec
|
10
10
|
class SpecSuite
|
11
|
+
include Syntax::Dispatcher
|
12
|
+
|
11
13
|
ANALYSIS_TARGET_CLASSES = [Syntax::Mixin::AnyInstanceBlock]
|
12
14
|
|
13
15
|
attr_reader :runtime_data
|
@@ -32,7 +34,7 @@ module Transpec
|
|
32
34
|
specs.each do |spec|
|
33
35
|
next unless spec.ast
|
34
36
|
spec.ast.each_node do |node|
|
35
|
-
dispatch_node(node)
|
37
|
+
dispatch_node(node, nil, runtime_data)
|
36
38
|
end
|
37
39
|
end
|
38
40
|
|
@@ -56,41 +58,6 @@ module Transpec
|
|
56
58
|
|
57
59
|
private
|
58
60
|
|
59
|
-
def dispatch_node(node)
|
60
|
-
Syntax.standalone_syntaxes.each do |syntax_class|
|
61
|
-
syntax = syntax_class.new(node, nil, runtime_data)
|
62
|
-
next unless syntax.conversion_target?
|
63
|
-
dispatch_syntax(syntax)
|
64
|
-
break
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
|
-
def dispatch_syntax(syntax)
|
69
|
-
invoke_handler(syntax.class, syntax)
|
70
|
-
|
71
|
-
syntax_mixins.each do |mixin|
|
72
|
-
next unless syntax.class.ancestors.include?(mixin)
|
73
|
-
invoke_handler(mixin, syntax)
|
74
|
-
end
|
75
|
-
|
76
|
-
syntax.dependent_syntaxes.each do |dependent_syntax|
|
77
|
-
next unless dependent_syntax.conversion_target?
|
78
|
-
dispatch_syntax(dependent_syntax)
|
79
|
-
end
|
80
|
-
end
|
81
|
-
|
82
|
-
def syntax_mixins
|
83
|
-
Syntax::Mixin.constants.map do |const_name|
|
84
|
-
Syntax::Mixin.const_get(const_name, false)
|
85
|
-
end
|
86
|
-
end
|
87
|
-
|
88
|
-
def invoke_handler(klass, syntax)
|
89
|
-
class_name = klass.name.split('::').last.gsub(/([a-z])([A-Z])/, '\1_\2').downcase
|
90
|
-
handler_name = "process_#{class_name}"
|
91
|
-
send(handler_name, syntax) if respond_to?(handler_name, true)
|
92
|
-
end
|
93
|
-
|
94
61
|
def process_any_instance_block(syntax)
|
95
62
|
@need_to_modify_yield_receiver_to_any_instance_implementation_blocks_config ||=
|
96
63
|
syntax.need_to_add_receiver_arg_to_any_instance_implementation_block?
|
data/lib/transpec/syntax.rb
CHANGED
@@ -28,6 +28,66 @@ module Transpec
|
|
28
28
|
def standalone_syntaxes
|
29
29
|
@standalone_syntaxes ||= all_syntaxes.select(&:standalone?)
|
30
30
|
end
|
31
|
+
|
32
|
+
def mixins
|
33
|
+
@mixins ||= Mixin.constants.map do |const_name|
|
34
|
+
Mixin.const_get(const_name, false)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
module Transpec
|
42
|
+
class Syntax
|
43
|
+
module ModuleUtil
|
44
|
+
module_function
|
45
|
+
|
46
|
+
def snake_case_name(module_name)
|
47
|
+
module_name.split('::').last.gsub(/([a-z])([A-Z])/, '\1_\2').downcase
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
module Transpec
|
54
|
+
class Syntax
|
55
|
+
module Dispatcher
|
56
|
+
def dispatch_node(node, source_rewriter = nil, runtime_data = nil, report = nil)
|
57
|
+
Syntax.standalone_syntaxes.find do |syntax_class|
|
58
|
+
syntax = syntax_class.new(node, source_rewriter, runtime_data, report)
|
59
|
+
dispatch_syntax(syntax)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
def dispatch_syntax(syntax)
|
64
|
+
return false unless syntax.conversion_target?
|
65
|
+
|
66
|
+
invoke_handler(syntax.class, syntax)
|
67
|
+
|
68
|
+
included_mixins = syntax.class.included_modules & Syntax.mixins
|
69
|
+
included_mixins.each do |mixin|
|
70
|
+
invoke_handler(mixin, syntax)
|
71
|
+
end
|
72
|
+
|
73
|
+
syntax.dependent_syntaxes.each do |dependent_syntax|
|
74
|
+
dispatch_syntax(dependent_syntax)
|
75
|
+
end
|
76
|
+
|
77
|
+
true
|
78
|
+
end
|
79
|
+
|
80
|
+
def invoke_handler(klass, syntax)
|
81
|
+
handler_name = handler_names[klass]
|
82
|
+
send(handler_name, syntax) if respond_to?(handler_name, true)
|
83
|
+
end
|
84
|
+
|
85
|
+
def handler_names
|
86
|
+
@handler_names_cache ||= Hash.new do |hash, klass|
|
87
|
+
class_name = ModuleUtil.snake_case_name(klass.name)
|
88
|
+
hash[klass] = "process_#{class_name}"
|
89
|
+
end
|
90
|
+
end
|
31
91
|
end
|
32
92
|
end
|
33
93
|
end
|
@@ -92,10 +152,7 @@ module Transpec
|
|
92
152
|
end
|
93
153
|
|
94
154
|
def self.snake_case_name
|
95
|
-
@snake_cake_name ||=
|
96
|
-
class_name = name.split('::').last
|
97
|
-
class_name.gsub(/([a-z])([A-Z])/, '\1_\2').downcase
|
98
|
-
end
|
155
|
+
@snake_cake_name ||= ModuleUtil.snake_case_name(name)
|
99
156
|
end
|
100
157
|
|
101
158
|
def initialize(node, source_rewriter = nil, runtime_data = nil, report = nil)
|
data/lib/transpec/util.rb
CHANGED
@@ -138,12 +138,6 @@ module Transpec
|
|
138
138
|
Parser::Source::Range.new(range.source_buffer, begin_pos, begin_pos)
|
139
139
|
end
|
140
140
|
|
141
|
-
def end_of_line_range(arg)
|
142
|
-
range = range_from_arg(arg)
|
143
|
-
begin_pos = beginning_of_line_range(range).begin_pos + range.source_line.size
|
144
|
-
Parser::Source::Range.new(range.source_buffer, begin_pos, begin_pos)
|
145
|
-
end
|
146
|
-
|
147
141
|
def line_range(arg)
|
148
142
|
range = range_from_arg(arg)
|
149
143
|
beginning_of_line_range(range).resize(range.source_line.size + 1)
|
data/lib/transpec/version.rb
CHANGED
data/spec/transpec/cli_spec.rb
CHANGED
@@ -90,9 +90,10 @@ module Transpec
|
|
90
90
|
include_examples 'aborts processing'
|
91
91
|
include_examples 'does not generate commit message'
|
92
92
|
|
93
|
-
it 'warns
|
94
|
-
cli.should_receive(:warn) do |
|
95
|
-
|
93
|
+
it 'warns and suggests the use of -f/--force option' do
|
94
|
+
cli.should_receive(:warn) do |message|
|
95
|
+
message.should include('clean')
|
96
|
+
message.should include('-f/--force')
|
96
97
|
end
|
97
98
|
|
98
99
|
cli.run(args)
|
@@ -140,10 +141,7 @@ module Transpec
|
|
140
141
|
include_examples 'aborts processing'
|
141
142
|
|
142
143
|
it 'warns to the user' do
|
143
|
-
cli.should_receive(:warn)
|
144
|
-
arg.should match(/rspec.+dependency/i)
|
145
|
-
end
|
146
|
-
|
144
|
+
cli.should_receive(:warn).with(/rspec.+dependency/i)
|
147
145
|
cli.run(args)
|
148
146
|
end
|
149
147
|
end
|
@@ -275,10 +273,7 @@ module Transpec
|
|
275
273
|
end
|
276
274
|
|
277
275
|
it 'warns to user' do
|
278
|
-
cli.should_receive(:warn)
|
279
|
-
message.should =~ /converted.+but.+incorrect/i
|
280
|
-
end
|
281
|
-
|
276
|
+
cli.should_receive(:warn).with(/converted.+but.+incorrect/i)
|
282
277
|
cli.convert_spec(processed_source, spec_suite)
|
283
278
|
end
|
284
279
|
end
|
@@ -475,16 +475,6 @@ module Transpec
|
|
475
475
|
end
|
476
476
|
end
|
477
477
|
end
|
478
|
-
|
479
|
-
it 'invokes #process_useless_and_return with the should_receive' do
|
480
|
-
converter.should_receive(:process_useless_and_return).with(should_receive_object)
|
481
|
-
converter.process_should_receive(should_receive_object)
|
482
|
-
end
|
483
|
-
|
484
|
-
it 'invokes #process_any_instance_block with the should_receive' do
|
485
|
-
converter.should_receive(:process_any_instance_block).with(should_receive_object)
|
486
|
-
converter.process_should_receive(should_receive_object)
|
487
|
-
end
|
488
478
|
end
|
489
479
|
|
490
480
|
describe '#process_method_stub' do
|
@@ -617,16 +607,6 @@ module Transpec
|
|
617
607
|
include_examples 'does not invoke MethodStub#remove_no_message_allowance!'
|
618
608
|
end
|
619
609
|
end
|
620
|
-
|
621
|
-
it 'invokes #process_useless_and_return with the method stub' do
|
622
|
-
converter.should_receive(:process_useless_and_return).with(method_stub_object)
|
623
|
-
converter.process_method_stub(method_stub_object)
|
624
|
-
end
|
625
|
-
|
626
|
-
it 'invokes #process_any_instance_block with the method stub' do
|
627
|
-
converter.should_receive(:process_any_instance_block).with(method_stub_object)
|
628
|
-
converter.process_method_stub(method_stub_object)
|
629
|
-
end
|
630
610
|
end
|
631
611
|
|
632
612
|
describe '#process_double' do
|
@@ -1125,50 +1105,6 @@ module Transpec
|
|
1125
1105
|
).as_null_object
|
1126
1106
|
end
|
1127
1107
|
|
1128
|
-
context 'when #need_to_modify_expectation_syntax_configuration? returns true' do
|
1129
|
-
before do
|
1130
|
-
converter.stub(:need_to_modify_expectation_syntax_configuration?).and_return(true)
|
1131
|
-
end
|
1132
|
-
|
1133
|
-
it 'invokes RSpecConfigure.expectations.syntaxes= with :expect' do
|
1134
|
-
rspec_configure.expectations.should_receive(:syntaxes=).with(:expect)
|
1135
|
-
converter.process_rspec_configure(rspec_configure)
|
1136
|
-
end
|
1137
|
-
end
|
1138
|
-
|
1139
|
-
context 'when #need_to_modify_expectation_syntax_configuration? returns false' do
|
1140
|
-
before do
|
1141
|
-
converter.stub(:need_to_modify_expectation_syntax_configuration?).and_return(false)
|
1142
|
-
end
|
1143
|
-
|
1144
|
-
it 'does not invoke RSpecConfigure.expectations.syntaxes=' do
|
1145
|
-
rspec_configure.expectations.should_not_receive(:syntaxes=)
|
1146
|
-
converter.process_rspec_configure(rspec_configure)
|
1147
|
-
end
|
1148
|
-
end
|
1149
|
-
|
1150
|
-
context 'when #need_to_modify_mock_syntax_configuration? returns true' do
|
1151
|
-
before do
|
1152
|
-
converter.stub(:need_to_modify_mock_syntax_configuration?).and_return(true)
|
1153
|
-
end
|
1154
|
-
|
1155
|
-
it 'invokes RSpecConfigure.mocks.syntaxes= with :expect' do
|
1156
|
-
rspec_configure.mocks.should_receive(:syntaxes=).with(:expect)
|
1157
|
-
converter.process_rspec_configure(rspec_configure)
|
1158
|
-
end
|
1159
|
-
end
|
1160
|
-
|
1161
|
-
context 'when #need_to_modify_mock_syntax_configuration? returns false' do
|
1162
|
-
before do
|
1163
|
-
converter.stub(:need_to_modify_mock_syntax_configuration?).and_return(false)
|
1164
|
-
end
|
1165
|
-
|
1166
|
-
it 'does not invoke RSpecConfigure.mocks.syntaxes=' do
|
1167
|
-
rspec_configure.mocks.should_not_receive(:syntaxes=)
|
1168
|
-
converter.process_rspec_configure(rspec_configure)
|
1169
|
-
end
|
1170
|
-
end
|
1171
|
-
|
1172
1108
|
context 'when RSpecVersion#rspec_2_99? returns true' do
|
1173
1109
|
before do
|
1174
1110
|
rspec_version.stub(:rspec_2_99?).and_return(true)
|
@@ -1376,114 +1312,5 @@ module Transpec
|
|
1376
1312
|
end
|
1377
1313
|
end
|
1378
1314
|
end
|
1379
|
-
|
1380
|
-
shared_examples 'syntaxes' do |framework_type, expectations|
|
1381
|
-
expectations.each do |current_syntaxes, return_value|
|
1382
|
-
context "and RSpecConfigure.#{framework_type}.syntaxes returns #{current_syntaxes.inspect}" do
|
1383
|
-
before do
|
1384
|
-
rspec_configure.stub_chain(framework_type, :syntaxes).and_return(current_syntaxes)
|
1385
|
-
end
|
1386
|
-
|
1387
|
-
it "returns #{return_value}" do
|
1388
|
-
should == return_value
|
1389
|
-
end
|
1390
|
-
end
|
1391
|
-
end
|
1392
|
-
|
1393
|
-
context "and RSpecConfigure.#{framework_type}.syntaxes raises UnknownSyntaxError" do
|
1394
|
-
before do
|
1395
|
-
rspec_configure.stub_chain(framework_type, :syntaxes)
|
1396
|
-
.and_raise(Syntax::RSpecConfigure::Framework::UnknownSyntaxError)
|
1397
|
-
end
|
1398
|
-
|
1399
|
-
it 'returns false' do
|
1400
|
-
should be_false
|
1401
|
-
end
|
1402
|
-
end
|
1403
|
-
end
|
1404
|
-
|
1405
|
-
describe '#need_to_modify_expectation_syntax_configuration?' do
|
1406
|
-
subject { converter.need_to_modify_expectation_syntax_configuration?(rspec_configure) }
|
1407
|
-
let(:rspec_configure) { double('rspec_configure') }
|
1408
|
-
|
1409
|
-
context 'when Configuration#convert_should? is true' do
|
1410
|
-
before { configuration.convert_should = true }
|
1411
|
-
|
1412
|
-
include_examples 'syntaxes', :expectations, {
|
1413
|
-
[] => false,
|
1414
|
-
[:should] => true,
|
1415
|
-
[:expect] => false,
|
1416
|
-
[:should, :expect] => false
|
1417
|
-
}
|
1418
|
-
end
|
1419
|
-
|
1420
|
-
context 'when Configuration#convert_should? is false' do
|
1421
|
-
before { configuration.convert_should = false }
|
1422
|
-
|
1423
|
-
include_examples 'syntaxes', :expectations, {
|
1424
|
-
[] => false,
|
1425
|
-
[:should] => false,
|
1426
|
-
[:expect] => false,
|
1427
|
-
[:should, :expect] => false
|
1428
|
-
}
|
1429
|
-
end
|
1430
|
-
end
|
1431
|
-
|
1432
|
-
describe '#need_to_modify_mock_syntax_configuration?' do
|
1433
|
-
subject { converter.need_to_modify_mock_syntax_configuration?(rspec_configure) }
|
1434
|
-
let(:rspec_configure) { double('rspec_configure') }
|
1435
|
-
|
1436
|
-
context 'when Configuration#convert_should_receive? is true' do
|
1437
|
-
before { configuration.convert_should_receive = true }
|
1438
|
-
|
1439
|
-
context 'and Configuration#convert_stub? is true' do
|
1440
|
-
before { configuration.convert_stub = true }
|
1441
|
-
|
1442
|
-
include_examples 'syntaxes', :mocks, {
|
1443
|
-
[] => false,
|
1444
|
-
[:should] => true,
|
1445
|
-
[:expect] => false,
|
1446
|
-
[:should, :expect] => false
|
1447
|
-
}
|
1448
|
-
end
|
1449
|
-
|
1450
|
-
context 'and Configuration#convert_stub? is false' do
|
1451
|
-
before { configuration.convert_stub = false }
|
1452
|
-
|
1453
|
-
include_examples 'syntaxes', :mocks, {
|
1454
|
-
[] => false,
|
1455
|
-
[:should] => true,
|
1456
|
-
[:expect] => false,
|
1457
|
-
[:should, :expect] => false
|
1458
|
-
}
|
1459
|
-
end
|
1460
|
-
end
|
1461
|
-
|
1462
|
-
context 'when Configuration#convert_should_receive? is false' do
|
1463
|
-
before { configuration.convert_should_receive = false }
|
1464
|
-
|
1465
|
-
context 'and Configuration#convert_stub? is true' do
|
1466
|
-
before { configuration.convert_stub = true }
|
1467
|
-
|
1468
|
-
include_examples 'syntaxes', :mocks, {
|
1469
|
-
[] => false,
|
1470
|
-
[:should] => true,
|
1471
|
-
[:expect] => false,
|
1472
|
-
[:should, :expect] => false
|
1473
|
-
}
|
1474
|
-
end
|
1475
|
-
|
1476
|
-
context 'and Configuration#convert_stub? is false' do
|
1477
|
-
before { configuration.convert_stub = false }
|
1478
|
-
|
1479
|
-
include_examples 'syntaxes', :mocks, {
|
1480
|
-
[] => false,
|
1481
|
-
[:should] => false,
|
1482
|
-
[:expect] => false,
|
1483
|
-
[:should, :expect] => false
|
1484
|
-
}
|
1485
|
-
end
|
1486
|
-
end
|
1487
|
-
end
|
1488
1315
|
end
|
1489
1316
|
end
|