implement Pathname#join() interface for Filepath.
This commit is contained in:
parent
a8b638daf2
commit
40b754190e
|
@ -16,6 +16,10 @@ module Jenkins
|
|||
FilePath.new(@native.child(name))
|
||||
end
|
||||
|
||||
def join(*names)
|
||||
FilePath.new names.inject(@native) {|native, name| native.child(name) }
|
||||
end
|
||||
|
||||
def to_s
|
||||
@native.getRemote()
|
||||
end
|
||||
|
|
|
@ -17,6 +17,12 @@ describe Jenkins::FilePath do
|
|||
(create(".") + "foo" + "bar").to_s.should == "foo/bar"
|
||||
end
|
||||
|
||||
it "returns child for join" do
|
||||
create('.').join('foo').to_s.should == "foo"
|
||||
create('.').join('foo', 'bar').to_s.should == "foo/bar"
|
||||
create('.').join('foo', 'bar', 'baz').to_s.should == "foo/bar/baz"
|
||||
end
|
||||
|
||||
it "returns path for to_s" do
|
||||
create(".").to_s.should == "."
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue