diff options
| author | Mike McQuaid | 2018-02-21 14:31:24 +0000 |
|---|---|---|
| committer | GitHub | 2018-02-21 14:31:24 +0000 |
| commit | 1811c77ec6b0441ded02046ada98f2080debeec3 (patch) | |
| tree | 9c28be1723fe883506f1c95ef3cf4ec9443c8dfe /Library/Homebrew/test/os/linux | |
| parent | 09c5be86b615de6ed36bb2163eb98a0cb3c7cb43 (diff) | |
| parent | f8874004c2c0ee06b3f0420ac549f762beeb3433 (diff) | |
| download | brew-1811c77ec6b0441ded02046ada98f2080debeec3.tar.bz2 | |
Merge pull request #3813 from maxim-belkin/brew-unix-2
bzip2 and zip dependencies_if_needed
Diffstat (limited to 'Library/Homebrew/test/os/linux')
| -rw-r--r-- | Library/Homebrew/test/os/linux/dependency_collector_spec.rb | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/Library/Homebrew/test/os/linux/dependency_collector_spec.rb b/Library/Homebrew/test/os/linux/dependency_collector_spec.rb new file mode 100644 index 000000000..543ed39b0 --- /dev/null +++ b/Library/Homebrew/test/os/linux/dependency_collector_spec.rb @@ -0,0 +1,53 @@ +require "dependency_collector" + +describe DependencyCollector do + alias_matcher :be_a_build_requirement, :be_build + + after(:each) do + described_class.clear_cache + end + + describe "#add" do + resource = Resource.new + + context "when xz, zip, and bzip2 are not available" do + it "creates a resource dependency from a '.xz' URL" do + resource.url("http://example.com/foo.xz") + allow_any_instance_of(Object).to receive(:which).with("xz") + expect(subject.add(resource)).to eq(Dependency.new("xz", [:build])) + end + + it "creates a resource dependency from a '.zip' URL" do + resource.url("http://example.com/foo.zip") + allow_any_instance_of(Object).to receive(:which).with("zip") + expect(subject.add(resource)).to eq(Dependency.new("zip", [:build])) + end + + it "creates a resource dependency from a '.bz2' URL" do + resource.url("http://example.com/foo.tar.bz2") + allow_any_instance_of(Object).to receive(:which).with("bzip2") + expect(subject.add(resource)).to eq(Dependency.new("bzip2", [:build])) + end + end + + context "when xz, zip, and bzip2 are available" do + it "does not create a resource dependency from a '.xz' URL" do + resource.url("http://example.com/foo.xz") + allow_any_instance_of(Object).to receive(:which).with("xz").and_return(Pathname.new("foo")) + expect(subject.add(resource)).to be nil + end + + it "does not create a resource dependency from a '.zip' URL" do + resource.url("http://example.com/foo.zip") + allow_any_instance_of(Object).to receive(:which).with("zip").and_return(Pathname.new("foo")) + expect(subject.add(resource)).to be nil + end + + it "does not create a resource dependency from a '.bz2' URL" do + resource.url("http://example.com/foo.tar.bz2") + allow_any_instance_of(Object).to receive(:which).with("bzip2").and_return(Pathname.new("foo")) + expect(subject.add(resource)).to be nil + end + end + end +end |
