Skip to content

Commit e116ba1

Browse files
authored
Merge pull request #1998 from reitermarkus/spec-bottle-collector
Convert Utils::Bottles::Collector test to spec.
2 parents 1f5e91d + 1cbec60 commit e116ba1

File tree

2 files changed

+31
-39
lines changed

2 files changed

+31
-39
lines changed

Library/Homebrew/test/bottle_collector_test.rb

Lines changed: 0 additions & 39 deletions
This file was deleted.
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
require "utils/bottles"
2+
3+
describe Utils::Bottles::Collector do
4+
describe "#fetch_checksum_for" do
5+
it "returns passed tags" do
6+
subject[:lion] = "foo"
7+
subject[:mountain_lion] = "bar"
8+
expect(subject.fetch_checksum_for(:mountain_lion)).to eq(["bar", :mountain_lion])
9+
end
10+
11+
it "returns nil if empty" do
12+
expect(subject.fetch_checksum_for(:foo)).to be nil
13+
end
14+
15+
it "returns nil when there is no match" do
16+
subject[:lion] = "foo"
17+
expect(subject.fetch_checksum_for(:foo)).to be nil
18+
end
19+
20+
it "returns nil when there is no match and later tag is present" do
21+
subject[:lion_or_later] = "foo"
22+
expect(subject.fetch_checksum_for(:foo)).to be nil
23+
end
24+
25+
it "prefers exact matches" do
26+
subject[:lion_or_later] = "foo"
27+
subject[:mountain_lion] = "bar"
28+
expect(subject.fetch_checksum_for(:mountain_lion)).to eq(["bar", :mountain_lion])
29+
end
30+
end
31+
end

0 commit comments

Comments
 (0)