summaryrefslogtreecommitdiff
path: root/spec/ruby/library/pathname/relative_path_from_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/library/pathname/relative_path_from_spec.rb')
-rw-r--r--spec/ruby/library/pathname/relative_path_from_spec.rb10
1 files changed, 7 insertions, 3 deletions
diff --git a/spec/ruby/library/pathname/relative_path_from_spec.rb b/spec/ruby/library/pathname/relative_path_from_spec.rb
index 416eaa1a50..7cbd22c3d6 100644
--- a/spec/ruby/library/pathname/relative_path_from_spec.rb
+++ b/spec/ruby/library/pathname/relative_path_from_spec.rb
@@ -1,4 +1,4 @@
-require File.expand_path('../../../spec_helper', __FILE__)
+require_relative '../../spec_helper'
require 'pathname'
describe "Pathname#relative_path_from" do
@@ -7,11 +7,11 @@ describe "Pathname#relative_path_from" do
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)
+ -> { relative_path_str('/usr', 'foo') }.should.raise(ArgumentError)
end
it "raises an error when the base directory has .." do
- lambda { relative_path_str('a', '..') }.should raise_error(ArgumentError)
+ -> { relative_path_str('a', '..') }.should.raise(ArgumentError)
end
it "returns a path relative from root" do
@@ -48,4 +48,8 @@ describe "Pathname#relative_path_from" do
relative_path_str('..', '..').should == '.'
relative_path_str('..', '.').should == '..'
end
+
+ it 'converts string argument to Pathname' do
+ Pathname.new('/usr/bin/ls').relative_path_from('/usr').to_s.should == 'bin/ls'
+ end
end