Module: RSpecAroundAll

Defined in:
lib/rspec_around_all.rb

Defined Under Namespace

Classes: FiberAwareGroup

Instance Method Summary collapse

Instance Method Details

#around(scope = :each, &block) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/rspec_around_all.rb', line 15

def around(scope = :each, &block)
  # let RSpec handle around(:each) hooks...
  return super(scope, &block) unless scope == :all

  group, fiber = self, nil
  before(:all) do
    fiber = Fiber.new(&block)
    fiber.resume(FiberAwareGroup.new(group))
  end

  after(:all) do
    fiber.resume
  end
end