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

Commit 702c562

Browse files
committed
Demonstrates problem where a module can affect how LetDefinitions are put in the ancestor chain
1 parent bbc83ce commit 702c562

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

spec/rspec/core/memoized_helpers_spec.rb

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -616,6 +616,24 @@ def define_and_run_group
616616
})
617617
end
618618
end
619+
620+
context "when included modules have hooks that define memoized helpers" do
621+
it "allows memoized helpers to override methods in previously included modules" do
622+
group = ExampleGroup.describe do
623+
include Module.new {
624+
def self.included(m); m.let(:unrelated) { :unrelated }; end
625+
}
626+
627+
include Module.new {
628+
def hello_message; "Hello from module"; end
629+
}
630+
631+
let(:hello_message) { "Hello from let" }
632+
end
633+
634+
expect(group.new.hello_message).to eq("Hello from let")
635+
end
636+
end
619637
end
620638

621639
describe "#let!" do

0 commit comments

Comments
 (0)