Class: RSpec::Core::ExampleGroup

Inherits:
Object
  • Object
show all
Defined in:
lib/parallel_rspec/runner.rb

Class Method Summary collapse

Class Method Details

.any_context_hooks?Boolean

Returns:

  • (Boolean)


6
7
8
9
10
11
12
# File 'lib/parallel_rspec/runner.rb', line 6

def self.any_context_hooks?
  # unfortunately the public HookCollection API doesn't make this information available, so we have to grab it from internals
  descendants.any? do |group| # despite the name, descendents includes self
    group.hooks.send(:matching_hooks_for, :before, :context, group).any? ||
      group.hooks.send(:matching_hooks_for, :after, :context, group).any?
  end
end