Skip to content

Commit

Permalink
Add unit test for source set as a local file path
Browse files Browse the repository at this point in the history
Signed-off-by: Mikhail Zholobov <[email protected]>
  • Loading branch information
legal90 committed Jan 25, 2018
1 parent c045c74 commit e29f467
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions spec/unit/software_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit e29f467

Please sign in to comment.