Sha256: 9343e6f0a3a88caad46b0cbea9af8650e1ed57065daeca460470728ed7db6281

Contents?: true

Size: 1.08 KB

Versions: 5

Compression:

Stored size: 1.08 KB

Contents

module RSpec
  module Core
    # This module is included in {ExampleGroup}, making the methods
    # available to be called from within example blocks.
    #
    # @see ClassMethods
    module MemoizedHelpers
      class ContextHookMemoized
        def self.isolate_for_context_hook_await(example_group_instance)
          exploding_memoized = self

          example_group_instance.instance_exec_await do
            @__memoized = exploding_memoized

            begin
              yield.await
            ensure
              # This is doing a reset instead of just isolating for context hook.
              # Really, this should set the old @__memoized back into place.
              #
              # Caller is the before and after context hooks
              # which are both called from self.run
              # I didn't look at why it made tests fail, maybe an object was getting reused in RSpec tests,
              # if so, then that probably already works, and its the tests that are wrong.
              __init_memoized
            end
          end
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
opal-rspec-1.1.0.alpha3 lib-opal/opal/rspec/async/memoized_helpers.rb
opal-rspec-1.1.0.alpha2 lib-opal/opal/rspec/async/memoized_helpers.rb
opal-rspec-1.1.0.alpha1 lib-opal/opal/rspec/async/memoized_helpers.rb
opal-rspec-1.0.0 lib-opal/opal/rspec/async/memoized_helpers.rb
opal-rspec-1.0.0.alpha1 lib-opal/opal/rspec/async/memoized_helpers.rb