Parent

Class/Module Index [+]

Quicksearch

RSpec::Core::MemoizedHelpers::ContextHookMemoizedHash

Used internally to customize the behavior of the memoized hash when used in a `before(:context)` hook.

@private

Public Class Methods

fetch(key, &block) click to toggle source
# File lib/rspec/core/memoized_helpers.rb, line 148
def self.fetch(key, &block)
  description = if key == :subject
    "subject"
  else
    "let declaration `#{key}`"
  end

  raise #{description} accessed in #{article} #{hook_expression} hook at:  #{CallerFilter.first_non_rspec_line}`let` and `subject` declarations are not intended to be calledin #{article} #{hook_expression} hook, as they exist to define state thatis reset between each example, while #{hook_expression} exists to#{hook_intention}.
end
isolate_for_context_hook(example_group_instance) click to toggle source
# File lib/rspec/core/memoized_helpers.rb, line 134
def self.isolate_for_context_hook(example_group_instance)
  hash = self

  example_group_instance.instance_exec do
    @__memoized = hash

    begin
      yield
    ensure
      @__memoized = nil
    end
  end
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.