Skip to content
This repository was archived by the owner on Nov 30, 2024. It is now read-only.

Commit d3b1d67

Browse files
committed
cleanup comments on memoized helpers
1 parent 3efa3fd commit d3b1d67

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

lib/rspec/core/memoized_helpers.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -481,14 +481,14 @@ def self.memoized_method_name_for(name, let_or_subject)
481481

482482
# @api private
483483
def self.define_memoized_method(example_group, name, memoized_method_name, &block)
484-
# We have to pass the block directly to `define_method` to
485-
# allow it to use method constructs like `super` and `return`.
486484
raise "#let or #subject called without a block" if block.nil?
487485

488-
MemoizedHelpers.module_for(example_group).__send__(:define_method, memoized_method_name, &block)
486+
# We have to pass the block directly to `define_method` to
487+
# allow it to use method constructs like `super` and `return`.
488+
module_for(example_group).__send__(:define_method, memoized_method_name, &block)
489489

490490
# Apply the memoization. The method has been defined in an ancestor
491-
# module so we can use `super` here to get the value.
491+
# module so we can use the decorated name here to get the value.
492492
example_group.__send__(:define_method, name) do
493493
__memoized.fetch(name) { |k| __memoized[k] = send(memoized_method_name, &nil) }
494494
end

spec/rspec/core/memoized_helpers_spec.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -620,6 +620,7 @@ def define_and_run_group
620620
context "when included modules have hooks that define memoized helpers" do
621621
it "allows memoized helpers to override methods in previously included modules" do
622622
group = ExampleGroup.describe do
623+
# this replicates the ordering scenario that breaks in #817
623624
include Module.new {
624625
def self.included(m); m.let(:unrelated) { :unrelated }; end
625626
}

0 commit comments

Comments
 (0)