transpec 1.10.3 → 1.10.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +4 -0
- data/CHANGELOG.md +5 -0
- data/Gemfile +2 -0
- data/README.md +11 -5
- data/README.md.erb +11 -5
- data/lib/transpec.rb +1 -19
- data/lib/transpec/base_rewriter.rb +1 -1
- data/lib/transpec/converter.rb +2 -3
- data/lib/transpec/dynamic_analyzer/rewriter.rb +2 -2
- data/lib/transpec/option_parser.rb +2 -2
- data/lib/transpec/parser.rb +9 -0
- data/lib/transpec/record.rb +45 -7
- data/lib/transpec/syntax.rb +15 -21
- data/lib/transpec/syntax/allow.rb +2 -2
- data/lib/transpec/syntax/be_boolean.rb +2 -2
- data/lib/transpec/syntax/be_close.rb +2 -2
- data/lib/transpec/syntax/current_example.rb +5 -6
- data/lib/transpec/syntax/double.rb +2 -2
- data/lib/transpec/syntax/example.rb +13 -14
- data/lib/transpec/syntax/expect.rb +2 -2
- data/lib/transpec/syntax/have.rb +5 -8
- data/lib/transpec/syntax/have/{dynamic_inspector.rb → dynamic_analysis.rb} +25 -47
- data/lib/transpec/syntax/have/have_record.rb +12 -16
- data/lib/transpec/syntax/its.rb +5 -5
- data/lib/transpec/syntax/matcher_definition.rb +2 -2
- data/lib/transpec/syntax/method_stub.rb +29 -28
- data/lib/transpec/syntax/mixin/any_instance_block.rb +2 -2
- data/lib/transpec/syntax/mixin/matcher_owner.rb +16 -13
- data/lib/transpec/syntax/mixin/monkey_patch.rb +2 -2
- data/lib/transpec/syntax/mixin/monkey_patch_any_instance.rb +1 -1
- data/lib/transpec/syntax/mixin/send.rb +42 -30
- data/lib/transpec/syntax/mixin/useless_and_return.rb +2 -4
- data/lib/transpec/syntax/oneliner_should.rb +17 -19
- data/lib/transpec/syntax/operator.rb +9 -14
- data/lib/transpec/syntax/pending.rb +27 -18
- data/lib/transpec/syntax/raise_error.rb +2 -2
- data/lib/transpec/syntax/receive.rb +2 -2
- data/lib/transpec/syntax/rspec_configure.rb +2 -2
- data/lib/transpec/syntax/should.rb +9 -9
- data/lib/transpec/syntax/should_receive.rb +18 -16
- data/lib/transpec/version.rb +1 -1
- data/spec/spec_helper.rb +7 -0
- data/spec/support/shared_context.rb +4 -4
- data/spec/transpec/cli_spec.rb +1 -1
- data/spec/transpec/converter_spec.rb +1 -1
- data/spec/transpec/dynamic_analyzer/rewriter_spec.rb +8 -8
- data/spec/transpec/syntax/current_example_spec.rb +75 -19
- data/spec/transpec/syntax/double_spec.rb +11 -11
- data/spec/transpec/syntax/example_spec.rb +8 -4
- data/spec/transpec/syntax/have_spec.rb +1 -1
- data/spec/transpec/syntax/method_stub_spec.rb +14 -20
- data/spec/transpec/syntax/oneliner_should_spec.rb +51 -0
- data/spec/transpec/syntax/pending_spec.rb +8 -4
- data/spec/transpec_spec.rb +4 -6
- data/tasks/demo.rake +2 -2
- data/tasks/lib/transpec_demo.rb +1 -1
- data/tasks/lib/transpec_test.rb +1 -1
- data/tasks/test.rake +2 -2
- metadata +4 -3
@@ -48,21 +48,19 @@ module Transpec
|
|
48
48
|
@host = host
|
49
49
|
end
|
50
50
|
|
51
|
-
def
|
51
|
+
def build_original_syntax
|
52
52
|
syntax = base_syntax
|
53
53
|
syntax << '.and_return'
|
54
54
|
syntax << ' { value }' if @host.and_return_with_block?
|
55
55
|
syntax
|
56
56
|
end
|
57
57
|
|
58
|
-
def
|
58
|
+
def build_converted_syntax
|
59
59
|
syntax = base_syntax
|
60
60
|
syntax << ' { value }' if @host.and_return_with_block?
|
61
61
|
syntax
|
62
62
|
end
|
63
63
|
|
64
|
-
private
|
65
|
-
|
66
64
|
def base_syntax
|
67
65
|
fail NotImplementedError
|
68
66
|
end
|
@@ -13,15 +13,15 @@ module Transpec
|
|
13
13
|
|
14
14
|
attr_reader :current_syntax_type
|
15
15
|
|
16
|
-
def self.target_method?(receiver_node, method_name)
|
17
|
-
receiver_node.nil? && [:should, :should_not].include?(method_name)
|
18
|
-
end
|
19
|
-
|
20
16
|
def initialize(node, source_rewriter = nil, runtime_data = nil, report = nil)
|
21
17
|
super
|
22
18
|
@current_syntax_type = :should
|
23
19
|
end
|
24
20
|
|
21
|
+
def dynamic_analysis_target?
|
22
|
+
super && receiver_node.nil? && [:should, :should_not].include?(method_name)
|
23
|
+
end
|
24
|
+
|
25
25
|
def expectize!(negative_form = 'not_to', parenthesize_matcher_arg = true)
|
26
26
|
replacement = 'is_expected.'
|
27
27
|
replacement << (positive? ? 'to' : negative_form)
|
@@ -169,23 +169,21 @@ module Transpec
|
|
169
169
|
@negative_form_of_to = negative_form_of_to
|
170
170
|
end
|
171
171
|
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
end
|
172
|
+
private
|
173
|
+
|
174
|
+
def build_original_syntax
|
175
|
+
syntax = should.example_has_description? ? "it '...' do" : 'it {'
|
176
|
+
syntax << " #{should.method_name} #{have.method_name}(n).#{original_items} "
|
177
|
+
syntax << (should.example_has_description? ? 'end' : '}')
|
178
178
|
end
|
179
179
|
|
180
|
-
def
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
syntax << ' end'
|
188
|
-
end
|
180
|
+
def build_converted_syntax
|
181
|
+
syntax = converted_description
|
182
|
+
syntax << ' '
|
183
|
+
syntax << converted_expectation
|
184
|
+
syntax << ' '
|
185
|
+
syntax << source_builder.replacement_matcher_source
|
186
|
+
syntax << ' end'
|
189
187
|
end
|
190
188
|
|
191
189
|
def converted_description
|
@@ -15,25 +15,16 @@ module Transpec
|
|
15
15
|
OPERATORS = [:==, :===, :<, :<=, :>, :>=, :=~].freeze
|
16
16
|
BE_NODE = s(:send, nil, :be)
|
17
17
|
|
18
|
-
|
19
|
-
false
|
20
|
-
end
|
21
|
-
|
22
|
-
def self.check_target_node_statically(node)
|
23
|
-
node = node.parent_node if node == BE_NODE
|
24
|
-
super(node)
|
25
|
-
end
|
26
|
-
|
27
|
-
def self.target_method?(receiver_node, method_name)
|
28
|
-
!receiver_node.nil? && OPERATORS.include?(method_name)
|
29
|
-
end
|
30
|
-
|
31
|
-
define_dynamic_analysis_request do |rewriter|
|
18
|
+
define_dynamic_analysis do |rewriter|
|
32
19
|
if method_name == :=~
|
33
20
|
rewriter.register_request(arg_node, :enumerable_arg?, 'is_a?(Enumerable)')
|
34
21
|
end
|
35
22
|
end
|
36
23
|
|
24
|
+
def self.standalone?
|
25
|
+
false
|
26
|
+
end
|
27
|
+
|
37
28
|
def initialize(node, expectation, source_rewriter = nil, runtime_data = nil, report = nil)
|
38
29
|
operator_node = if node == BE_NODE
|
39
30
|
node.parent_node
|
@@ -44,6 +35,10 @@ module Transpec
|
|
44
35
|
super(operator_node, expectation, source_rewriter, runtime_data, report)
|
45
36
|
end
|
46
37
|
|
38
|
+
def dynamic_analysis_target?
|
39
|
+
super && !receiver_node.nil? && OPERATORS.include?(method_name)
|
40
|
+
end
|
41
|
+
|
47
42
|
def convert_operator!(parenthesize_arg = true)
|
48
43
|
case method_name
|
49
44
|
when :==
|
@@ -9,31 +9,30 @@ module Transpec
|
|
9
9
|
class Pending < Syntax
|
10
10
|
include Mixin::Send, Util
|
11
11
|
|
12
|
-
|
13
|
-
|
12
|
+
define_dynamic_analysis do |rewriter|
|
13
|
+
code = 'is_a?(RSpec::Core::ExampleGroup)'
|
14
|
+
rewriter.register_request(node, :example_context?, code, :context)
|
15
|
+
end
|
16
|
+
|
17
|
+
def dynamic_analysis_target?
|
18
|
+
super && receiver_node.nil? && method_name == :pending
|
19
|
+
end
|
20
|
+
|
21
|
+
def conversion_target?
|
22
|
+
return false unless dynamic_analysis_target?
|
14
23
|
|
15
24
|
# Check whether the context is example group to differenciate
|
16
25
|
# RSpec::Core::ExampleGroup.pending (a relative of #it) and
|
17
26
|
# RSpec::Core::ExampleGroup#pending (marks the example as pending in #it block).
|
18
|
-
if runtime_data
|
27
|
+
if runtime_data.run?(node)
|
19
28
|
# If we have runtime data, check with it.
|
20
29
|
runtime_data[node, :example_context?]
|
21
30
|
else
|
22
31
|
# Otherwise check statically.
|
23
|
-
|
24
|
-
inspector.scopes.last == :example
|
32
|
+
static_context_inspector.scopes.last == :example
|
25
33
|
end
|
26
34
|
end
|
27
35
|
|
28
|
-
def self.target_method?(receiver_node, method_name)
|
29
|
-
receiver_node.nil? && method_name == :pending
|
30
|
-
end
|
31
|
-
|
32
|
-
define_dynamic_analysis_request do |rewriter|
|
33
|
-
code = 'is_a?(RSpec::Core::ExampleGroup)'
|
34
|
-
rewriter.register_request(node, :example_context?, code, :context)
|
35
|
-
end
|
36
|
-
|
37
36
|
def convert_deprecated_syntax!
|
38
37
|
if block_node
|
39
38
|
unblock!
|
@@ -51,16 +50,14 @@ module Transpec
|
|
51
50
|
|
52
51
|
def unblock!
|
53
52
|
if block_beginning_line == block_body_line
|
54
|
-
range_between_pending_and_body =
|
55
|
-
expression_range.end.join(block_body_node.loc.expression.begin)
|
56
53
|
replace(range_between_pending_and_body, "\n" + indentation_of_line(node))
|
57
54
|
else
|
58
|
-
remove(
|
55
|
+
remove(range_from_pending_end_to_block_open)
|
59
56
|
outdent!(block_body_node, node)
|
60
57
|
end
|
61
58
|
|
62
59
|
if block_body_line == block_end_line
|
63
|
-
remove(
|
60
|
+
remove(range_from_body_end_to_block_close)
|
64
61
|
else
|
65
62
|
remove(line_range(block_node.loc.end))
|
66
63
|
end
|
@@ -102,6 +99,18 @@ module Transpec
|
|
102
99
|
block_node.loc.end.line
|
103
100
|
end
|
104
101
|
|
102
|
+
def range_between_pending_and_body
|
103
|
+
expression_range.end.join(block_body_node.loc.expression.begin)
|
104
|
+
end
|
105
|
+
|
106
|
+
def range_from_pending_end_to_block_open
|
107
|
+
expression_range.end.join(block_node.loc.begin)
|
108
|
+
end
|
109
|
+
|
110
|
+
def range_from_body_end_to_block_close
|
111
|
+
block_body_node.loc.expression.end.join(block_node.loc.end)
|
112
|
+
end
|
113
|
+
|
105
114
|
def register_record(original_syntax, converted_syntax)
|
106
115
|
report.records << Record.new(original_syntax, converted_syntax)
|
107
116
|
end
|
@@ -9,8 +9,8 @@ module Transpec
|
|
9
9
|
class RaiseError < Syntax
|
10
10
|
include Mixin::Send, Mixin::OwnedMatcher
|
11
11
|
|
12
|
-
def
|
13
|
-
receiver_node.nil? && method_name == :raise_error
|
12
|
+
def dynamic_analysis_target?
|
13
|
+
super && receiver_node.nil? && method_name == :raise_error
|
14
14
|
end
|
15
15
|
|
16
16
|
def remove_error_specification_with_negative_expectation!
|
@@ -10,8 +10,8 @@ module Transpec
|
|
10
10
|
class Receive < Syntax
|
11
11
|
include Mixin::Send, Mixin::OwnedMatcher, Mixin::MessagingHost
|
12
12
|
|
13
|
-
def
|
14
|
-
receiver_node.nil? && method_name == :receive
|
13
|
+
def dynamic_analysis_target?
|
14
|
+
super && receiver_node.nil? && method_name == :receive
|
15
15
|
end
|
16
16
|
|
17
17
|
def remove_useless_and_return!
|
@@ -11,11 +11,11 @@ module Transpec
|
|
11
11
|
|
12
12
|
include Util
|
13
13
|
|
14
|
-
def
|
14
|
+
def dynamic_analysis_target?
|
15
15
|
return false unless node && node.block_type?
|
16
16
|
send_node = node.children.first
|
17
17
|
receiver_node, method_name, *_ = *send_node
|
18
|
-
|
18
|
+
const_name(receiver_node) == 'RSpec' && method_name == :configure
|
19
19
|
end
|
20
20
|
|
21
21
|
def expectations
|
@@ -13,8 +13,12 @@ module Transpec
|
|
13
13
|
|
14
14
|
attr_reader :current_syntax_type
|
15
15
|
|
16
|
-
|
17
|
-
|
16
|
+
define_dynamic_analysis do |rewriter|
|
17
|
+
register_syntax_availability_analysis_request(
|
18
|
+
rewriter,
|
19
|
+
:expect_available?,
|
20
|
+
[:expect]
|
21
|
+
)
|
18
22
|
end
|
19
23
|
|
20
24
|
def initialize(node, source_rewriter = nil, runtime_data = nil, report = nil)
|
@@ -22,16 +26,12 @@ module Transpec
|
|
22
26
|
@current_syntax_type = :should
|
23
27
|
end
|
24
28
|
|
25
|
-
|
26
|
-
|
27
|
-
rewriter,
|
28
|
-
:expect_available?,
|
29
|
-
[:expect]
|
30
|
-
)
|
29
|
+
def dynamic_analysis_target?
|
30
|
+
super && !receiver_node.nil? && [:should, :should_not].include?(method_name)
|
31
31
|
end
|
32
32
|
|
33
33
|
def expect_available?
|
34
|
-
|
34
|
+
syntax_available?(__method__)
|
35
35
|
end
|
36
36
|
|
37
37
|
def expectize!(negative_form = 'not_to', parenthesize_matcher_arg = true)
|
@@ -11,32 +11,34 @@ module Transpec
|
|
11
11
|
class ShouldReceive < Syntax
|
12
12
|
include Mixin::Expectizable, Mixin::MonkeyPatchAnyInstance, Mixin::MessagingHost, Util
|
13
13
|
|
14
|
-
|
15
|
-
|
16
|
-
def self.target_method?(receiver_node, method_name)
|
17
|
-
!receiver_node.nil? && [:should_receive, :should_not_receive].include?(method_name)
|
18
|
-
end
|
19
|
-
|
20
|
-
define_dynamic_analysis_request do |rewriter|
|
21
|
-
register_request_of_syntax_availability_inspection(
|
14
|
+
define_dynamic_analysis do |rewriter|
|
15
|
+
register_syntax_availability_analysis_request(
|
22
16
|
rewriter,
|
23
17
|
:expect_to_receive_available?,
|
24
18
|
[:expect, :receive]
|
25
19
|
)
|
26
20
|
|
27
|
-
|
21
|
+
register_syntax_availability_analysis_request(
|
28
22
|
rewriter,
|
29
23
|
:allow_to_receive_available?,
|
30
24
|
[:allow, :receive]
|
31
25
|
)
|
32
26
|
end
|
33
27
|
|
28
|
+
alias_method :useless_expectation?, :allow_no_message?
|
29
|
+
|
30
|
+
def dynamic_analysis_target?
|
31
|
+
super &&
|
32
|
+
!receiver_node.nil? &&
|
33
|
+
[:should_receive, :should_not_receive].include?(method_name)
|
34
|
+
end
|
35
|
+
|
34
36
|
def expect_to_receive_available?
|
35
|
-
|
37
|
+
syntax_available?(__method__)
|
36
38
|
end
|
37
39
|
|
38
40
|
def allow_to_receive_available?
|
39
|
-
|
41
|
+
syntax_available?(__method__)
|
40
42
|
end
|
41
43
|
|
42
44
|
def positive?
|
@@ -170,7 +172,7 @@ module Transpec
|
|
170
172
|
fail NotImplementedError
|
171
173
|
end
|
172
174
|
|
173
|
-
def
|
175
|
+
def build_original_syntax
|
174
176
|
syntax = if @should_receive.any_instance?
|
175
177
|
'Klass.any_instance.'
|
176
178
|
else
|
@@ -179,7 +181,7 @@ module Transpec
|
|
179
181
|
syntax << "#{@should_receive.method_name}(:message)"
|
180
182
|
end
|
181
183
|
|
182
|
-
def
|
184
|
+
def build_converted_syntax
|
183
185
|
syntax = if @should_receive.any_instance?
|
184
186
|
"#{syntax_name}_any_instance_of(Klass)."
|
185
187
|
else
|
@@ -201,7 +203,7 @@ module Transpec
|
|
201
203
|
'allow'
|
202
204
|
end
|
203
205
|
|
204
|
-
def
|
206
|
+
def build_original_syntax
|
205
207
|
syntax = super
|
206
208
|
syntax << '.any_number_of_times' if @should_receive.any_number_of_times?
|
207
209
|
syntax << '.at_least(0)' if @should_receive.at_least_zero?
|
@@ -214,14 +216,14 @@ module Transpec
|
|
214
216
|
@should_receive = should_receive
|
215
217
|
end
|
216
218
|
|
217
|
-
def
|
219
|
+
def build_original_syntax
|
218
220
|
syntax = "obj.#{@should_receive.method_name}(:message)"
|
219
221
|
syntax << '.any_number_of_times' if @should_receive.any_number_of_times?
|
220
222
|
syntax << '.at_least(0)' if @should_receive.at_least_zero?
|
221
223
|
syntax
|
222
224
|
end
|
223
225
|
|
224
|
-
def
|
226
|
+
def build_converted_syntax
|
225
227
|
'obj.stub(:message)'
|
226
228
|
end
|
227
229
|
end
|
data/lib/transpec/version.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
@@ -15,6 +15,13 @@ RSpec.configure do |config|
|
|
15
15
|
config.color_enabled = true
|
16
16
|
config.treat_symbols_as_metadata_keys_with_true_values = true
|
17
17
|
|
18
|
+
# These two settings work together to allow you to limit a spec run
|
19
|
+
# to individual examples or groups you care about by tagging them with
|
20
|
+
# `:focus` metadata. When nothing is tagged with `:focus`, all examples
|
21
|
+
# get run.
|
22
|
+
config.filter_run :focus
|
23
|
+
config.run_all_when_everything_filtered = true
|
24
|
+
|
18
25
|
config.before(:suite) do
|
19
26
|
require 'rainbow'
|
20
27
|
Rainbow.enabled = false
|
@@ -13,7 +13,7 @@ shared_context 'parsed objects' do
|
|
13
13
|
|
14
14
|
let(:ast) do
|
15
15
|
require 'transpec/ast/builder'
|
16
|
-
require 'parser
|
16
|
+
require 'transpec/parser'
|
17
17
|
builder = Transpec::AST::Builder.new
|
18
18
|
parser = Parser::CurrentRuby.new(builder)
|
19
19
|
parser.parse(source_buffer)
|
@@ -55,11 +55,11 @@ end
|
|
55
55
|
shared_context 'syntax object' do |syntax_class, name|
|
56
56
|
let(name) do
|
57
57
|
ast.each_node do |node|
|
58
|
-
|
59
|
-
return
|
58
|
+
syntax = syntax_class.new(node, source_rewriter, runtime_data)
|
59
|
+
return syntax if syntax.conversion_target?
|
60
60
|
end
|
61
61
|
|
62
|
-
fail "No #{syntax_class.name}
|
62
|
+
fail "No #{syntax_class.name} conversion target is found!"
|
63
63
|
end
|
64
64
|
end
|
65
65
|
|
data/spec/transpec/cli_spec.rb
CHANGED
@@ -6,7 +6,7 @@ require 'transpec/converter'
|
|
6
6
|
module Transpec
|
7
7
|
describe Converter do
|
8
8
|
subject(:converter) { Converter.new(configuration, rspec_version) }
|
9
|
-
let(:rspec_version) { Transpec.
|
9
|
+
let(:rspec_version) { Transpec.required_rspec_version }
|
10
10
|
let(:configuration) { Configuration.new }
|
11
11
|
|
12
12
|
describe '#convert_file!' do
|
@@ -21,8 +21,8 @@ module Transpec
|
|
21
21
|
|
22
22
|
# rubocop:disable LineLength
|
23
23
|
let(:expected_source) do
|
24
|
-
<<-END
|
25
|
-
transpec_analyze((transpec_analyze((subject), self, "(string)_12_19", { :should_source_location => [:object, "method(:should).source_location"] }).should be(foo)), self, "(string)_12_34", { :expect_available? => [:context, "self.class.ancestors.any? { |a| a.name.start_with?('RSpec::') } && respond_to?(:expect)"] })
|
24
|
+
<<-'END'
|
25
|
+
transpec_analyze((transpec_analyze((subject), self, "(string)_12_19", { :should_source_location => [:object, "method(:should).source_location"], :should_example_method_defined_by_user? => [:object, "owner = method(:should).owner\nowner != RSpec::Core::ExampleGroup &&\n owner.ancestors.include?(RSpec::Core::ExampleGroup)"] }).should be(foo)), self, "(string)_12_34", { :expect_available? => [:context, "self.class.ancestors.any? { |a| a.name.start_with?('RSpec::') } && respond_to?(:expect)"] })
|
26
26
|
END
|
27
27
|
end
|
28
28
|
# rubocop:enable LineLength
|
@@ -42,8 +42,8 @@ module Transpec
|
|
42
42
|
|
43
43
|
# rubocop:disable LineLength
|
44
44
|
let(:expected_source) do
|
45
|
-
<<-END
|
46
|
-
transpec_analyze((transpec_analyze((subject), self, "(string)_14_21", { :should_source_location => [:object, "method(:should).source_location"] }).should), self, "(string)_14_28", { :"=~_source_location" => [:object, "method(:=~).source_location"], :expect_available? => [:context, "self.class.ancestors.any? { |a| a.name.start_with?('RSpec::') } && respond_to?(:expect)"] }) =~ transpec_analyze((<<-HEREDOC.gsub('foo', 'bar')), self, "(string)_32_61", { :enumerable_arg? => [:object, "is_a?(Enumerable)"] })
|
45
|
+
<<-'END'
|
46
|
+
transpec_analyze((transpec_analyze((subject), self, "(string)_14_21", { :should_source_location => [:object, "method(:should).source_location"], :should_example_method_defined_by_user? => [:object, "owner = method(:should).owner\nowner != RSpec::Core::ExampleGroup &&\n owner.ancestors.include?(RSpec::Core::ExampleGroup)"] }).should), self, "(string)_14_28", { :"=~_source_location" => [:object, "method(:=~).source_location"], :"=~_example_method_defined_by_user?" => [:object, "owner = method(:=~).owner\nowner != RSpec::Core::ExampleGroup &&\n owner.ancestors.include?(RSpec::Core::ExampleGroup)"], :expect_available? => [:context, "self.class.ancestors.any? { |a| a.name.start_with?('RSpec::') } && respond_to?(:expect)"] }) =~ transpec_analyze((<<-HEREDOC.gsub('foo', 'bar')), self, "(string)_32_61", { :enumerable_arg? => [:object, "is_a?(Enumerable)"] })
|
47
47
|
foo
|
48
48
|
HEREDOC
|
49
49
|
END
|
@@ -64,8 +64,8 @@ module Transpec
|
|
64
64
|
|
65
65
|
# rubocop:disable LineLength
|
66
66
|
let(:expected_source) do
|
67
|
-
<<-END
|
68
|
-
transpec_analyze((expect { do_something }), self, "(string)_14_20", { :expect_source_location => [:context, "method(:expect).source_location"] }).to throw_symbol
|
67
|
+
<<-'END'
|
68
|
+
transpec_analyze((expect { do_something }), self, "(string)_14_20", { :expect_source_location => [:context, "method(:expect).source_location"], :expect_example_method_defined_by_user? => [:context, "owner = method(:expect).owner\nowner != RSpec::Core::ExampleGroup &&\n owner.ancestors.include?(RSpec::Core::ExampleGroup)"] }).to throw_symbol
|
69
69
|
END
|
70
70
|
end
|
71
71
|
# rubocop:enable LineLength
|
@@ -84,8 +84,8 @@ module Transpec
|
|
84
84
|
|
85
85
|
# rubocop:disable LineLength
|
86
86
|
let(:expected_source) do
|
87
|
-
<<-END
|
88
|
-
transpec_analyze((double 'something'), self, "(string)_14_32", { :double_source_location => [:context, "method(:double).source_location"] })
|
87
|
+
<<-'END'
|
88
|
+
transpec_analyze((double 'something'), self, "(string)_14_32", { :double_source_location => [:context, "method(:double).source_location"], :double_example_method_defined_by_user? => [:context, "owner = method(:double).owner\nowner != RSpec::Core::ExampleGroup &&\n owner.ancestors.include?(RSpec::Core::ExampleGroup)"] })
|
89
89
|
END
|
90
90
|
end
|
91
91
|
# rubocop:enable LineLength
|