add Util specs
This commit is contained in:
parent
36643c1ab1
commit
cd2696dd0b
31
spec/rscons/util_spec.rb
Normal file
31
spec/rscons/util_spec.rb
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
module Rscons
|
||||||
|
describe Util do
|
||||||
|
|
||||||
|
describe ".make_relative_path" do
|
||||||
|
context "when passed a relative path" do
|
||||||
|
it "returns the path itself" do
|
||||||
|
expect(Util.make_relative_path("foo/bar")).to eq "foo/bar"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context "when passed an absolute path" do
|
||||||
|
before(:each) do
|
||||||
|
expect(Rscons).to receive(:absolute_path?).and_return(true)
|
||||||
|
end
|
||||||
|
|
||||||
|
context "on Windows" do
|
||||||
|
it "returns a relative path corresponding to an absolute one" do
|
||||||
|
expect(Util.make_relative_path("D:/foo/bar")).to eq "_D/foo/bar"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context "on POSIX" do
|
||||||
|
it "returns a relative path corresponding to an absolute one" do
|
||||||
|
expect(Util.make_relative_path("/foo/bar")).to eq "_/foo/bar"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
Loading…
x
Reference in New Issue
Block a user