Sha256: 0f0088097355147d606866f12bb6c6acb23c18b4008fdc1260be60153d0a555a

Contents?: true

Size: 578 Bytes

Versions: 10

Compression:

Stored size: 578 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 }
  end
})

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 }
  end
})

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
dry-effects-0.4.1 lib/dry/effects/extensions/rspec.rb
dry-effects-0.4.0 lib/dry/effects/extensions/rspec.rb
dry-effects-0.3.1 lib/dry/effects/extensions/rspec.rb
dry-effects-0.3.0 lib/dry/effects/extensions/rspec.rb
dry-effects-0.2.0 lib/dry/effects/extensions/rspec.rb
dry-effects-0.1.5 lib/dry/effects/extensions/rspec.rb
dry-effects-0.1.4 lib/dry/effects/extensions/rspec.rb
dry-effects-0.1.3 lib/dry/effects/extensions/rspec.rb
dry-effects-0.1.2 lib/dry/effects/extensions/rspec.rb
dry-effects-0.1.1 lib/dry/effects/extensions/rspec.rb