blob: 20231ffda2729cd218693660362aba66584088bc (
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
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
 |