mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
401b64c4e8
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62656 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
33 lines
745 B
Ruby
33 lines
745 B
Ruby
require_relative '../../spec_helper'
|
|
|
|
ruby_version_is "2.4" do
|
|
describe "Dir.empty?" do
|
|
before :all do
|
|
@empty_dir = tmp("empty_dir")
|
|
mkdir_p @empty_dir
|
|
end
|
|
|
|
after :all do
|
|
rm_r @empty_dir
|
|
end
|
|
|
|
it "returns true for empty directories" do
|
|
result = Dir.empty? @empty_dir
|
|
result.should be_true
|
|
end
|
|
|
|
it "returns false for non-empty directories" do
|
|
result = Dir.empty? __dir__
|
|
result.should be_false
|
|
end
|
|
|
|
it "returns false for a non-directory" do
|
|
result = Dir.empty? __FILE__
|
|
result.should be_false
|
|
end
|
|
|
|
it "raises ENOENT for nonexistent directories" do
|
|
lambda { Dir.empty? tmp("nonexistent") }.should raise_error(Errno::ENOENT)
|
|
end
|
|
end
|
|
end
|