Skip to content

Instantly share code, notes, and snippets.

@kronos
Created March 22, 2010 17:03
Show Gist options
  • Save kronos/340271 to your computer and use it in GitHub Desktop.
Save kronos/340271 to your computer and use it in GitHub Desktop.
it "return the basename for edge cases" do
File.basename("").should == ""
File.basename(".").should == "."
File.basename("..").should == ".."
platform_is_not :windows do
File.basename("//foo/").should == "foo"
File.basename("//foo//").should == "foo"
end
File.basename("foo/").should == "foo"
File.basename("foo.rb/", '.rb').should == "foo" # new line
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment