brew/Library/Homebrew/test/formula_spec_selection_spec.rb
Mike McQuaid 22857b56b9
formula: deprecate devel blocks.
As we haven't released 2.3.1 I think we can get away with sneaking this
in. I'm also prepared to back this out if it's too widely used and
there's too much backlash.
2020-06-05 09:22:49 +01:00

64 lines
1.2 KiB
Ruby

# frozen_string_literal: true
require "formula"
describe Formula do
describe "::new" do
it "selects stable by default" do
f = formula do
url "foo-1.0"
head "foo"
end
expect(f).to be_stable
end
it "selects stable when exclusive" do
f = formula { url "foo-1.0" }
expect(f).to be_stable
end
it "selects HEAD when exclusive" do
f = formula { head "foo" }
expect(f).to be_head
end
it "does not select an incomplete spec" do
f = formula do
sha256 TEST_SHA256
version "1.0"
head "foo"
end
expect(f).to be_head
end
it "does not set an incomplete stable spec" do
f = formula do
sha256 TEST_SHA256
head "foo"
end
expect(f.stable).to be nil
expect(f).to be_head
end
it "selects HEAD when requested" do
f = formula("test", spec: :head) do
url "foo-1.0"
head "foo"
end
expect(f).to be_head
end
it "does not raise an error for a missing spec" do
f = formula("test", spec: :head) do
url "foo-1.0"
end
expect(f).to be_stable
end
end
end