diff options
Diffstat (limited to 'spec/ruby/core/file')
-rw-r--r-- | spec/ruby/core/file/absolute_path_spec.rb | 74 | ||||
-rw-r--r-- | spec/ruby/core/file/extname_spec.rb | 4 |
2 files changed, 38 insertions, 40 deletions
diff --git a/spec/ruby/core/file/absolute_path_spec.rb b/spec/ruby/core/file/absolute_path_spec.rb index 9f39923472..e35c80ec3c 100644 --- a/spec/ruby/core/file/absolute_path_spec.rb +++ b/spec/ruby/core/file/absolute_path_spec.rb @@ -1,54 +1,52 @@ require_relative '../../spec_helper' -ruby_version_is "2.7" do - describe "File.absolute_path?" do - before :each do - @abs = File.expand_path(__FILE__) - end +describe "File.absolute_path?" do + before :each do + @abs = File.expand_path(__FILE__) + end - it "returns true if it's an absolute pathname" do - File.absolute_path?(@abs).should be_true - end + it "returns true if it's an absolute pathname" do + File.absolute_path?(@abs).should be_true + end - it "returns false if it's a relative path" do - File.absolute_path?(File.basename(__FILE__)).should be_false - end + it "returns false if it's a relative path" do + File.absolute_path?(File.basename(__FILE__)).should be_false + end - it "returns false if it's a tricky relative path" do - File.absolute_path?("C:foo\\bar").should be_false - end + it "returns false if it's a tricky relative path" do + File.absolute_path?("C:foo\\bar").should be_false + end - it "does not expand '~' to a home directory." do - File.absolute_path?('~').should be_false - end + it "does not expand '~' to a home directory." do + File.absolute_path?('~').should be_false + end - it "does not expand '~user' to a home directory." do - path = File.dirname(@abs) - Dir.chdir(path) do - File.absolute_path?('~user').should be_false - end + it "does not expand '~user' to a home directory." do + path = File.dirname(@abs) + Dir.chdir(path) do + File.absolute_path?('~user').should be_false end + end - it "calls #to_path on its argument" do - mock = mock_to_path(File.expand_path(__FILE__)) + it "calls #to_path on its argument" do + mock = mock_to_path(File.expand_path(__FILE__)) - File.absolute_path?(mock).should be_true - end + File.absolute_path?(mock).should be_true + end - platform_is_not :windows do - it "takes into consideration the platform's root" do - File.absolute_path?("C:\\foo\\bar").should be_false - File.absolute_path?("C:/foo/bar").should be_false - File.absolute_path?("/foo/bar\\baz").should be_true - end + platform_is_not :windows do + it "takes into consideration the platform's root" do + File.absolute_path?("C:\\foo\\bar").should be_false + File.absolute_path?("C:/foo/bar").should be_false + File.absolute_path?("/foo/bar\\baz").should be_true end + end - platform_is :windows do - it "takes into consideration the platform path separator(s)" do - File.absolute_path?("C:\\foo\\bar").should be_true - File.absolute_path?("C:/foo/bar").should be_true - File.absolute_path?("/foo/bar\\baz").should be_false - end + platform_is :windows do + it "takes into consideration the platform path separator(s)" do + File.absolute_path?("C:\\foo\\bar").should be_true + File.absolute_path?("C:/foo/bar").should be_true + File.absolute_path?("/foo/bar\\baz").should be_false end end end diff --git a/spec/ruby/core/file/extname_spec.rb b/spec/ruby/core/file/extname_spec.rb index e182ed44f2..d20cf813d9 100644 --- a/spec/ruby/core/file/extname_spec.rb +++ b/spec/ruby/core/file/extname_spec.rb @@ -33,14 +33,14 @@ describe "File.extname" do end describe "for a filename ending with a dot" do - guard -> { platform_is :windows or ruby_version_is ""..."2.7" } do + platform_is :windows do it "returns ''" do File.extname(".foo.").should == "" File.extname("foo.").should == "" end end - guard -> { platform_is_not :windows and ruby_version_is "2.7" } do + platform_is_not :windows do it "returns '.'" do File.extname(".foo.").should == "." File.extname("foo.").should == "." |