Merge pull request #7123 from dawidd6/resource-build-and-test

dependency_collector: make resource dep available at test-time too
This commit is contained in:
Mike McQuaid 2020-03-05 09:29:17 +00:00 committed by GitHub
commit 677e6c972a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 10 deletions

View File

@ -142,7 +142,7 @@ class DependencyCollector
end
def resource_dep(spec, tags)
tags << :build
tags << :build << :test
strategy = spec.download_strategy
if strategy <= CurlDownloadStrategy

View File

@ -62,13 +62,13 @@ describe DependencyCollector do
it "creates a resource dependency from a CVS URL" do
resource = Resource.new
resource.url(":pserver:anonymous:@brew.sh:/cvsroot/foo/bar", using: :cvs)
expect(subject.add(resource)).to eq(Dependency.new("cvs", [:build]))
expect(subject.add(resource)).to eq(Dependency.new("cvs", [:build, :test]))
end
it "creates a resource dependency from a '.7z' URL" do
resource = Resource.new
resource.url("https://brew.sh/foo.7z")
expect(subject.add(resource)).to eq(Dependency.new("p7zip", [:build]))
expect(subject.add(resource)).to eq(Dependency.new("p7zip", [:build, :test]))
end
it "creates a resource dependency from a '.gz' URL" do
@ -80,25 +80,25 @@ describe DependencyCollector do
it "creates a resource dependency from a '.lz' URL" do
resource = Resource.new
resource.url("https://brew.sh/foo.lz")
expect(subject.add(resource)).to eq(Dependency.new("lzip", [:build]))
expect(subject.add(resource)).to eq(Dependency.new("lzip", [:build, :test]))
end
it "creates a resource dependency from a '.lha' URL" do
resource = Resource.new
resource.url("https://brew.sh/foo.lha")
expect(subject.add(resource)).to eq(Dependency.new("lha", [:build]))
expect(subject.add(resource)).to eq(Dependency.new("lha", [:build, :test]))
end
it "creates a resource dependency from a '.lzh' URL" do
resource = Resource.new
resource.url("https://brew.sh/foo.lzh")
expect(subject.add(resource)).to eq(Dependency.new("lha", [:build]))
expect(subject.add(resource)).to eq(Dependency.new("lha", [:build, :test]))
end
it "creates a resource dependency from a '.rar' URL" do
resource = Resource.new
resource.url("https://brew.sh/foo.rar")
expect(subject.add(resource)).to eq(Dependency.new("unrar", [:build]))
expect(subject.add(resource)).to eq(Dependency.new("unrar", [:build, :test]))
end
it "raises a TypeError for unknown classes" do

View File

@ -12,19 +12,19 @@ describe DependencyCollector do
it "creates a resource dependency from a '.xz' URL" do
resource.url("https://brew.sh/foo.xz")
allow_any_instance_of(Object).to receive(:which).with("xz")
expect(subject.add(resource)).to eq(Dependency.new("xz", [:build]))
expect(subject.add(resource)).to eq(Dependency.new("xz", [:build, :test]))
end
it "creates a resource dependency from a '.zip' URL" do
resource.url("https://brew.sh/foo.zip")
allow_any_instance_of(Object).to receive(:which).with("unzip")
expect(subject.add(resource)).to eq(Dependency.new("unzip", [:build]))
expect(subject.add(resource)).to eq(Dependency.new("unzip", [:build, :test]))
end
it "creates a resource dependency from a '.bz2' URL" do
resource.url("https://brew.sh/foo.tar.bz2")
allow_any_instance_of(Object).to receive(:which).with("bzip2")
expect(subject.add(resource)).to eq(Dependency.new("bzip2", [:build]))
expect(subject.add(resource)).to eq(Dependency.new("bzip2", [:build, :test]))
end
end