aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/test/utils
diff options
context:
space:
mode:
authorMarkus Reiter2017-02-12 21:37:46 +0100
committerMarkus Reiter2017-02-12 21:37:46 +0100
commit1cbec60829b76cab10067ae0ee535a2eb94838c1 (patch)
tree9205389c51453caf24d2ea62559ec0cda7f6ded4 /Library/Homebrew/test/utils
parent93724c0645f59ccdb4b4bf34f701957bacb5e45a (diff)
downloadbrew-1cbec60829b76cab10067ae0ee535a2eb94838c1.tar.bz2
Convert Utils::Bottles::Collector test to spec.
Diffstat (limited to 'Library/Homebrew/test/utils')
-rw-r--r--Library/Homebrew/test/utils/bottles/collector_spec.rb31
1 files changed, 31 insertions, 0 deletions
diff --git a/Library/Homebrew/test/utils/bottles/collector_spec.rb b/Library/Homebrew/test/utils/bottles/collector_spec.rb
new file mode 100644
index 000000000..73757234e
--- /dev/null
+++ b/Library/Homebrew/test/utils/bottles/collector_spec.rb
@@ -0,0 +1,31 @@
+require "utils/bottles"
+
+describe Utils::Bottles::Collector do
+ describe "#fetch_checksum_for" do
+ it "returns passed tags" do
+ subject[:lion] = "foo"
+ subject[:mountain_lion] = "bar"
+ expect(subject.fetch_checksum_for(:mountain_lion)).to eq(["bar", :mountain_lion])
+ end
+
+ it "returns nil if empty" do
+ expect(subject.fetch_checksum_for(:foo)).to be nil
+ end
+
+ it "returns nil when there is no match" do
+ subject[:lion] = "foo"
+ expect(subject.fetch_checksum_for(:foo)).to be nil
+ end
+
+ it "returns nil when there is no match and later tag is present" do
+ subject[:lion_or_later] = "foo"
+ expect(subject.fetch_checksum_for(:foo)).to be nil
+ end
+
+ it "prefers exact matches" do
+ subject[:lion_or_later] = "foo"
+ subject[:mountain_lion] = "bar"
+ expect(subject.fetch_checksum_for(:mountain_lion)).to eq(["bar", :mountain_lion])
+ end
+ end
+end