diff options
Diffstat (limited to 'spec/ruby/library/pathname/root_spec.rb')
| -rw-r--r-- | spec/ruby/library/pathname/root_spec.rb | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/spec/ruby/library/pathname/root_spec.rb b/spec/ruby/library/pathname/root_spec.rb new file mode 100644 index 0000000000..cd2be24516 --- /dev/null +++ b/spec/ruby/library/pathname/root_spec.rb @@ -0,0 +1,26 @@ +require_relative '../../spec_helper' +require 'pathname' + +describe "Pathname#root?" do + + it "returns true for root directories" do + Pathname.new('/').should.root? + end + + it "returns false for empty string" do + Pathname.new('').should_not.root? + end + + it "returns false for a top level directory" do + Pathname.new('/usr').should_not.root? + end + + it "returns false for a top level with .. appended directory" do + Pathname.new('/usr/..').should_not.root? + end + + it "returns false for a directory below top level" do + Pathname.new('/usr/local/bin/').should_not.root? + end + +end |
