gravitheque 0.4.0 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,257 +0,0 @@
1
- require "./test/test_helper"
2
- require "calculators/hops"
3
-
4
- describe Calculate do
5
-
6
- it "must calculate the boil time adjustment" do
7
- (Calculate.hop_boil_time_adjustment 60).must_equal 0.91
8
- end
9
-
10
- it "must calculate the extract adjustment from Plato" do
11
- (Calculate.hop_extract_adjustment 14).must_equal 0.99
12
- end
13
-
14
- it "must calculate the extract adjustment from Brix" do
15
- (Calculate.hop_extract_adjustment 16, :brix).must_equal 0.91
16
- end
17
-
18
- it "must calculate the extract adjustment from specific gravity" do
19
- (Calculate.hop_extract_adjustment 1.055, :specific_gravity).must_equal 1.01
20
- end
21
-
22
- it "must calculate hop utilization from Plato" do
23
- Calculate.hop_utilization({
24
- at: 60,
25
- extract: 15
26
- }).must_equal 0.21
27
- end
28
-
29
- it "must calculate hop utilization from Brix" do
30
- Calculate.hop_utilization({
31
- at: 30,
32
- extract: 12
33
- }, :brix).must_equal 0.18
34
- end
35
-
36
- it "must calculate hop utilization from specific gravity" do
37
- Calculate.hop_utilization({
38
- at: 10,
39
- extract: 1.065
40
- }, :specific_gravity).must_equal 0.07
41
- end
42
-
43
- it "must calculate IBUs from hop addition using Plato" do
44
- Calculate.ibus({
45
- extract: 12.3,
46
- at: 60,
47
- alpha: 5.0,
48
- mass: 56,
49
- volume: 19
50
- }).must_equal 34
51
- end
52
-
53
- it "must calculate IBUs from hop addition using ounces" do
54
- Calculate.ibus({
55
- extract: 12.3,
56
- at: 60,
57
- alpha: 5.0,
58
- mass: 2,
59
- volume: 19
60
- }, { mass: :ounces }).must_equal 34
61
- end
62
-
63
- it "must calculate IBUs from hop addition using gallons" do
64
- Calculate.ibus({
65
- extract: 12.3,
66
- at: 60,
67
- alpha: 5.0,
68
- mass: 56,
69
- volume: 5
70
- }, { volume: :gallons }).must_equal 34
71
- end
72
-
73
- it "must calculate IBUs from hop addition using Brix" do
74
- Calculate.ibus({
75
- extract: 12.2,
76
- at: 60,
77
- alpha: 5.0,
78
- mass: 56,
79
- volume: 19
80
- }, { extract: :brix }).must_equal 34
81
- end
82
-
83
- it "must calculate IBUs from hop addition using specific gravity" do
84
- Calculate.ibus({
85
- extract: 1.05,
86
- at: 60,
87
- alpha: 5.0,
88
- mass: 56,
89
- volume: 19
90
- }, { extract: :specific_gravity }).must_equal 34
91
- end
92
-
93
- it "must calculate hop mass required for a specific IBU contribution using specific gravity" do
94
- Calculate.hop_mass_required({
95
- extract: 1.05,
96
- at: 60,
97
- alpha: 5.0,
98
- ibus: 34,
99
- volume: 19
100
- }, { extract: :specific_gravity }).must_equal 56
101
- end
102
-
103
- it "must calculate hop mass required for a specific IBU contribution using Plato" do
104
- Calculate.hop_mass_required({
105
- extract: 12.3,
106
- at: 60,
107
- alpha: 5.0,
108
- ibus: 34,
109
- volume: 19
110
- }).must_equal 56
111
- end
112
-
113
- it "must calculate hop mass required for a specific IBU contribution using Brix" do
114
- Calculate.hop_mass_required({
115
- extract: 12.2,
116
- at: 60,
117
- alpha: 5.0,
118
- ibus: 34,
119
- volume: 19
120
- }, { extract: :brix }).must_equal 56
121
- end
122
-
123
- it "must calculate hop mass required for a specific IBU contribution using gallons" do
124
- Calculate.hop_mass_required({
125
- extract: 12.3,
126
- at: 60,
127
- alpha: 5.0,
128
- ibus: 34,
129
- volume: 5
130
- }, { volume: :gallons }).must_equal 56
131
- end
132
-
133
- it "must calculate hop mass required for a specific IBU contribution using ounces" do
134
- Calculate.hop_mass_required({
135
- extract: 12.3,
136
- at: 60,
137
- alpha: 5.0,
138
- ibus: 75,
139
- volume: 5
140
- }, { mass: :ounces }).must_equal 1.2
141
- end
142
-
143
- it "must calculate milliliters of HopShot required for a specific IBU contribution using specific gravity" do
144
- Calculate.hopshot_required({
145
- ibus: 35,
146
- at: 60,
147
- volume: 19,
148
- extract: 1.045
149
- }, { extract: :specific_gravity }).must_equal 3.5
150
-
151
- Calculate.hopshot_required({
152
- ibus: 80,
153
- at: 60,
154
- volume: 38,
155
- extract: 1.085
156
- }, { extract: :specific_gravity }).must_equal 17.6
157
-
158
- Calculate.hopshot_required({
159
- ibus: 80,
160
- at: 60,
161
- volume: 38,
162
- extract: 1.1
163
- }, { extract: :specific_gravity }).must_equal 19.2
164
-
165
- Calculate.hopshot_required({
166
- ibus: 60,
167
- at: 90,
168
- volume: 19,
169
- extract: 1.15
170
- }, { extract: :specific_gravity }).must_equal 7.2
171
- end
172
-
173
- it "must calculate milliliters of HopShot required for a specific IBU contribution using Plato" do
174
- Calculate.hopshot_required({
175
- ibus: 35,
176
- at: 60,
177
- volume: 19,
178
- extract: 12.3
179
- }).must_equal 3.5
180
-
181
- Calculate.hopshot_required({
182
- ibus: 80,
183
- at: 60,
184
- volume: 38,
185
- extract: 20.4
186
- }).must_equal 17.6
187
-
188
- Calculate.hopshot_required({
189
- ibus: 80,
190
- at: 60,
191
- volume: 38,
192
- extract: 23.7
193
- }).must_equal 19.2
194
-
195
- Calculate.hopshot_required({
196
- ibus: 60,
197
- at: 90,
198
- volume: 19,
199
- extract: 34.2
200
- }).must_equal 7.2
201
- end
202
-
203
- it "must calculate milliliters of HopShot required for a specific IBU contribution using Brix" do
204
- Calculate.hopshot_required({
205
- ibus: 35,
206
- at: 60,
207
- volume: 19,
208
- extract: 12.2
209
- }, { extract: :brix }).must_equal 3.5
210
-
211
- Calculate.hopshot_required({
212
- ibus: 80,
213
- at: 60,
214
- volume: 38,
215
- extract: 20.3
216
- }, { extract: :brix }).must_equal 17.6
217
-
218
- Calculate.hopshot_required({
219
- ibus: 80,
220
- at: 60,
221
- volume: 38,
222
- extract: 23.6
223
- }, { extract: :brix }).must_equal 19.2
224
-
225
- Calculate.hopshot_required({
226
- ibus: 60,
227
- at: 90,
228
- volume: 19,
229
- extract: 34.1
230
- }, { extract: :brix }).must_equal 7.2
231
- end
232
-
233
- it "must calculate milliliters of HopShot required for a specific IBU contribution using gallons" do
234
- Calculate.hopshot_required({
235
- ibus: 35,
236
- at: 60,
237
- volume: 5,
238
- extract: 11.2
239
- }, { volume: :gallons }).must_equal 3.5
240
- end
241
-
242
- it "must raise an exception for unrecognized units of measure" do
243
- lambda { Calculate.hop_extract_adjustment 99, :razor_blades }.must_raise ArgumentError
244
- lambda { Calculate.hop_utilization({ at: 18, extract: 90 }, :razor_blades) }.must_raise ArgumentError
245
-
246
- lambda { Calculate.ibus({ extract: 1.05, at: 60, alpha: 5.0, mass: 56, volume: 19 }, { extract: :razor_blades }) }.must_raise ArgumentError
247
- lambda { Calculate.ibus({ extract: 1.05, at: 60, alpha: 5.0, mass: 56, volume: 19 }, { mass: :razor_blades }) }.must_raise ArgumentError
248
- lambda { Calculate.ibus({ extract: 1.05, at: 60, alpha: 5.0, mass: 56, volume: 19 }, { volume: :razor_blades }) }.must_raise ArgumentError
249
-
250
- lambda { Calculate.hop_mass_required({ extract: 1.05, at: 60, alpha: 5.0, ibus: 56, volume: 19 }, { extract: :razor_blades }) }.must_raise ArgumentError
251
- lambda { Calculate.hop_mass_required({ extract: 1.05, at: 60, alpha: 5.0, ibus: 56, volume: 19 }, { volume: :razor_blades }) }.must_raise ArgumentError
252
-
253
- lambda { Calculate.hopshot_required({ extract: 1.05, at: 60, alpha: 5.0, ibus: 56, volume: 19 }, { extract: :razor_blades }) }.must_raise ArgumentError
254
- lambda { Calculate.hopshot_required({ extract: 1.05, at: 60, alpha: 5.0, ibus: 56, volume: 19 }, { volume: :razor_blades }) }.must_raise ArgumentError
255
- end
256
-
257
- end
@@ -1,71 +0,0 @@
1
- require "./test/test_helper"
2
- require "calculators/mash"
3
-
4
- describe Calculate do
5
-
6
- it "must calculate strike temperature using metric measures" do
7
- Calculate.strike_temperature({
8
- ratio: 1.5,
9
- initial: 21,
10
- target: 40
11
- }).must_equal 45
12
- end
13
-
14
- it "must calculate strike temperature using U.S. measures" do
15
- Calculate.strike_temperature({
16
- ratio: 1.5,
17
- initial: 70,
18
- target: 104
19
- }, :us).must_equal 109
20
- end
21
-
22
- it "must allow a loss adjustment when calculating strike temperature" do
23
- Calculate.strike_temperature({
24
- ratio: 1.5,
25
- initial: 60,
26
- target: 150,
27
- loss: 1.015
28
- }, :us).must_equal 164
29
- end
30
-
31
- it "must calculate infusion volume using metric measures" do
32
- Calculate.infusion_volume({
33
- ratio: 1,
34
- initial: 40,
35
- target: 60,
36
- mass: 3.6,
37
- volume: 3.6
38
- }).must_equal 2.5
39
- end
40
-
41
- it "must calculate infusion volume using U.S. measures" do
42
- Calculate.infusion_volume({
43
- ratio: 1,
44
- initial: 104,
45
- target: 140,
46
- mass: 8,
47
- volume: 8
48
- }, :us).must_equal 4.8
49
- end
50
-
51
- it "must raise and exception when given an unknown unit" do
52
- lambda {
53
- Calculate.strike_temperature({
54
- ratio: 1,
55
- initial: 1,
56
- target: 1
57
- }, :imperial)
58
- }.must_raise ArgumentError
59
-
60
- lambda {
61
- Calculate.infusion_volume({
62
- ratio: 1,
63
- initial: 1,
64
- target: 1,
65
- mass: 1,
66
- volume: 1
67
- }, :imperial)
68
- }.must_raise ArgumentError
69
- end
70
-
71
- end
@@ -1,149 +0,0 @@
1
- require "./test/test_helper"
2
- require "calculators/yeast"
3
-
4
- describe Calculate do
5
-
6
- it "must calculate yeast cells needed for an ale" do
7
- Calculate.yeast_cells_required({
8
- extract: 12,
9
- volume: 20
10
- }).must_equal 180_000_000_000
11
- end
12
-
13
- it "must calculate yeast cells needed for a hybrid" do
14
- Calculate.yeast_cells_required({
15
- extract: 12,
16
- volume: 20,
17
- type: :hybrid
18
- }).must_equal 270_000_000_000
19
- end
20
-
21
- it "must calculate yeast cells needed for a lager" do
22
- Calculate.yeast_cells_required({
23
- extract: 12,
24
- volume: 20,
25
- type: :lager
26
- }).must_equal 360_000_000_000
27
- end
28
-
29
- it "must calculate yeast cells needed for an ale using gallons" do
30
- Calculate.yeast_cells_required({
31
- extract: 12,
32
- volume: 5.3
33
- }, { volume: :gallons }).must_equal 180_900_000_000
34
- end
35
-
36
- it "must calculate yeast cells needed for an ale using specific gravity" do
37
- Calculate.yeast_cells_required({
38
- extract: 1.048,
39
- volume: 20
40
- }, { extract: :specific_gravity }).must_equal 178_500_000_000
41
- end
42
-
43
- it "must calculate yeast cells needed for an ale using Brix" do
44
- Calculate.yeast_cells_required({
45
- extract: 18.5,
46
- volume: 20
47
- }, { extract: :brix }).must_equal 279_000_000_000
48
- end
49
-
50
- it "must calculate yeast cells needed for an ale using gallons and specific gravity" do
51
- Calculate.yeast_cells_required({
52
- extract: 1.048,
53
- volume: 5.3
54
- }, { extract: :specific_gravity, volume: :gallons }).must_equal 179_392_500_000
55
- end
56
-
57
- it "must calculate yeast cells needed for an hybrid using gallons" do
58
- Calculate.yeast_cells_required({
59
- extract: 12,
60
- volume: 5.3,
61
- type: :hybrid
62
- }, { volume: :gallons }).must_equal 271_350_000_000
63
- end
64
-
65
- it "must calculate yeast cells needed for an hybrid using specific gravity" do
66
- Calculate.yeast_cells_required({
67
- extract: 1.048,
68
- volume: 20,
69
- type: :hybrid
70
- }, { extract: :specific_gravity }).must_equal 267_750_000_000
71
- end
72
-
73
- it "must calculate yeast cells needed for an hybrid using Brix" do
74
- Calculate.yeast_cells_required({
75
- extract: 18.5,
76
- volume: 20,
77
- type: :hybrid
78
- }, { extract: :brix }).must_equal 418_500_000_000
79
- end
80
-
81
- it "must calculate yeast cells needed for an hybrid using gallons and specific gravity" do
82
- Calculate.yeast_cells_required({
83
- extract: 1.048,
84
- volume: 5.3,
85
- type: :hybrid
86
- }, { extract: :specific_gravity, volume: :gallons }).must_equal 269_088_750_000
87
- end
88
-
89
- it "must calculate yeast cells needed for an lager using gallons" do
90
- Calculate.yeast_cells_required({
91
- extract: 12,
92
- volume: 5.3,
93
- type: :lager
94
- }, { volume: :gallons }).must_equal 361_800_000_000
95
- end
96
-
97
- it "must calculate yeast cells needed for an lager using specific gravity" do
98
- Calculate.yeast_cells_required({
99
- extract: 1.048,
100
- volume: 20,
101
- type: :lager
102
- }, { extract: :specific_gravity }).must_equal 357_000_000_000
103
- end
104
-
105
- it "must calculate yeast cells needed for an lager using Brix" do
106
- Calculate.yeast_cells_required({
107
- extract: 18.5,
108
- volume: 20,
109
- type: :lager
110
- }, { extract: :brix }).must_equal 558_000_000_000
111
- end
112
-
113
- it "must calculate yeast cells needed for an lager using gallons and specific gravity" do
114
- Calculate.yeast_cells_required({
115
- extract: 1.048,
116
- volume: 5.3,
117
- type: :lager
118
- }, { extract: :specific_gravity, volume: :gallons }).must_equal 358_785_000_000
119
- end
120
-
121
- it "must raise an exception when the beer type is unrecognized" do
122
- lambda {
123
- Calculate.yeast_cells_required({
124
- extract: 15,
125
- volume: 20,
126
- type: :wine
127
- })
128
- }.must_raise ArgumentError
129
- end
130
-
131
- it "must raise an exception when the extract unit is unrecognized" do
132
- lambda {
133
- Calculate.yeast_cells_required({
134
- extract: 15,
135
- volume: 20
136
- }, { extract: :squeeze })
137
- }.must_raise ArgumentError
138
- end
139
-
140
- it "must raise an exception when the volume unit is unrecognized" do
141
- lambda {
142
- Calculate.yeast_cells_required({
143
- extract: 15,
144
- volume: 20
145
- }, { volume: :barrels })
146
- }.must_raise ArgumentError
147
- end
148
-
149
- end