Skip to content

Commit

Permalink
Refresh specs for Dir.exists? and File.exists?
Browse files Browse the repository at this point in the history
This follows upstream change ruby/spec#1065
  • Loading branch information
herwinw committed Sep 4, 2023
1 parent 24ab4d3 commit 60a74f0
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
8 changes: 8 additions & 0 deletions spec/core/dir/exist_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,11 @@

it_behaves_like :dir_exist, :exist?
end

ruby_version_is "3.2" do
describe "Dir.exists?" do
it "has been removed" do
Dir.should_not.respond_to?(:exists?)
end
end
end
8 changes: 8 additions & 0 deletions spec/core/file/exist_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,11 @@
describe "File.exist?" do
it_behaves_like :file_exist, :exist?, File
end

ruby_version_is "3.2" do
describe "File.exists?" do
it "has been removed" do
File.should_not.respond_to?(:exists?)
end
end
end
5 changes: 0 additions & 5 deletions spec/shared/file/exist.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@
@object.send(@method, 'a_fake_file').should == false
end

it "returns true if the file exist using the alias exists?" do
@object.send(@method, __FILE__).should == true
@object.send(@method, 'a_fake_file').should == false
end

it "raises an ArgumentError if not passed one argument" do
-> { @object.send(@method) }.should raise_error(ArgumentError)
-> { @object.send(@method, __FILE__, __FILE__) }.should raise_error(ArgumentError)
Expand Down

0 comments on commit 60a74f0

Please sign in to comment.