Add unit test for source set as a local file path

Signed-off-by: default avatarMikhail Zholobov <legal90@gmail.com>
parent cf3df71e
......@@ -824,6 +824,40 @@ module Omnibus
end
end
end
context "when given source is a local file path" do
let(:source) do
{
file: "../foo.tar.gz",
}
end
context "when relative_path is the same as name" do
let(:rel_path) { "software" }
it "for back-compat, changes fetch_dir" do
subject.send(:fetcher)
expect(subject.project_dir).to eq(File.expand_path("#{Config.source_dir}/software/software"))
end
it "sets the fetcher project_dir to project_dir" do
expect(subject.send(:fetcher).project_dir).to eq(File.expand_path("#{Config.source_dir}/software/software"))
end
end
context "when relative_path is different from name" do
let(:rel_path) { "foo" }
it "ignores back-compat and leaves fetch_dir alone" do
subject.send(:fetcher)
expect(subject.project_dir).to eq(File.expand_path("#{Config.source_dir}/software/foo"))
end
it "sets the fetcher project_dir to project_dir" do
expect(subject.send(:fetcher).project_dir).to eq(File.expand_path("#{Config.source_dir}/software/foo"))
end
end
end
end
describe "#canonicalize_source" do
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment