module RSpec::Core::Hooks::RegistersGlobals

Public Instance Methods

register_globals(host, globals) click to toggle source
# File lib/rspec/core/hooks.rb, line 124
def register_globals host, globals
  [:before, :after, :around].each do |position|
    process host, globals, position, :each
    next if position == :around # no around(:all) hooks
    process host, globals, position, :all
  end
end

Private Instance Methods

process(host, globals, position, scope) click to toggle source
# File lib/rspec/core/hooks.rb, line 133
def process host, globals, position, scope
  globals[position][scope].each do |hook|
    unless host.parent_groups.any? { |a| a.hooks[position][scope].include? hook }
      self[position][scope] << hook if scope == :each || hook.options_apply?(host)
    end
  end
end