brewser 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,226 @@
1
+ require "spec_helper"
2
+
3
+ describe "ProMashRec tests" do
4
+
5
+ context "ProMashRec Simple" do
6
+
7
+ before :each do
8
+ @recipe = Brewser.parse(read_file('promash/BelgianWhite.rec'))
9
+ end
10
+
11
+ it "should deserialize the base recipe data" do
12
+ @recipe.class.should == ProMashRec::Recipe
13
+ @recipe.name.should == "Jeffrey's Winter White"
14
+ @recipe.method.should == "All Grain"
15
+ @recipe.type.should == "Ale"
16
+
17
+ @recipe.recipe_volume.class.should == Unit
18
+ @recipe.recipe_volume.kind.should == :volume
19
+ @recipe.recipe_volume.scalar_in('gal').should be_within(0.01).of(5)
20
+
21
+ @recipe.boil_volume.class.should == Unit
22
+ @recipe.boil_volume.kind.should == :volume
23
+ @recipe.boil_volume.scalar_in('gal').should be_within(0.01).of(5)
24
+
25
+ @recipe.recipe_efficiency.should == 75.0
26
+
27
+ @recipe.boil_time.class.should == Unit
28
+ @recipe.boil_time.kind.should == :time
29
+ @recipe.boil_time.should == "60 min".u
30
+
31
+ @recipe.estimated_og.should == 1.049
32
+ @recipe.estimated_ibu.should == 16.3
33
+ end
34
+
35
+ it "should deserialize the hop data" do
36
+ @recipe.hops.count.should == 4
37
+ h=@recipe.hops[0]
38
+ h.name.should == "Hallertauer"
39
+ h.alpha_acids.should == 4.00
40
+ h.amount.should == "0.5 oz".u
41
+ h.added_when.should == "Boil"
42
+ h.time.should === "60 min".u
43
+ h.form.should == "Whole"
44
+ end
45
+
46
+ it "should deserialize the fermentable data" do
47
+ @recipe.fermentables.count.should == 5
48
+ f=@recipe.fermentables[0]
49
+ f.name.should == "Pale Malt(2-row)"
50
+ f.amount.should == "4 lb".u
51
+ f.potential.should == 1.037
52
+ f.color.should == 3.0
53
+ end
54
+
55
+ it "should deserialize the additive data" do
56
+ @recipe.additives.count.should == 2
57
+ a=@recipe.additives[0]
58
+ a.name.should == "Corriander Seed"
59
+ a.type.should == "Spice"
60
+ a.added_when.should == "Boil"
61
+ #a.amount.should == "1.5 oz".u # TODO find out what is wrong with this
62
+ a.time.should == "5 min".u
63
+ end
64
+
65
+ it "should deserialize the yeast data" do
66
+ @recipe.yeasts.count.should == 1
67
+ y=@recipe.yeasts.first
68
+ y.name.should == "Belgian White Beer"
69
+ y.supplier.should == "WYeast"
70
+ y.catalog.should == "3944"
71
+ y.min_temperature.should == "65 dF".u
72
+ y.max_temperature.should == "65 dF".u
73
+ y.amount.should == "1 each".u
74
+ y.attenuation.should == 74.0
75
+ end
76
+
77
+ it "should deserialize the mash schedule data" do
78
+ m=@recipe.mash_schedule
79
+ m.name.should == "Simple"
80
+ end
81
+
82
+ it "should deserialize the mash step data" do
83
+ m=@recipe.mash_schedule
84
+ m.mash_steps.count.should == 3
85
+ s=m.mash_steps[0]
86
+ #s.index.should == 1
87
+ s.name.should == "Sac rest"
88
+ s.rest_time.should == "90 min".u
89
+ s.rest_temperature.should == "155 dF".u
90
+ end
91
+
92
+ it "should deserialize the water profile data" do
93
+ w=@recipe.water_profile
94
+ w.name.should == "Marin Tap Water"
95
+ w.calcium.should == 12.0
96
+ w.bicarbonate.should == 74.0
97
+ w.sulfates.should == 17.0
98
+ w.chloride.should == 13.0
99
+ w.sodium.should == 15.0
100
+ w.magnesium.should == 10.0
101
+ w.ph.should == 8.31
102
+ end
103
+
104
+ it "should deserialize the style data" do
105
+ s=@recipe.style
106
+ s.name.should == "Witbier"
107
+ s.category.should == "Belgian & French Ale"
108
+ s.style_letter.should == "B"
109
+ s.category_number.should == "19"
110
+ s.style_guide.should == "BJCP"
111
+ end
112
+ end
113
+
114
+ context "ProMashRec Alternate" do
115
+
116
+ before :each do
117
+ @recipe = Brewser.parse(read_file('promash/ComplexPumpkin.rec'))
118
+ end
119
+
120
+ it "should deserialize the base recipe data" do
121
+ @recipe.class.should == ProMashRec::Recipe
122
+ @recipe.name.should == "Pumpkin Ale"
123
+ @recipe.method.should == "All Grain"
124
+ @recipe.type.should == "Ale"
125
+
126
+ @recipe.recipe_volume.class.should == Unit
127
+ @recipe.recipe_volume.kind.should == :volume
128
+ @recipe.recipe_volume.scalar_in('gal').should be_within(0.01).of(5.5)
129
+
130
+ @recipe.boil_volume.class.should == Unit
131
+ @recipe.boil_volume.kind.should == :volume
132
+ @recipe.boil_volume.scalar_in('gal').should be_within(0.01).of(5.5)
133
+
134
+ @recipe.recipe_efficiency.should == 75.0
135
+
136
+ @recipe.boil_time.class.should == Unit
137
+ @recipe.boil_time.kind.should == :time
138
+ @recipe.boil_time.should == "60 min".u
139
+
140
+ @recipe.estimated_og.should == 1.054
141
+ @recipe.estimated_ibu.should == 28.5
142
+
143
+ @recipe.description.should == "Tastes great!"
144
+ end
145
+
146
+ it "should deserialize the hop data" do
147
+ @recipe.hops.count.should == 2
148
+ h=@recipe.hops[0]
149
+ h.name.should == "Mt. Hood"
150
+ h.alpha_acids.should == 6.50
151
+ h.amount.should == "1 oz".u
152
+ h.added_when.should == "Boil"
153
+ h.time.should === "60 min".u
154
+ h.form.should == "Pellet"
155
+ end
156
+
157
+ it "should deserialize the fermentable data" do
158
+ @recipe.fermentables.count.should == 4
159
+ f=@recipe.fermentables[0]
160
+ f.name.should == "Munich Malt"
161
+ f.amount.should == "5 lb".u
162
+ f.potential.should == 1.037
163
+ f.color.should == 8.0
164
+ end
165
+
166
+ it "should deserialize the additive data" do
167
+ @recipe.additives.count.should == 1
168
+ a=@recipe.additives[0]
169
+ a.name.should == "Irish Moss"
170
+ a.type.should == "Fining"
171
+ a.added_when.should == "Boil"
172
+ a.amount.should == "0.25 oz".u # TODO find out what is wrong with this
173
+ a.time.should == "15 min".u
174
+ end
175
+
176
+ it "should deserialize the yeast data" do
177
+ @recipe.yeasts.count.should == 1
178
+ y=@recipe.yeasts.first
179
+ y.name.should == "German Wheat"
180
+ y.supplier.should == "WYeast"
181
+ y.catalog.should == "3333"
182
+ y.min_temperature.should == "65 dF".u
183
+ y.max_temperature.should == "65 dF".u
184
+ y.amount.should == "1 each".u
185
+ y.attenuation.should == 75.5
186
+ end
187
+
188
+ # it "should deserialize the mash schedule data" do
189
+ # m=@recipe.mash_schedule
190
+ # m.name.should == "2 Step Mash"
191
+ # m.grain_temp.should == "82 dF".u
192
+ # end
193
+ #
194
+ # it "should deserialize the mash step data" do
195
+ # m=@recipe.mash_schedule
196
+ # m.mash_steps.count.should == 3
197
+ # s=m.mash_steps[0]
198
+ # s.index.should == 1
199
+ # s.name.should == "Protein Rest"
200
+ # s.rest_time.should == "30 min".u
201
+ # s.rest_temperature.should == "122 dF".u
202
+ # end
203
+
204
+ it "should deserialize the water profile data" do
205
+ w=@recipe.water_profile
206
+ w.name.should == "Munich"
207
+ w.calcium.should == 76.0
208
+ w.bicarbonate.should == 152.0
209
+ w.sulfates.should == 10.0
210
+ w.chloride.should == 2.0
211
+ w.sodium.should == 1.0
212
+ w.magnesium.should == 18.0
213
+ w.ph.should == 8.33
214
+ end
215
+
216
+ it "should deserialize the style data" do
217
+ s=@recipe.style
218
+ s.name.should == "American Amber Ale"
219
+ s.category.should == "American Pale Ales"
220
+ s.style_letter.should == "B"
221
+ s.category_number.should == "6"
222
+ s.style_guide.should == "AHA"
223
+ end
224
+ end
225
+
226
+ end
@@ -1,6 +1,6 @@
1
1
  require "spec_helper"
2
2
 
3
- describe "ProMash tests" do
3
+ describe "ProMashTxt tests" do
4
4
 
5
5
  context "ProMashTxt" do
6
6
 
@@ -83,112 +83,5 @@ describe "ProMash tests" do
83
83
  end
84
84
  end
85
85
 
86
- context "ProMashRec" do
87
-
88
- before :each do
89
- @recipe = Brewser.parse(read_file('promash/BelgianWhite.rec'))
90
- end
91
-
92
- it "should deserialize the base recipe data" do
93
- @recipe.class.should == ProMashRec::Recipe
94
- @recipe.name.should == "Jeffrey's Winter White"
95
- @recipe.method.should == "All Grain"
96
- @recipe.type.should == "Ale"
97
-
98
- @recipe.recipe_volume.class.should == Unit
99
- @recipe.recipe_volume.kind.should == :volume
100
- @recipe.recipe_volume.scalar_in('gal').should be_within(0.01).of(5)
101
-
102
- @recipe.boil_volume.class.should == Unit
103
- @recipe.boil_volume.kind.should == :volume
104
- @recipe.boil_volume.scalar_in('gal').should be_within(0.01).of(5)
105
-
106
- @recipe.recipe_efficiency.should == 75.0
107
-
108
- @recipe.boil_time.class.should == Unit
109
- @recipe.boil_time.kind.should == :time
110
- @recipe.boil_time.should == "60 min".u
111
-
112
- @recipe.estimated_og.should == 1.049
113
- @recipe.estimated_ibu.should == 16.3
114
- end
115
-
116
- it "should deserialize the hop data" do
117
- @recipe.hops.count.should == 4
118
- h=@recipe.hops[0]
119
- h.name.should == "Hallertauer"
120
- h.alpha_acids.should == 4.00
121
- h.amount.should == "0.5 oz".u
122
- h.added_when.should == "Boil"
123
- h.time.should === "60 min".u
124
- h.form.should == "Whole"
125
- end
126
-
127
- it "should deserialize the fermentable data" do
128
- @recipe.fermentables.count.should == 5
129
- f=@recipe.fermentables[0]
130
- f.name.should == "Pale Malt(2-row)"
131
- f.amount.should == "4 lb".u
132
- f.potential.should == 1.037
133
- f.color.should == 3.0
134
- end
135
-
136
- it "should deserialize the additive data" do
137
- @recipe.additives.count.should == 2
138
- a=@recipe.additives[0]
139
- a.name.should == "Corriander Seed"
140
- a.type.should == "Spice"
141
- a.added_when.should == "Boil"
142
- #a.amount.should == "1.5 oz".u # TODO find out what is wrong with this
143
- a.time.should == "5 min".u
144
- end
145
-
146
- it "should deserialize the yeast data" do
147
- @recipe.yeasts.count.should == 1
148
- y=@recipe.yeasts.first
149
- y.name.should == "Belgian White Beer"
150
- y.supplier.should == "WYeast"
151
- y.catalog.should == "3944"
152
- y.min_temperature.should == "65 dF".u
153
- y.max_temperature.should == "65 dF".u
154
- y.amount.should == "1 each".u
155
- y.attenuation.should == 74.0
156
- end
157
-
158
- it "should deserialize the mash schedule data" do
159
- m=@recipe.mash_schedule
160
- m.name.should == "Simple"
161
- end
162
-
163
- it "should deserialize the mash step data" do
164
- m=@recipe.mash_schedule
165
- m.mash_steps.count.should == 3
166
- s=m.mash_steps[0]
167
- #s.index.should == 1
168
- s.name.should == "Sac rest"
169
- s.rest_time.should == "90 min".u
170
- s.rest_temperature.should == "155 dF".u
171
- end
172
-
173
- it "should deserialize the water profile data" do
174
- w=@recipe.water_profile
175
- w.name.should == "Marin Tap Water"
176
- w.calcium.should == 12.0
177
- w.bicarbonate.should == 74.0
178
- w.sulfates.should == 17.0
179
- w.chloride.should == 13.0
180
- w.sodium.should == 15.0
181
- w.magnesium.should == 10.0
182
- w.ph.should == 8.31
183
- end
184
86
 
185
- it "should deserialize the style data" do
186
- s=@recipe.style
187
- s.name.should == "Witbier"
188
- s.category.should == "Belgian & French Ale"
189
- s.style_letter.should == "B"
190
- s.category_number.should == "19"
191
- s.style_guide.should == "BJCP"
192
- end
193
- end
194
87
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: brewser
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-06-13 00:00:00.000000000Z
12
+ date: 2012-06-28 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
16
- requirement: &2169441920 !ruby/object:Gem::Requirement
16
+ requirement: &2152180660 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 2.3.14
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *2169441920
24
+ version_requirements: *2152180660
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: multi_json
27
- requirement: &2169440260 !ruby/object:Gem::Requirement
27
+ requirement: &2152170300 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '1.0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *2169440260
35
+ version_requirements: *2152170300
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: ruby-units
38
- requirement: &2169439720 !ruby/object:Gem::Requirement
38
+ requirement: &2152117440 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *2169439720
46
+ version_requirements: *2152117440
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: nokogiri
49
- requirement: &2169439220 !ruby/object:Gem::Requirement
49
+ requirement: &2152107680 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0'
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *2169439220
57
+ version_requirements: *2152107680
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: roxml
60
- requirement: &2169438420 !ruby/object:Gem::Requirement
60
+ requirement: &2152103080 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,21 @@ dependencies:
65
65
  version: '0'
66
66
  type: :runtime
67
67
  prerelease: false
68
- version_requirements: *2169438420
68
+ version_requirements: *2152103080
69
+ - !ruby/object:Gem::Dependency
70
+ name: msgpack
71
+ requirement: &2152101660 !ruby/object:Gem::Requirement
72
+ none: false
73
+ requirements:
74
+ - - ! '>='
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ type: :runtime
78
+ prerelease: false
79
+ version_requirements: *2152101660
69
80
  - !ruby/object:Gem::Dependency
70
81
  name: bindata
71
- requirement: &2169437620 !ruby/object:Gem::Requirement
82
+ requirement: &2152097680 !ruby/object:Gem::Requirement
72
83
  none: false
73
84
  requirements:
74
85
  - - ! '>='
@@ -76,10 +87,10 @@ dependencies:
76
87
  version: '0'
77
88
  type: :runtime
78
89
  prerelease: false
79
- version_requirements: *2169437620
90
+ version_requirements: *2152097680
80
91
  - !ruby/object:Gem::Dependency
81
92
  name: builder
82
- requirement: &2169436640 !ruby/object:Gem::Requirement
93
+ requirement: &2152092920 !ruby/object:Gem::Requirement
83
94
  none: false
84
95
  requirements:
85
96
  - - ! '>='
@@ -87,21 +98,32 @@ dependencies:
87
98
  version: '0'
88
99
  type: :runtime
89
100
  prerelease: false
90
- version_requirements: *2169436640
101
+ version_requirements: *2152092920
91
102
  - !ruby/object:Gem::Dependency
92
103
  name: dm-core
93
- requirement: &2169434900 !ruby/object:Gem::Requirement
104
+ requirement: &2152054940 !ruby/object:Gem::Requirement
94
105
  none: false
95
106
  requirements:
96
- - - ~>
107
+ - - ! '>='
97
108
  - !ruby/object:Gem::Version
98
- version: 1.2.0
109
+ version: '0'
99
110
  type: :runtime
100
111
  prerelease: false
101
- version_requirements: *2169434900
112
+ version_requirements: *2152054940
102
113
  - !ruby/object:Gem::Dependency
103
114
  name: dm-validations
104
- requirement: &2169433860 !ruby/object:Gem::Requirement
115
+ requirement: &2152051580 !ruby/object:Gem::Requirement
116
+ none: false
117
+ requirements:
118
+ - - ! '>='
119
+ - !ruby/object:Gem::Version
120
+ version: '0'
121
+ type: :runtime
122
+ prerelease: false
123
+ version_requirements: *2152051580
124
+ - !ruby/object:Gem::Dependency
125
+ name: dm-serializer
126
+ requirement: &2152031360 !ruby/object:Gem::Requirement
105
127
  none: false
106
128
  requirements:
107
129
  - - ~>
@@ -109,7 +131,7 @@ dependencies:
109
131
  version: 1.2.0
110
132
  type: :runtime
111
133
  prerelease: false
112
- version_requirements: *2169433860
134
+ version_requirements: *2152031360
113
135
  description:
114
136
  email:
115
137
  - jlochner@gmail.com
@@ -147,6 +169,8 @@ files:
147
169
  - lib/brewser.rb
148
170
  - spec/basic_spec.rb
149
171
  - spec/beerxml_spec.rb
172
+ - spec/brewson_spec.rb
173
+ - spec/promash_rec_spec.rb
150
174
  - spec/promash_spec.rb
151
175
  - spec/spec_helper.rb
152
176
  homepage: https://github.com/brewpoo/brewser
@@ -161,18 +185,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
161
185
  - - ! '>='
162
186
  - !ruby/object:Gem::Version
163
187
  version: '0'
164
- segments:
165
- - 0
166
- hash: 3406155291406653551
167
188
  required_rubygems_version: !ruby/object:Gem::Requirement
168
189
  none: false
169
190
  requirements:
170
191
  - - ! '>='
171
192
  - !ruby/object:Gem::Version
172
193
  version: '0'
173
- segments:
174
- - 0
175
- hash: 3406155291406653551
176
194
  requirements: []
177
195
  rubyforge_project: brewser
178
196
  rubygems_version: 1.8.6
@@ -182,6 +200,8 @@ summary: Library for parsing and generating serialized brewing data
182
200
  test_files:
183
201
  - spec/basic_spec.rb
184
202
  - spec/beerxml_spec.rb
203
+ - spec/brewson_spec.rb
204
+ - spec/promash_rec_spec.rb
185
205
  - spec/promash_spec.rb
186
206
  - spec/spec_helper.rb
187
207
  has_rdoc: