Skip to content

Commit 2ae84a6

Browse files
committed
Pathname now calls respond_to? method
1 parent 5d97dd5 commit 2ae84a6

File tree

1 file changed

+14
-23
lines changed

1 file changed

+14
-23
lines changed

test/stdlib/Pathname_test.rb

Lines changed: 14 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,11 @@ def test_pwd
2727
Pathname, :pwd
2828
end
2929

30-
def test_initialize
31-
omit "Pathname is developing in head" if RUBY_VERSION >= '3.5'
32-
30+
def test_new
3331
assert_send_type '(String) -> Pathname',
3432
Pathname, :new, 'foo'
3533
assert_send_type '(ToStr) -> Pathname',
36-
Pathname, :new, ToStr.new('foo')
34+
Pathname, :new, ToStr.new('foo').__with_object_methods(:respond_to?)
3735
assert_send_type '(Pathname) -> Pathname',
3836
Pathname, :new, Pathname('foo')
3937
end
@@ -45,25 +43,21 @@ class PathnameInstanceTest < Test::Unit::TestCase
4543
testing '::Pathname'
4644

4745
def test_plus
48-
omit "Pathname is developing in head" if RUBY_VERSION >= '3.5'
49-
5046
assert_send_type '(Pathname) -> Pathname',
5147
Pathname('foo'), :+, Pathname('bar')
5248
assert_send_type '(String) -> Pathname',
5349
Pathname('foo'), :+, 'bar'
5450
assert_send_type '(ToStr) -> Pathname',
55-
Pathname('foo'), :+, ToStr.new('bar')
51+
Pathname('foo'), :+, ToStr.new('bar').__with_object_methods(:respond_to?)
5652
end
5753

5854
def test_slash
59-
omit "Pathname is developing in head" if RUBY_VERSION >= '3.5'
60-
6155
assert_send_type '(Pathname) -> Pathname',
6256
Pathname('foo'), :/, Pathname('bar')
6357
assert_send_type '(String) -> Pathname',
6458
Pathname('foo'), :/, 'bar'
6559
assert_send_type '(ToStr) -> Pathname',
66-
Pathname('foo'), :/, ToStr.new('bar')
60+
Pathname('foo'), :/, ToStr.new('bar').__with_object_methods(:respond_to?)
6761
end
6862

6963
def test_spaceship
@@ -386,16 +380,14 @@ def test_inspect
386380
end
387381

388382
def test_join
389-
omit "Pathname is developing in head" if RUBY_VERSION >= '3.5'
390-
391383
assert_send_type '() -> Pathname',
392384
Pathname('.'), :join
393385
assert_send_type '(String) -> Pathname',
394386
Pathname('.'), :join, 'foo'
395387
assert_send_type '(String, String) -> Pathname',
396388
Pathname('.'), :join, 'foo', 'bar'
397389
assert_send_type '(ToStr) -> Pathname',
398-
Pathname('.'), :join, ToStr.new('foo')
390+
Pathname('.'), :join, ToStr.new('foo').__with_object_methods(:respond_to?)
399391
assert_send_type '(Pathname) -> Pathname',
400392
Pathname('.'), :join, Pathname('foo')
401393
end
@@ -610,15 +602,13 @@ def test_relative?
610602
end
611603

612604
def test_relative_path_from
613-
omit "Pathname is developing in head" if RUBY_VERSION >= '3.5'
614-
615605
assert_send_type '(Pathname) -> Pathname',
616606
Pathname('.'), :relative_path_from, Pathname('.')
617607
assert_send_type '(String) -> Pathname',
618608
Pathname('.'), :relative_path_from, '.'
619609

620610
assert_send_type '(_ToStr) -> Pathname',
621-
Pathname('.'), :relative_path_from, ToStr.new('.').__with_object_methods(:is_a?)
611+
Pathname('.'), :relative_path_from, ToStr.new('.').__with_object_methods(:is_a?, :respond_to?)
622612
end
623613

624614
def test_rename
@@ -834,14 +824,15 @@ class PathnameKernelTest < Test::Unit::TestCase
834824
testing '::Kernel'
835825

836826
def test_Pathname
837-
omit "Pathname is developing in head" if RUBY_VERSION >= '3.5'
827+
assert_send_type(
828+
"(::String) -> ::Pathname",
829+
self, :Pathname, "Gemfile"
830+
)
838831

839-
with_string("Gemfile") do
840-
assert_send_type(
841-
"(::string) -> ::Pathname",
842-
self, :Pathname, _1
843-
)
844-
end
832+
assert_send_type(
833+
"(::_ToStr) -> ::Pathname",
834+
self, :Pathname, ToStr.new("Gemfile").__with_object_methods(:respond_to?)
835+
)
845836

846837
assert_send_type(
847838
"(::Pathname) -> ::Pathname",

0 commit comments

Comments
 (0)