summaryrefslogtreecommitdiff
path: root/spec/ruby/core/dir/children_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/core/dir/children_spec.rb')
-rw-r--r--spec/ruby/core/dir/children_spec.rb14
1 files changed, 11 insertions, 3 deletions
diff --git a/spec/ruby/core/dir/children_spec.rb b/spec/ruby/core/dir/children_spec.rb
index e0325a24b8..f890f54eb4 100644
--- a/spec/ruby/core/dir/children_spec.rb
+++ b/spec/ruby/core/dir/children_spec.rb
@@ -100,10 +100,18 @@ ruby_version_is "2.6" do
a.should == %w|.dotfile.ext directory|
end
- it "accepts an options Hash" do
+ it "accepts an encoding keyword for the encoding of the entries" do
@dir = Dir.new("#{DirSpecs.mock_dir}/deeply/nested", encoding: "utf-8")
- a = @dir.children.sort
- a.should == %w|.dotfile.ext directory|
+ dirs = @dir.to_a.sort
+ dirs.each { |d| d.encoding.should == Encoding::UTF_8 }
+ end
+
+ ruby_version_is ""..."2.7" do
+ it "accepts nil options" do
+ @dir = Dir.new("#{DirSpecs.mock_dir}/deeply/nested", nil)
+ dirs = @dir.to_a.sort
+ dirs.each { |d| d.encoding.should == Encoding.find("filesystem") }
+ end
end
it "returns children encoded with the filesystem encoding by default" do