Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add specs for Dir.exists? and File.exists? #1065

Merged
merged 2 commits into from
Sep 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions 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 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 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