diff options
Diffstat (limited to 'spec/rubyspec/library/pathname')
-rw-r--r-- | spec/rubyspec/library/pathname/absolute_spec.rb | 23 | ||||
-rw-r--r-- | spec/rubyspec/library/pathname/equal_value_spec.rb | 15 | ||||
-rw-r--r-- | spec/rubyspec/library/pathname/hash_spec.rb | 15 | ||||
-rw-r--r-- | spec/rubyspec/library/pathname/join_spec.rb | 40 | ||||
-rw-r--r-- | spec/rubyspec/library/pathname/new_spec.rb | 28 | ||||
-rw-r--r-- | spec/rubyspec/library/pathname/parent_spec.rb | 19 | ||||
-rw-r--r-- | spec/rubyspec/library/pathname/realdirpath_spec.rb | 10 | ||||
-rw-r--r-- | spec/rubyspec/library/pathname/realpath_spec.rb | 10 | ||||
-rw-r--r-- | spec/rubyspec/library/pathname/relative_path_from_spec.rb | 51 | ||||
-rw-r--r-- | spec/rubyspec/library/pathname/relative_spec.rb | 23 | ||||
-rw-r--r-- | spec/rubyspec/library/pathname/root_spec.rb | 27 | ||||
-rw-r--r-- | spec/rubyspec/library/pathname/sub_spec.rb | 16 |
12 files changed, 0 insertions, 277 deletions
diff --git a/spec/rubyspec/library/pathname/absolute_spec.rb b/spec/rubyspec/library/pathname/absolute_spec.rb deleted file mode 100644 index af0639493a..0000000000 --- a/spec/rubyspec/library/pathname/absolute_spec.rb +++ /dev/null @@ -1,23 +0,0 @@ -require File.expand_path('../../../spec_helper', __FILE__) -require 'pathname' - -describe "Pathname#absolute?" do - - it "returns true for the root directory" do - Pathname.new('/').absolute?.should == true - end - - it "returns true for a dir starting with a slash" do - Pathname.new('/usr/local/bin').absolute?.should == true - end - - it "returns false for a dir not starting with a slash" do - Pathname.new('fish').absolute?.should == false - end - - it "returns false for a dir not starting with a slash" do - Pathname.new('fish/dog/cow').absolute?.should == false - end - -end - diff --git a/spec/rubyspec/library/pathname/equal_value_spec.rb b/spec/rubyspec/library/pathname/equal_value_spec.rb deleted file mode 100644 index afcdb08de8..0000000000 --- a/spec/rubyspec/library/pathname/equal_value_spec.rb +++ /dev/null @@ -1,15 +0,0 @@ -require File.expand_path('../../../spec_helper', __FILE__) -require 'pathname' - -describe "Pathname#==" do - - it "returns true when identical paths are used" do - (Pathname.new('') == Pathname.new('')).should == true - end - - it "returns true when identical paths are used" do - (Pathname.new('') == Pathname.new('/usr/local/bin')).should == false - end - -end - diff --git a/spec/rubyspec/library/pathname/hash_spec.rb b/spec/rubyspec/library/pathname/hash_spec.rb deleted file mode 100644 index f3201e2f4f..0000000000 --- a/spec/rubyspec/library/pathname/hash_spec.rb +++ /dev/null @@ -1,15 +0,0 @@ -require File.expand_path('../../../spec_helper', __FILE__) -require 'pathname' - -describe "Pathname#hash" do - - it "is equal to the hash of the pathname" do - Pathname.new('/usr/local/bin/').hash.should == '/usr/local/bin/'.hash - end - - it "is not equal the hash of a different pathname" do - Pathname.new('/usr/local/bin/').hash.should_not == '/usr/bin/'.hash - end - -end - diff --git a/spec/rubyspec/library/pathname/join_spec.rb b/spec/rubyspec/library/pathname/join_spec.rb deleted file mode 100644 index 8c77bb1f59..0000000000 --- a/spec/rubyspec/library/pathname/join_spec.rb +++ /dev/null @@ -1,40 +0,0 @@ -require File.expand_path('../../../spec_helper', __FILE__) -require 'pathname' - -describe "Pathname#join" do - it "without separators" do - Pathname.new('/usr').join(Pathname.new('foo')).should == Pathname.new('/usr/foo') - end - - it "with separators" do - Pathname.new('/usr').join(Pathname.new('/foo')).should == Pathname.new('/foo') - end - - it "with a string" do - Pathname.new('/usr').join('foo').should == Pathname.new('/usr/foo') - end - - it "with root" do - Pathname.new('/usr').join(Pathname.new('/')).should == Pathname.new('/') - end - - it "with a relative path" do - Pathname.new('/usr').join(Pathname.new('../foo')).should == Pathname.new('/foo') - end - - it "a relative path with current" do - Pathname.new('.').join(Pathname.new('foo')).should == Pathname.new('foo') - end - - it "an absolute path with current" do - Pathname.new('.').join(Pathname.new('/foo')).should == Pathname.new('/foo') - end - - it "a prefixed relative path with current" do - Pathname.new('.').join(Pathname.new('./foo')).should == Pathname.new('foo') - end - - it "multiple paths" do - Pathname.new('.').join(Pathname.new('./foo'), 'bar').should == Pathname.new('foo/bar') - end -end diff --git a/spec/rubyspec/library/pathname/new_spec.rb b/spec/rubyspec/library/pathname/new_spec.rb deleted file mode 100644 index a888e98736..0000000000 --- a/spec/rubyspec/library/pathname/new_spec.rb +++ /dev/null @@ -1,28 +0,0 @@ -require File.expand_path('../../../spec_helper', __FILE__) -require 'pathname' - -describe "Pathname.new" do - it "returns a new Pathname Object with 1 argument" do - Pathname.new('').should be_kind_of(Pathname) - end - - it "raises an ArgumentError when called with \0" do - lambda { Pathname.new("\0")}.should raise_error(ArgumentError) - end - - it "is tainted if path is tainted" do - path = '/usr/local/bin'.taint - Pathname.new(path).tainted?.should == true - end - - it "raises a TypeError if not passed a String type" do - lambda { Pathname.new(nil) }.should raise_error(TypeError) - lambda { Pathname.new(0) }.should raise_error(TypeError) - lambda { Pathname.new(true) }.should raise_error(TypeError) - lambda { Pathname.new(false) }.should raise_error(TypeError) - end - - it "initializes with an object with to_path" do - Pathname.new(mock_to_path('foo')).should == Pathname.new('foo') - end -end diff --git a/spec/rubyspec/library/pathname/parent_spec.rb b/spec/rubyspec/library/pathname/parent_spec.rb deleted file mode 100644 index 53d3f1e50e..0000000000 --- a/spec/rubyspec/library/pathname/parent_spec.rb +++ /dev/null @@ -1,19 +0,0 @@ -require File.expand_path('../../../spec_helper', __FILE__) -require 'pathname' - -describe "Pathname#parent" do - - it "has parent of root as root" do - Pathname.new('/').parent.to_s.should == '/' - end - - it "has parent of /usr/ as root" do - Pathname.new('/usr/').parent.to_s.should == '/' - end - - it "has parent of /usr/local as root" do - Pathname.new('/usr/local').parent.to_s.should == '/usr' - end - -end - diff --git a/spec/rubyspec/library/pathname/realdirpath_spec.rb b/spec/rubyspec/library/pathname/realdirpath_spec.rb deleted file mode 100644 index f76e37602c..0000000000 --- a/spec/rubyspec/library/pathname/realdirpath_spec.rb +++ /dev/null @@ -1,10 +0,0 @@ -require File.expand_path('../../../spec_helper', __FILE__) -require 'pathname' - -describe "Pathname#realdirpath" do - - it "returns a Pathname" do - Pathname.pwd.realdirpath.should be_an_instance_of(Pathname) - end - -end diff --git a/spec/rubyspec/library/pathname/realpath_spec.rb b/spec/rubyspec/library/pathname/realpath_spec.rb deleted file mode 100644 index e1c9eb34ea..0000000000 --- a/spec/rubyspec/library/pathname/realpath_spec.rb +++ /dev/null @@ -1,10 +0,0 @@ -require File.expand_path('../../../spec_helper', __FILE__) -require 'pathname' - -describe "Pathname#realpath" do - - it "returns a Pathname" do - Pathname.pwd.realpath.should be_an_instance_of(Pathname) - end - -end diff --git a/spec/rubyspec/library/pathname/relative_path_from_spec.rb b/spec/rubyspec/library/pathname/relative_path_from_spec.rb deleted file mode 100644 index b3bc85e307..0000000000 --- a/spec/rubyspec/library/pathname/relative_path_from_spec.rb +++ /dev/null @@ -1,51 +0,0 @@ -require File.expand_path('../../../spec_helper', __FILE__) -require 'pathname' - -describe "Pathname#relative_path_from" do - def relative_path_str(dest, base) - Pathname.new(dest).relative_path_from(Pathname.new(base)).to_s - end - - it "raises an error when the two paths do not share a common prefix" do - lambda { relative_path_str('/usr', 'foo') }.should raise_error(ArgumentError) - end - - it "raises an error when the base directory has .." do - lambda { relative_path_str('a', '..') }.should raise_error(ArgumentError) - end - - it "retuns a path relative from root" do - relative_path_str('/usr', '/').should == 'usr' - end - - it 'returns 1 level up when both paths are relative' do - relative_path_str('a', 'b').should == '../a' - relative_path_str('a', 'b/').should == '../a' - end - - it 'returns a relative path when both are absolute' do - relative_path_str('/a', '/b').should == '../a' - end - - it "returns a path relative to the current directory" do - relative_path_str('/usr/bin/ls', '/usr').should == 'bin/ls' - end - - it 'returns a . when base and dest are the same' do - relative_path_str('/usr', '/usr').should == '.' - end - - it 'returns the same directory with a non clean base that matches the current dir' do - relative_path_str('/usr', '/stuff/..').should == 'usr' - end - - it 'returns a relative path with a non clean base that matches a different dir' do - relative_path_str('/usr', '/stuff/../foo').should == '../usr' - end - - it 'returns current and pattern when only those patterns are used' do - relative_path_str('.', '.').should == '.' - relative_path_str('..', '..').should == '.' - relative_path_str('..', '.').should == '..' - end -end diff --git a/spec/rubyspec/library/pathname/relative_spec.rb b/spec/rubyspec/library/pathname/relative_spec.rb deleted file mode 100644 index a44d8c5a66..0000000000 --- a/spec/rubyspec/library/pathname/relative_spec.rb +++ /dev/null @@ -1,23 +0,0 @@ -require File.expand_path('../../../spec_helper', __FILE__) -require 'pathname' - -describe "Pathname#relative?" do - - it "returns false for the root directory" do - Pathname.new('/').relative?.should == false - end - - it "returns false for a dir starting with a slash" do - Pathname.new('/usr/local/bin').relative?.should == false - end - - it "returns true for a dir not starting with a slash" do - Pathname.new('fish').relative?.should == true - end - - it "returns true for a dir not starting with a slash" do - Pathname.new('fish/dog/cow').relative?.should == true - end - -end - diff --git a/spec/rubyspec/library/pathname/root_spec.rb b/spec/rubyspec/library/pathname/root_spec.rb deleted file mode 100644 index a5efcf69b4..0000000000 --- a/spec/rubyspec/library/pathname/root_spec.rb +++ /dev/null @@ -1,27 +0,0 @@ -require File.expand_path('../../../spec_helper', __FILE__) -require 'pathname' - -describe "Pathname#root?" do - - it "returns true for root directories" do - Pathname.new('/').root?.should == true - end - - it "returns false for empty string" do - Pathname.new('').root?.should == false - end - - it "returns false for a top level directory" do - Pathname.new('/usr').root?.should == false - end - - it "returns false for a top level with .. appended directory" do - Pathname.new('/usr/..').root?.should == false - end - - it "returns false for a directory below top level" do - Pathname.new('/usr/local/bin/').root?.should == false - end - -end - diff --git a/spec/rubyspec/library/pathname/sub_spec.rb b/spec/rubyspec/library/pathname/sub_spec.rb deleted file mode 100644 index 36b6ebb247..0000000000 --- a/spec/rubyspec/library/pathname/sub_spec.rb +++ /dev/null @@ -1,16 +0,0 @@ -require File.expand_path('../../../spec_helper', __FILE__) -require 'pathname' - -describe "Pathname#sub" do - - it "replaces the pattern with rest" do - Pathname.new('/usr/local/bin/').sub(/local/, 'fish').to_s.should == '/usr/fish/bin/' - end - - it "returns a new object" do - p = Pathname.new('/usr/local/bin/') - p.sub(/local/, 'fish').should_not == p - end - -end - |