diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2020-02-08 19:43:27 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2020-04-01 15:36:20 +0900 |
commit | 826f44834fe11f3f9c52343443a15b6c83466889 (patch) | |
tree | f2c2abed62db1c750515cd8b0fbac6442b6d4200 /spec/ruby/core/dir/each_child_spec.rb | |
parent | 3a2073e61b6ccce6d07d31ebd89d4c385b9a55f2 (diff) |
Drop support for ruby 2.4 from ruby/spec
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/2892
Diffstat (limited to 'spec/ruby/core/dir/each_child_spec.rb')
-rw-r--r-- | spec/ruby/core/dir/each_child_spec.rb | 70 |
1 files changed, 34 insertions, 36 deletions
diff --git a/spec/ruby/core/dir/each_child_spec.rb b/spec/ruby/core/dir/each_child_spec.rb index dcc9a456c7..93b4a1aec1 100644 --- a/spec/ruby/core/dir/each_child_spec.rb +++ b/spec/ruby/core/dir/each_child_spec.rb @@ -1,51 +1,49 @@ require_relative '../../spec_helper' require_relative 'fixtures/common' -ruby_version_is "2.5" do - describe "Dir.each_child" do - before :all do - DirSpecs.create_mock_dirs - end +describe "Dir.each_child" do + before :all do + DirSpecs.create_mock_dirs + end - after :all do - DirSpecs.delete_mock_dirs - end + after :all do + DirSpecs.delete_mock_dirs + end - it "yields all names in an existing directory to the provided block" do - a, b = [], [] + it "yields all names in an existing directory to the provided block" do + a, b = [], [] - Dir.each_child(DirSpecs.mock_dir) {|f| a << f} - Dir.each_child("#{DirSpecs.mock_dir}/deeply/nested") {|f| b << f} + Dir.each_child(DirSpecs.mock_dir) {|f| a << f} + Dir.each_child("#{DirSpecs.mock_dir}/deeply/nested") {|f| b << f} - a.sort.should == DirSpecs.expected_paths - %w[. ..] - b.sort.should == %w|.dotfile.ext directory| - end + a.sort.should == DirSpecs.expected_paths - %w[. ..] + b.sort.should == %w|.dotfile.ext directory| + end - it "returns nil when successful" do - Dir.each_child(DirSpecs.mock_dir) {|f| f}.should == nil - end + it "returns nil when successful" do + Dir.each_child(DirSpecs.mock_dir) {|f| f}.should == nil + end - it "calls #to_path on non-String arguments" do - p = mock('path') - p.should_receive(:to_path).and_return(DirSpecs.mock_dir) - Dir.each_child(p).to_a - end + it "calls #to_path on non-String arguments" do + p = mock('path') + p.should_receive(:to_path).and_return(DirSpecs.mock_dir) + Dir.each_child(p).to_a + end - it "raises a SystemCallError if passed a nonexistent directory" do - -> { Dir.each_child(DirSpecs.nonexistent) {} }.should raise_error(SystemCallError) - end + it "raises a SystemCallError if passed a nonexistent directory" do + -> { Dir.each_child(DirSpecs.nonexistent) {} }.should raise_error(SystemCallError) + end - describe "when no block is given" do - it "returns an Enumerator" do - Dir.each_child(DirSpecs.mock_dir).should be_an_instance_of(Enumerator) - Dir.each_child(DirSpecs.mock_dir).to_a.sort.should == DirSpecs.expected_paths - %w[. ..] - end + describe "when no block is given" do + it "returns an Enumerator" do + Dir.each_child(DirSpecs.mock_dir).should be_an_instance_of(Enumerator) + Dir.each_child(DirSpecs.mock_dir).to_a.sort.should == DirSpecs.expected_paths - %w[. ..] + end - describe "returned Enumerator" do - describe "size" do - it "should return nil" do - Dir.each_child(DirSpecs.mock_dir).size.should == nil - end + describe "returned Enumerator" do + describe "size" do + it "should return nil" do + Dir.each_child(DirSpecs.mock_dir).size.should == nil end end end |