Module: Transpec::Syntax::Mixin::ContextSensitive

Extended by:
ActiveSupport::Concern
Includes:
Send
Included in:
Example, ExampleGroup, Pending
Defined in:
lib/transpec/syntax/mixin/context_sensitive.rb

Instance Method Summary collapse

Methods included from 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 included from Send::TargetDetection

#dynamic_analysis_target?

Instance Method Details

#conversion_target?Boolean

Returns:

  • (Boolean)


20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/transpec/syntax/mixin/context_sensitive.rb', line 20

def conversion_target?
  return false unless dynamic_analysis_target?

  in_example_group_context = if runtime_data.run?(node)
                               # If we have runtime data, check with it.
                               return false unless defined_by_rspec?
                               runtime_data[node, :example_group_context?]
                             else
                               # Otherwise check statically.
                               static_context_inspector.scopes.last == :example_group
                             end

  in_example_group_context == should_be_in_example_group_context?
end

#should_be_in_example_group_context?Boolean

Returns:

  • (Boolean)


35
36
37
# File 'lib/transpec/syntax/mixin/context_sensitive.rb', line 35

def should_be_in_example_group_context?
  fail NotImplementedError
end