Skip to content

Commit 150a1ae

Browse files
committed
Add a spec for an object with #to_path in $LOAD_PATH
1 parent 5c94a6a commit 150a1ae

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

spec/ruby/core/kernel/shared/require.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,14 @@
160160
ScratchPad.recorded.should == [:loaded]
161161
end
162162

163+
it "accepts an Object with #to_path in $LOAD_PATH" do
164+
obj = mock("to_path")
165+
obj.should_receive(:to_path).at_least(:once).and_return(CODE_LOADING_DIR)
166+
$LOAD_PATH << obj
167+
@object.send(@method, "load_fixture.rb").should be_true
168+
ScratchPad.recorded.should == [:loaded]
169+
end
170+
163171
it "does not require file twice after $LOAD_PATH change" do
164172
$LOAD_PATH << CODE_LOADING_DIR
165173
@object.require("load_fixture.rb").should be_true

0 commit comments

Comments
 (0)