From b5498bf1ca9a25dc89119ef1494ac7805538988c Mon Sep 17 00:00:00 2001 From: Benoit Daloze Date: Mon, 1 May 2023 17:10:17 +0200 Subject: [PATCH] Cleanup guards for Dir.fchdir spec * See https://github.com/ruby/ruby/pull/7135#discussion_r1181641096 --- core/dir/fchdir_spec.rb | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/core/dir/fchdir_spec.rb b/core/dir/fchdir_spec.rb index 08b1cdfc7..429e56969 100644 --- a/core/dir/fchdir_spec.rb +++ b/core/dir/fchdir_spec.rb @@ -2,17 +2,7 @@ require_relative 'fixtures/common' ruby_version_is '3.3' do - has_fchdir = begin - dir = Dir.new('.') - Dir.fchdir(dir.fileno) - true - rescue NotImplementedError, NoMethodError - false - ensure - dir.close - end - - guard -> { has_fchdir } do + guard -> { Dir.respond_to? :fchdir } do describe "Dir.fchdir" do before :all do DirSpecs.create_mock_dirs @@ -67,7 +57,7 @@ end end - guard_not -> { has_fchdir } do + guard_not -> { Dir.respond_to? :fchdir } do describe "Dir.fchdir" do it "raises NotImplementedError" do -> { Dir.fchdir 1 }.should raise_error(NotImplementedError)