File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change 2
2
require_relative 'fixtures/classes'
3
3
4
4
describe "Kernel#open" do
5
-
6
5
before :each do
7
6
@name = tmp ( "kernel_open.txt" )
8
7
@content = "This is a test"
137
136
it "accepts nil for mode and permission" do
138
137
open ( @name , nil , nil ) { |f | f . gets } . should == @content
139
138
end
139
+
140
+ ruby_version_is "" ..."3.0" do
141
+ it "works correctly when redefined by open-uri" do
142
+ code = <<~RUBY
143
+ require 'open-uri'
144
+ obj = Object.new
145
+ def obj.to_open; self; end
146
+ p open(obj) == obj
147
+ RUBY
148
+ ruby_exe ( code , args : "2>&1" ) . should == "true\n "
149
+ end
150
+ end
140
151
end
141
152
142
153
describe "Kernel.open" do
Original file line number Diff line number Diff line change
1
+ slow:Kernel#open works correctly when redefined by open-uri
You can’t perform that action at this time.
0 commit comments