diff options
| author | Markus Reiter | 2017-02-27 14:58:57 +0100 |
|---|---|---|
| committer | Markus Reiter | 2017-02-27 14:58:57 +0100 |
| commit | c6784f606f5c1116ecc7c8351b5995d0ac0735f0 (patch) | |
| tree | e3210d92a6c97b47bbc6a8cbc3ecf9dd4b9a37e0 /Library/Homebrew/test/formula_spec_selection_spec.rb | |
| parent | 0dfe85df1376097ae966f6d710df716ad9a38ff2 (diff) | |
| download | brew-c6784f606f5c1116ecc7c8351b5995d0ac0735f0.tar.bz2 | |
Convert formula_spec_selection test to spec.
Diffstat (limited to 'Library/Homebrew/test/formula_spec_selection_spec.rb')
| -rw-r--r-- | Library/Homebrew/test/formula_spec_selection_spec.rb | 100 |
1 files changed, 100 insertions, 0 deletions
diff --git a/Library/Homebrew/test/formula_spec_selection_spec.rb b/Library/Homebrew/test/formula_spec_selection_spec.rb new file mode 100644 index 000000000..20231ffda --- /dev/null +++ b/Library/Homebrew/test/formula_spec_selection_spec.rb @@ -0,0 +1,100 @@ +require "formula" + +describe Formula do + describe "::new" do + it "selects stable by default" do + f = formula do + url "foo-1.0" + devel { url "foo-1.1a" } + 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 devel before HEAD" do + f = formula do + devel { url "foo-1.1a" } + head "foo" + end + + expect(f).to be_devel + end + + it "selects devel when exclusive" do + f = formula { devel { url "foo-1.1a" } } + expect(f).to be_devel + 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 + devel { url "foo-1.1a" } + head "foo" + end + + expect(f.stable).to be nil + expect(f).to be_devel + end + + it "selects HEAD when requested" do + f = formula("test", spec: :head) do + url "foo-1.0" + devel { url "foo-1.1a" } + head "foo" + end + + expect(f).to be_head + end + + it "selects devel when requested" do + f = formula("test", spec: :devel) do + url "foo-1.0" + devel { url "foo-1.1a" } + head "foo" + end + + expect(f).to be_devel + end + + it "does not set an incomplete devel spec" do + f = formula do + url "foo-1.0" + devel { version "1.1a" } + head "foo" + end + + expect(f.devel).to be nil + expect(f).to be_stable + end + + it "does not raise an error for a missing spec" do + f = formula("test", spec: :devel) do + url "foo-1.0" + head "foo" + end + + expect(f).to be_stable + end + end +end |
