transpec 1.10.3 → 1.10.4
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/.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
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 10bda7931ceab8672bcf49f68c925b59448543b4
|
4
|
+
data.tar.gz: acf1950a6c9b917d2af8fc16ea292c7ec91aa2b8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 02b7167fc857ccb4956f439dd793eeae452d2e71e0666be7c6419f571e6b4facb026cd5a649f41fb07b1bf87ac493177deed91e1ee51945442f191d097689c93
|
7
|
+
data.tar.gz: 1ce039438135ccbccdeecc92b73812650d86a811671a9d7e2ec67f1907912c04b59efe753f2394aa434911e25d6f9bde82c9614aa40d5da3376b5f5cab45087f
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,11 @@
|
|
2
2
|
|
3
3
|
## Development
|
4
4
|
|
5
|
+
## v1.10.4
|
6
|
+
|
7
|
+
* Avoid confusing methods defined with `#let` or `#subject` by user with RSpec built-in methods ([#55](https://github.com/yujinakayama/transpec/issues/55))
|
8
|
+
* Add experimental support for Ruby 2.2 (development version) by falling back to Ruby 2.1 parser
|
9
|
+
|
5
10
|
## v1.10.3
|
6
11
|
|
7
12
|
* Suggest using `-c/--rspec-command` option and exit gracefully when dynamic analysis failed ([#52](https://github.com/yujinakayama/transpec/issues/52))
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,4 +1,8 @@
|
|
1
|
-
[](http://badge.fury.io/rb/transpec)
|
2
|
+
[](https://gemnasium.com/yujinakayama/transpec)
|
3
|
+
[](https://travis-ci.org/yujinakayama/transpec)
|
4
|
+
[](https://coveralls.io/r/yujinakayama/transpec)
|
5
|
+
[](https://codeclimate.com/github/yujinakayama/transpec)
|
2
6
|
|
3
7
|
# Transpec
|
4
8
|
|
@@ -402,14 +406,14 @@ end
|
|
402
406
|
|
403
407
|
The monkey-patched `obj.should`:
|
404
408
|
|
405
|
-
* Is provided by `rspec-expectations` gem.
|
409
|
+
* Is defined on `BasicObject` (or `Kernel`) and provided by `rspec-expectations` gem.
|
406
410
|
* Is deprecated in RSpec 3.
|
407
411
|
* Has [the issue](http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax#delegation_issues) with delegate/proxy objects.
|
408
412
|
* There's the alternative syntax [`expect(obj).to`](#standard-expectations) since RSpec 2.11.
|
409
413
|
|
410
414
|
The one-liner (implicit receiver) `should`:
|
411
415
|
|
412
|
-
* Is provided by `rspec-core` gem.
|
416
|
+
* Is defined on `RSpec::Core::ExampleGroup` and provided by `rspec-core` gem.
|
413
417
|
* Is _not_ deprecated in RSpec 3.
|
414
418
|
* Does _not_ have the issue with delegate/proxy objects.
|
415
419
|
* There's the alternative syntax [`is_expected.to`](#one-liner-expectations) since RSpec 2.99.beta2.
|
@@ -481,9 +485,11 @@ it { is_expected.to_not matcher } # with `--negative-form to_not`
|
|
481
485
|
|
482
486
|
`is_expected.to` is designed for the consistency with the `expect` syntax.
|
483
487
|
However the one-liner `should` is still _not_ deprecated in RSpec 3.0
|
484
|
-
and available even if the `should` syntax is
|
488
|
+
and available even if the `should` syntax is
|
489
|
+
[disabled with `RSpec.configure`](https://www.relishapp.com/rspec/rspec-expectations/v/3-0/docs/syntax-configuration#disable-should-syntax).
|
485
490
|
So if you think `is_expected.to` is verbose,
|
486
491
|
feel free to disable this conversion and continue using the one-liner `should`.
|
492
|
+
See [Two Types of `should`](#two-types-of-should) also.
|
487
493
|
|
488
494
|
* This conversion can be disabled by: `--keep oneliner`
|
489
495
|
* Deprecation: Not deprecated
|
@@ -1191,6 +1197,6 @@ Tested on MRI 1.9, 2.0, 2.1 and JRuby in 1.9 mode.
|
|
1191
1197
|
|
1192
1198
|
## License
|
1193
1199
|
|
1194
|
-
Copyright (c) 2013 Yuji Nakayama
|
1200
|
+
Copyright (c) 2013–2014 Yuji Nakayama
|
1195
1201
|
|
1196
1202
|
See the [LICENSE.txt](LICENSE.txt) for details.
|
data/README.md.erb
CHANGED
@@ -1,4 +1,8 @@
|
|
1
|
-
[](http://badge.fury.io/rb/transpec)
|
2
|
+
[](https://gemnasium.com/yujinakayama/transpec)
|
3
|
+
[](https://travis-ci.org/yujinakayama/transpec)
|
4
|
+
[](https://coveralls.io/r/yujinakayama/transpec)
|
5
|
+
[](https://codeclimate.com/github/yujinakayama/transpec)
|
2
6
|
|
3
7
|
# Transpec
|
4
8
|
|
@@ -399,14 +403,14 @@ end
|
|
399
403
|
|
400
404
|
The monkey-patched `obj.should`:
|
401
405
|
|
402
|
-
* Is provided by `rspec-expectations` gem.
|
406
|
+
* Is defined on `BasicObject` (or `Kernel`) and provided by `rspec-expectations` gem.
|
403
407
|
* Is deprecated in RSpec 3.
|
404
408
|
* Has [the issue](http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax#delegation_issues) with delegate/proxy objects.
|
405
409
|
* There's the alternative syntax [`expect(obj).to`](#standard-expectations) since RSpec 2.11.
|
406
410
|
|
407
411
|
The one-liner (implicit receiver) `should`:
|
408
412
|
|
409
|
-
* Is provided by `rspec-core` gem.
|
413
|
+
* Is defined on `RSpec::Core::ExampleGroup` and provided by `rspec-core` gem.
|
410
414
|
* Is _not_ deprecated in RSpec 3.
|
411
415
|
* Does _not_ have the issue with delegate/proxy objects.
|
412
416
|
* There's the alternative syntax [`is_expected.to`](#one-liner-expectations) since RSpec 2.99.beta2.
|
@@ -460,9 +464,11 @@ it { is_expected.to_not matcher } # with `--negative-form to_not`
|
|
460
464
|
|
461
465
|
`is_expected.to` is designed for the consistency with the `expect` syntax.
|
462
466
|
However the one-liner `should` is still _not_ deprecated in RSpec 3.0
|
463
|
-
and available even if the `should` syntax is
|
467
|
+
and available even if the `should` syntax is
|
468
|
+
[disabled with `RSpec.configure`](https://www.relishapp.com/rspec/rspec-expectations/v/3-0/docs/syntax-configuration#disable-should-syntax).
|
464
469
|
So if you think `is_expected.to` is verbose,
|
465
470
|
feel free to disable this conversion and continue using the one-liner `should`.
|
471
|
+
See [Two Types of `should`](#two-types-of-should) also.
|
466
472
|
|
467
473
|
* This conversion can be disabled by: `--keep oneliner`
|
468
474
|
* Deprecation: Not deprecated
|
@@ -1127,6 +1133,6 @@ Tested on MRI 1.9, 2.0, 2.1 and JRuby in 1.9 mode.
|
|
1127
1133
|
|
1128
1134
|
## License
|
1129
1135
|
|
1130
|
-
Copyright (c) 2013 Yuji Nakayama
|
1136
|
+
Copyright (c) 2013–<%= DateTime.now.year %> Yuji Nakayama
|
1131
1137
|
|
1132
1138
|
See the [LICENSE.txt](LICENSE.txt) for details.
|
data/lib/transpec.rb
CHANGED
@@ -8,24 +8,6 @@ module Transpec
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def self.required_rspec_version
|
11
|
-
@required_rspec_version ||=
|
12
|
-
gemspec_path = File.join(root, 'transpec.gemspec')
|
13
|
-
gem_specification = Gem::Specification.load(gemspec_path)
|
14
|
-
rspec_dependency = gem_specification.dependencies.find { |d| d.name == 'rspec' }
|
15
|
-
|
16
|
-
if rspec_dependency
|
17
|
-
rspec_requirement = rspec_dependency.requirement
|
18
|
-
gem_version = rspec_requirement.requirements.first.find { |r| r.is_a?(Gem::Version) }
|
19
|
-
RSpecVersion.new(gem_version)
|
20
|
-
else
|
21
|
-
# Using development version of RSpec with Bundler.
|
22
|
-
current_rspec_version
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
def self.current_rspec_version
|
28
|
-
require 'rspec/version'
|
29
|
-
RSpecVersion.new(RSpec::Version::STRING)
|
11
|
+
@required_rspec_version ||= RSpecVersion.new('2.14')
|
30
12
|
end
|
31
13
|
end
|
data/lib/transpec/converter.rb
CHANGED
@@ -17,7 +17,7 @@ module Transpec
|
|
17
17
|
|
18
18
|
def initialize(configuration = nil, rspec_version = nil, runtime_data = nil)
|
19
19
|
@configuration = configuration || Configuration.new
|
20
|
-
@rspec_version = rspec_version || Transpec.
|
20
|
+
@rspec_version = rspec_version || Transpec.required_rspec_version
|
21
21
|
@runtime_data = runtime_data
|
22
22
|
@report = Report.new
|
23
23
|
end
|
@@ -31,9 +31,8 @@ module Transpec
|
|
31
31
|
|
32
32
|
def dispatch_node(node, source_rewriter)
|
33
33
|
Syntax.standalone_syntaxes.each do |syntax_class|
|
34
|
-
next unless syntax_class.conversion_target_node?(node, runtime_data)
|
35
|
-
|
36
34
|
syntax = syntax_class.new(node, source_rewriter, runtime_data, report)
|
35
|
+
next unless syntax.conversion_target?
|
37
36
|
|
38
37
|
handler_name = "process_#{syntax_class.snake_case_name}"
|
39
38
|
send(handler_name, syntax)
|
@@ -45,9 +45,9 @@ module Transpec
|
|
45
45
|
|
46
46
|
ast.each_node do |node|
|
47
47
|
Syntax.standalone_syntaxes.each do |syntax_class|
|
48
|
-
next unless syntax_class.dynamic_analysis_target_node?(node)
|
49
48
|
syntax = syntax_class.new(node)
|
50
|
-
syntax.
|
49
|
+
next unless syntax.dynamic_analysis_target?
|
50
|
+
syntax.register_dynamic_analysis_request(self)
|
51
51
|
end
|
52
52
|
end
|
53
53
|
end
|
@@ -206,8 +206,8 @@ module Transpec
|
|
206
206
|
args.reject do |arg|
|
207
207
|
case arg
|
208
208
|
when '-m', '--generate-commit-message'
|
209
|
-
warn 'DEPRECATION: -m/--generate-commit-message option is deprecated. ' \
|
210
|
-
'
|
209
|
+
warn 'DEPRECATION: The -m/--generate-commit-message option is deprecated. ' \
|
210
|
+
'Now Transpec always generates the commit message.'
|
211
211
|
true
|
212
212
|
else
|
213
213
|
false
|
data/lib/transpec/record.rb
CHANGED
@@ -4,28 +4,66 @@ require 'transpec/annotatable'
|
|
4
4
|
|
5
5
|
module Transpec
|
6
6
|
class Record
|
7
|
-
|
7
|
+
OVERRIDDE_FORBIDDEN_METHODS = [
|
8
|
+
:original_syntax,
|
9
|
+
:original_syntax_type,
|
10
|
+
:converted_syntax,
|
11
|
+
:converted_syntax_type
|
12
|
+
]
|
13
|
+
|
14
|
+
attr_reader :original_syntax_type, :converted_syntax_type, :annotation
|
8
15
|
|
9
16
|
def initialize(original_syntax, converted_syntax, annotation = nil)
|
10
|
-
@
|
11
|
-
@
|
17
|
+
@original_syntax_type = original_syntax.to_sym
|
18
|
+
@converted_syntax_type = converted_syntax.to_sym
|
12
19
|
@annotation = annotation
|
13
20
|
end
|
14
21
|
|
22
|
+
def original_syntax
|
23
|
+
original_syntax_type.to_s
|
24
|
+
end
|
25
|
+
|
26
|
+
def converted_syntax
|
27
|
+
converted_syntax_type.to_s
|
28
|
+
end
|
29
|
+
|
30
|
+
def original_syntax_type
|
31
|
+
@original_syntax_type ||= build_original_syntax.to_sym
|
32
|
+
end
|
33
|
+
|
34
|
+
def converted_syntax_type
|
35
|
+
@converted_syntax_type ||= build_converted_syntax.to_sym
|
36
|
+
end
|
37
|
+
|
15
38
|
def ==(other)
|
16
39
|
self.class == other.class &&
|
17
|
-
|
18
|
-
|
40
|
+
original_syntax_type == other.original_syntax_type &&
|
41
|
+
converted_syntax_type == other.converted_syntax_type
|
19
42
|
end
|
20
43
|
|
21
44
|
alias_method :eql?, :==
|
22
45
|
|
23
46
|
def hash
|
24
|
-
|
47
|
+
original_syntax_type.hash ^ converted_syntax_type.hash
|
25
48
|
end
|
26
49
|
|
27
50
|
def to_s
|
28
|
-
"`#{
|
51
|
+
"`#{original_syntax_type}` -> `#{converted_syntax_type}`"
|
52
|
+
end
|
53
|
+
|
54
|
+
private
|
55
|
+
|
56
|
+
def build_original_syntax
|
57
|
+
fail NotImplementedError
|
58
|
+
end
|
59
|
+
|
60
|
+
def build_converted_syntax
|
61
|
+
fail NotImplementedError
|
62
|
+
end
|
63
|
+
|
64
|
+
def self.method_added(method_name)
|
65
|
+
return unless OVERRIDDE_FORBIDDEN_METHODS.include?(method_name)
|
66
|
+
fail "Do not override Record##{method_name}."
|
29
67
|
end
|
30
68
|
end
|
31
69
|
|
data/lib/transpec/syntax.rb
CHANGED
@@ -62,22 +62,18 @@ module Transpec
|
|
62
62
|
extend ActiveSupport::Concern
|
63
63
|
|
64
64
|
module ClassMethods
|
65
|
-
def
|
66
|
-
|
65
|
+
def define_dynamic_analysis(&block)
|
66
|
+
dynamic_analyses << block
|
67
67
|
end
|
68
68
|
|
69
|
-
def
|
70
|
-
@
|
71
|
-
end
|
72
|
-
|
73
|
-
def dynamic_analysis_target_node?(node)
|
74
|
-
target_node?(node)
|
69
|
+
def dynamic_analyses
|
70
|
+
@dynamic_analyses ||= []
|
75
71
|
end
|
76
72
|
end
|
77
73
|
|
78
|
-
def
|
79
|
-
self.class.
|
80
|
-
instance_exec(rewriter, &
|
74
|
+
def register_dynamic_analysis_request(rewriter)
|
75
|
+
self.class.dynamic_analyses.each do |analysis|
|
76
|
+
instance_exec(rewriter, &analysis)
|
81
77
|
end
|
82
78
|
end
|
83
79
|
end
|
@@ -102,16 +98,6 @@ module Transpec
|
|
102
98
|
end
|
103
99
|
end
|
104
100
|
|
105
|
-
# The default common method for .conversion_target_node? and .dynamic_analysis_target_node?.
|
106
|
-
# If they should behave differently, override either or both.
|
107
|
-
def self.target_node?(node, runtime_data = nil)
|
108
|
-
false
|
109
|
-
end
|
110
|
-
|
111
|
-
def self.conversion_target_node?(node, runtime_data = nil)
|
112
|
-
target_node?(node, runtime_data)
|
113
|
-
end
|
114
|
-
|
115
101
|
def initialize(node, source_rewriter = nil, runtime_data = nil, report = nil)
|
116
102
|
@node = node
|
117
103
|
@source_rewriter = source_rewriter
|
@@ -119,6 +105,14 @@ module Transpec
|
|
119
105
|
@report = report || Report.new
|
120
106
|
end
|
121
107
|
|
108
|
+
def dynamic_analysis_target?
|
109
|
+
false
|
110
|
+
end
|
111
|
+
|
112
|
+
def conversion_target?
|
113
|
+
dynamic_analysis_target?
|
114
|
+
end
|
115
|
+
|
122
116
|
def static_context_inspector
|
123
117
|
@static_context_inspector ||= StaticContextInspector.new(node)
|
124
118
|
end
|
@@ -8,8 +8,8 @@ module Transpec
|
|
8
8
|
class Allow < Syntax
|
9
9
|
include Mixin::ExpectBase
|
10
10
|
|
11
|
-
def
|
12
|
-
receiver_node.nil? && [:allow, :allow_any_instance_of].include?(method_name)
|
11
|
+
def dynamic_analysis_target?
|
12
|
+
super && receiver_node.nil? && [:allow, :allow_any_instance_of].include?(method_name)
|
13
13
|
end
|
14
14
|
|
15
15
|
def method_name_for_instance
|
@@ -8,8 +8,8 @@ module Transpec
|
|
8
8
|
class BeBoolean < Syntax
|
9
9
|
include Mixin::Send
|
10
10
|
|
11
|
-
def
|
12
|
-
receiver_node.nil? && [:be_true, :be_false].include?(method_name)
|
11
|
+
def dynamic_analysis_target?
|
12
|
+
super && receiver_node.nil? && [:be_true, :be_false].include?(method_name)
|
13
13
|
end
|
14
14
|
|
15
15
|
def be_true?
|
@@ -8,8 +8,8 @@ module Transpec
|
|
8
8
|
class BeClose < Syntax
|
9
9
|
include Mixin::Send
|
10
10
|
|
11
|
-
def
|
12
|
-
receiver_node.nil? && method_name == :be_close
|
11
|
+
def dynamic_analysis_target?
|
12
|
+
super && receiver_node.nil? && method_name == :be_close
|
13
13
|
end
|
14
14
|
|
15
15
|
def convert_to_be_within!
|
@@ -12,12 +12,11 @@ module Transpec
|
|
12
12
|
|
13
13
|
METHODS_YIELD_EXAMPLE = (EXAMPLE_METHODS + HOOK_METHODS + HELPER_METHODS).freeze
|
14
14
|
|
15
|
-
def
|
16
|
-
super
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
receiver_node.nil? && [:example, :running_example].include?(method_name)
|
15
|
+
def dynamic_analysis_target?
|
16
|
+
super &&
|
17
|
+
receiver_node.nil? &&
|
18
|
+
[:example, :running_example].include?(method_name) &&
|
19
|
+
block_node_taken_by_method(node).nil?
|
21
20
|
end
|
22
21
|
|
23
22
|
def convert!
|
@@ -8,8 +8,8 @@ module Transpec
|
|
8
8
|
class Double < Syntax
|
9
9
|
include Mixin::Send
|
10
10
|
|
11
|
-
def
|
12
|
-
receiver_node.nil? && [:double, :mock, :stub].include?(method_name)
|
11
|
+
def dynamic_analysis_target?
|
12
|
+
super && receiver_node.nil? && [:double, :mock, :stub].include?(method_name)
|
13
13
|
end
|
14
14
|
|
15
15
|
def convert_to_double!
|
@@ -9,31 +9,30 @@ module Transpec
|
|
9
9
|
class Example < Syntax
|
10
10
|
include Mixin::Send, RSpecDSL
|
11
11
|
|
12
|
-
|
13
|
-
|
12
|
+
define_dynamic_analysis do |rewriter|
|
13
|
+
code = "is_a?(Class) && ancestors.any? { |a| a.name == 'RSpec::Core::ExampleGroup' }"
|
14
|
+
rewriter.register_request(node, :example_group_context?, code, :context)
|
15
|
+
end
|
16
|
+
|
17
|
+
def dynamic_analysis_target?
|
18
|
+
super && receiver_node.nil? && EXAMPLE_METHODS.include?(method_name)
|
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_group_context?]
|
21
30
|
else
|
22
31
|
# Otherwise check statically.
|
23
|
-
|
24
|
-
inspector.scopes.last == :example_group
|
32
|
+
static_context_inspector.scopes.last == :example_group
|
25
33
|
end
|
26
34
|
end
|
27
35
|
|
28
|
-
def self.target_method?(receiver_node, method_name)
|
29
|
-
receiver_node.nil? && EXAMPLE_METHODS.include?(method_name)
|
30
|
-
end
|
31
|
-
|
32
|
-
define_dynamic_analysis_request do |rewriter|
|
33
|
-
code = "is_a?(Class) && ancestors.any? { |a| a.name == 'RSpec::Core::ExampleGroup' }"
|
34
|
-
rewriter.register_request(node, :example_group_context?, code, :context)
|
35
|
-
end
|
36
|
-
|
37
36
|
def convert_pending_to_skip!
|
38
37
|
convert_pending_selector_to_skip!
|
39
38
|
convert_pending_metadata_to_skip!
|