Sha256: 662f50e3f1dbce89836b956315cb720aa97737616c307030c8c21868ee0f132c

Contents?: true

Size: 562 Bytes

Versions: 1

Compression:

Stored size: 562 Bytes

Contents

# frozen_string_literal: true

# These patches make those rspec parts depending on Thread.current
# play nice with dry-effects.
# They've been used in production for months before been added here.

RSpec::Support.singleton_class.prepend(Module.new {
  include Dry::Effects.Reader(:rspec, as: :effect_local_data)

  def thread_local_data = effect_local_data { super }
})

RSpec::Core::Runner.prepend(Module.new {
  include Dry::Effects::Handler.Reader(:rspec, as: :run_with_data)

  def run_specs(*) = run_with_data(RSpec::Support.thread_local_data) { super }
})

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dry-effects-0.5.0 lib/dry/effects/extensions/rspec.rb