Module: RSpec::AbsolutelyPrependedAfterEach

Included in:
Core::Configuration, Core::ExampleGroup
Defined in:
lib/rspec/absolutely_prepended_after_each.rb

Instance Method Summary collapse

Instance Method Details

#prepend_absolutely_after_each(*args, &block) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/rspec/absolutely_prepended_after_each.rb', line 4

def prepend_absolutely_after_each(*args, &block)
  around(:each, *args) do |ex|
    example_group = example.example_group

    # if not after(:each) is called multiple times
    unless example_group.[:absolutely_prepended_after_each]
      example_group.before(:each, *args, &block)

      example_group.[:absolutely_prepended_after_each] = true
    end

    ex.run
  end
end