Convert Bottle::Filename test to spec.
This commit is contained in:
parent
bb18f52516
commit
6843f820d7
37
Library/Homebrew/test/bottle_filename_spec.rb
Normal file
37
Library/Homebrew/test/bottle_filename_spec.rb
Normal file
@ -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
|
||||
@ -1,31 +0,0 @@
|
||||
require "testing_env"
|
||||
require "formula"
|
||||
require "software_spec"
|
||||
|
||||
class BottleFilenameTests < Homebrew::TestCase
|
||||
def fn(rebuild)
|
||||
Bottle::Filename.new("foo", "1.0", :tag, rebuild)
|
||||
end
|
||||
|
||||
def test_prefix_suffix
|
||||
assert_equal "foo-1.0.tag", fn(0).prefix
|
||||
assert_equal ".bottle.tar.gz", fn(0).suffix
|
||||
assert_equal ".bottle.1.tar.gz", fn(1).suffix
|
||||
end
|
||||
|
||||
def test_to_str
|
||||
expected = "foo-1.0.tag.bottle.tar.gz"
|
||||
assert_equal expected, fn(0).to_s
|
||||
assert_equal expected, fn(0).to_str
|
||||
end
|
||||
|
||||
def test_create
|
||||
f = formula do
|
||||
url "https://example.com/foo.tar.gz"
|
||||
version "1.0"
|
||||
end
|
||||
|
||||
expected = "formula_name-1.0.tag.bottle.tar.gz"
|
||||
assert_equal expected, Bottle::Filename.create(f, :tag, 0).to_s
|
||||
end
|
||||
end
|
||||
Loading…
x
Reference in New Issue
Block a user