-
Notifications
You must be signed in to change notification settings - Fork 125
/
Copy pathsource_test.rb
41 lines (36 loc) · 1.24 KB
/
source_test.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# frozen_string_literal: true
require "test_helper"
require "tmpdir"
require "fileutils"
describe Licensed::Sources::Source do
let(:config) { Licensed::AppConfiguration.new({ "source_path" => Dir.pwd }) }
let(:source) { TestSource.new(config) }
it "does not include dependency versions in the name identifier by default" do
refute Licensed::Sources::Source.require_matched_dependency_version
end
describe "dependencies" do
it "returns dependencies from the source" do
dep = source.dependencies.first
assert dep
assert dep.name == "dependency"
end
it "does not return ignored dependencies" do
config.ignore("type" => "test", "name" => "dependency")
assert_empty source.dependencies
end
it "adds the dependency's configured additional terms to dependencies" do
Dir.mktmpdir do |dir|
Dir.chdir dir do
config["additional_terms"] = {
TestSource.type => {
TestSource::DEFAULT_DEPENDENCY_NAME => "amendment.txt"
}
}
File.write "amendment.txt", "amendment"
dep = source.dependencies.first
assert_equal [File.join(Dir.pwd, "amendment.txt")], dep.additional_terms
end
end
end
end
end