aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/test/bottle_filename_spec.rb
blob: 89f839ddecb7fbd2e0f5b63b7258562c88641450 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
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