21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
# File 'lib/transpec/ast/scope_stack.rb', line 21
def in_example_group_context?
if include?(:example_group)
scopes_in_example_group = inner_scopes_in_scope(:example_group)
return false if include_class_scope?(scopes_in_example_group)
include_method_or_block_scope?(scopes_in_example_group)
elsif include?(:rspec_configure)
scopes_in_rspec_configure = inner_scopes_in_scope(:rspec_configure)
return false if include_class_scope?(scopes_in_rspec_configure)
include_method_or_block_scope?(scopes_in_rspec_configure)
elsif first == :def
scopes_in_method = self[1..-1]
!include_class_scope?(scopes_in_method)
elsif include?(:module)
scopes_in_module = inner_scopes_in_scope(:module)
return false if include_class_scope?(scopes_in_module)
scopes_in_module.include?(:def)
else
false
end
end
|