Class: Transpec::Syntax::Example
- Inherits:
-
Transpec::Syntax
- Object
- Transpec::Syntax
- Transpec::Syntax::Example
- Includes:
- RSpecDSL, Mixin::Send
- Defined in:
- lib/transpec/syntax/example.rb
Constant Summary
Constants included from RSpecDSL
RSpecDSL::EXAMPLE_GROUP_METHODS, RSpecDSL::EXAMPLE_METHODS, RSpecDSL::HELPER_METHODS, RSpecDSL::HOOK_METHODS
Instance Attribute Summary
Attributes inherited from Transpec::Syntax
#node, #report, #runtime_data, #source_rewriter
Instance Method Summary collapse
- #conversion_target? ⇒ Boolean
- #convert_pending_to_skip! ⇒ Object
- #dynamic_analysis_target? ⇒ Boolean
- #metadata_key_nodes ⇒ Object
Methods included from Mixin::Send
#arg_node, #arg_nodes, #arg_range, #args_range, #method_name, #parentheses_range, #range_after_arg, #range_in_between_receiver_and_selector, #range_in_between_selector_and_arg, #receiver_node, #receiver_range, #selector_range
Methods inherited from Transpec::Syntax
#expression_range, #initialize, #parent_node, snake_case_name, standalone?, #static_context_inspector
Methods included from Collection
#all_syntaxes, #inherited, #require_all, #standalone_syntaxes
Methods included from DynamicAnalysis
#register_dynamic_analysis_request
Constructor Details
This class inherits a constructor from Transpec::Syntax
Instance Method Details
#conversion_target? ⇒ Boolean
21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/transpec/syntax/example.rb', line 21 def conversion_target? return false unless dynamic_analysis_target? # Check whether the context is example group to differenciate # RSpec::Core::ExampleGroup.pending (a relative of #it) and # RSpec::Core::ExampleGroup#pending (marks the example as pending in #it block). if runtime_data.run?(node) # If we have runtime data, check with it. runtime_data[node, :example_group_context?] else # Otherwise check statically. static_context_inspector.scopes.last == :example_group end end |
#convert_pending_to_skip! ⇒ Object
36 37 38 39 |
# File 'lib/transpec/syntax/example.rb', line 36 def convert_pending_to_skip! convert_pending_selector_to_skip! end |
#dynamic_analysis_target? ⇒ Boolean
17 18 19 |
# File 'lib/transpec/syntax/example.rb', line 17 def dynamic_analysis_target? super && receiver_node.nil? && EXAMPLE_METHODS.include?(method_name) end |
#metadata_key_nodes ⇒ Object
41 42 43 44 45 46 47 48 49 |
# File 'lib/transpec/syntax/example.rb', line 41 def .each_with_object([]) do |node, key_nodes| if node.hash_type? key_nodes.concat(node.children.map { |pair_node| pair_node.children.first }) else key_nodes << node end end end |