aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/test/bottle_filename_spec.rb
diff options
context:
space:
mode:
authorMarkus Reiter2017-02-27 18:33:42 +0100
committerMarkus Reiter2017-02-27 18:34:20 +0100
commit6843f820d72cd104a24e1f20086d81f4b48256d9 (patch)
tree587de6bd36f8ff5c181fe1b161f8069cd8be06a9 /Library/Homebrew/test/bottle_filename_spec.rb
parentbb18f5251628059a45f55f1e1fcfcd9819dd4ed1 (diff)
downloadbrew-6843f820d72cd104a24e1f20086d81f4b48256d9.tar.bz2
Convert Bottle::Filename test to spec.
Diffstat (limited to 'Library/Homebrew/test/bottle_filename_spec.rb')
-rw-r--r--Library/Homebrew/test/bottle_filename_spec.rb37
1 files changed, 37 insertions, 0 deletions
diff --git a/Library/Homebrew/test/bottle_filename_spec.rb b/Library/Homebrew/test/bottle_filename_spec.rb
new file mode 100644
index 000000000..89f839dde
--- /dev/null
+++ b/Library/Homebrew/test/bottle_filename_spec.rb
@@ -0,0 +1,37 @@
+require "formula"
+require "software_spec"
+
+describe Bottle::Filename do
+ specify "#prefix" do
+ expect(described_class.new("foo", "1.0", :tag, 0).prefix)
+ .to eq("foo-1.0.tag")
+ end
+
+ specify "#suffix" do
+ expect(described_class.new("foo", "1.0", :tag, 0).suffix)
+ .to eq(".bottle.tar.gz")
+
+ expect(described_class.new("foo", "1.0", :tag, 1).suffix)
+ .to eq(".bottle.1.tar.gz")
+ end
+
+ specify "#to_s and #to_str" do
+ expected = "foo-1.0.tag.bottle.tar.gz"
+
+ expect(described_class.new("foo", "1.0", :tag, 0).to_s)
+ .to eq(expected)
+
+ expect(described_class.new("foo", "1.0", :tag, 0).to_str)
+ .to eq(expected)
+ end
+
+ specify "::create" do
+ f = formula do
+ url "https://example.com/foo.tar.gz"
+ version "1.0"
+ end
+
+ expect(described_class.create(f, :tag, 0).to_s)
+ .to eq("formula_name-1.0.tag.bottle.tar.gz")
+ end
+end