nrb-beerxml 0.0.4 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 03033c9e27c70f80d8743be2e283b166fb64e7a4
4
- data.tar.gz: 1449230fbd782ba350b23b2e8dda9a36dabaec9a
3
+ metadata.gz: 66306fa0b088483f971caf5455cc2abdef308a17
4
+ data.tar.gz: 7d2fff22101ba6f8f0b65aae0d026bda25a940d1
5
5
  SHA512:
6
- metadata.gz: d2ab79db6af27da53a608e8d35923cd51930eff78e51dbd21de6294025e10794e28c58695342220d0b649c6f6514626879610d7c59d52319abd3f66a654a6d8e
7
- data.tar.gz: f81eae1407baafc9fbabec27561439076e57b6fd07e2ff1bbdf8351654bdef50c0a5ee9dae2f9ba34f8c307100279747db26b98f81ce22ed0a9375959dcd370a
6
+ metadata.gz: e69f093577b35328ff267a6af2b535392a0c7f46fe21758f9121c0965b2a2611ca84d47026659a84ab991937df9c01c37f4299f7b55a969d6cce5641cd00fd8b
7
+ data.tar.gz: f24c6182bb438aa5937e93acf0d65f467f2c11ca573f0c3d44bfbad0096553a51e135cf9a77d84dbe72d256039e7c2c889e4393c9ed90ec7c8cd2cfc33948470
data/README.md CHANGED
@@ -21,18 +21,19 @@ Or install it yourself as:
21
21
 
22
22
  ## Parse
23
23
 
24
- Parse a BeerXML file
25
-
26
24
  ```ruby
27
25
  require `nrb/beerxml`
26
+
28
27
  parser = NRB::BeerXML::Parser.new
28
+ => #<NRB::BeerXML::Parser:0x007fbe4fb58d70 @builder=#<NRB::BeerXML::Builder:0x007fbe4fb58a00>, @reader=Nokogiri::XML>
29
+
29
30
  parser.parse file_path
30
31
  => #<NRB::BeerXML::Equipment:0x007fbe501e4298 @name="Brew Pot", ...>
31
32
  ```
32
33
 
33
34
  `parse` can handle a `String` pathname or an `IO` containing the BeerXML.
34
35
 
35
- ### Builder
36
+ #### Builder
36
37
 
37
38
  The parser uses a builder class to construct `NRB::BeerXML::Record` objects. If you would rather get back some other class of object (for example a `ActiveRecord` model) just give it your own builder class at initialization.
38
39
 
@@ -42,7 +43,7 @@ parser = NRB::BeerXML::Parser.new buider: MyBuilder
42
43
 
43
44
  Your builder should implement a `build(type)` method which returns a new object of the requested type. `type` will be an underscored string.
44
45
 
45
- ### Reader
46
+ #### Reader
46
47
 
47
48
  NRB::BeerXML uses Nokogiri by default. If you want to use another reader, simply pass the class name to the Parser's initializer.
48
49
 
@@ -70,4 +71,4 @@ defined?(BeerXML) || BeerXML = NRB::BeerXML
70
71
 
71
72
  ## Contributors
72
73
 
73
- @brundage at the [New Republic Brewing Company](https://github.com/NewRepublicBrewing)
74
+ [@brundage](https://github.com/brundage) at the [New Republic Brewing Company](https://github.com/NewRepublicBrewing)
@@ -20,17 +20,17 @@ module NRB; module BeerXML
20
20
 
21
21
  validates :batch_size, numericality: { greater_than_or_equal_to: 0 }, presence: true
22
22
  validates :boil_size, numericality: { greater_than_or_equal_to: 0 }, presence: true
23
- validates :boil_time, numericality: { greater_than_or_equal_to: 0 }
24
- validates :calc_boil_volume, boolean: true
23
+ validates :boil_time, numericality: { allow_nil:true, greater_than_or_equal_to: 0 }
24
+ validates :calc_boil_volume, boolean: { allow_nil: true }
25
25
  validates :evap_rate, percentage: true
26
- validates :hop_utilization, percentage: { give_110: true }
27
- validates :lauter_tun_deadspace, numericality: { greater_than_or_equal_to: 0 }
28
- validates :top_up_kettle, numericality: { greater_than_or_equal_to: 0 }
29
- validates :top_up_water, numericality: { greater_than_or_equal_to: 0 }
30
- validates :trub_chiller_loss, numericality: { greater_than_or_equal_to: 0 }
31
- validates :tun_specific_heat, numericality: { greater_than_or_equal_to: 0 }
32
- validates :tun_volume, numericality: { greater_than_or_equal_to: 0 }
33
- validates :tun_weight, numericality: { greater_than_or_equal_to: 0 }
26
+ validates :hop_utilization, percentage: { allow_nil: true, give_110: true }
27
+ validates :lauter_tun_deadspace, numericality: { allow_nil: true, greater_than_or_equal_to: 0 }
28
+ validates :top_up_kettle, numericality: { allow_nil: true, greater_than_or_equal_to: 0 }
29
+ validates :top_up_water, numericality: { allow_nil: true, greater_than_or_equal_to: 0 }
30
+ validates :trub_chiller_loss, numericality: { allow_nil: true, greater_than_or_equal_to: 0 }
31
+ validates :tun_specific_heat, numericality: { allow_nil: true, greater_than_or_equal_to: 0 }
32
+ validates :tun_volume, numericality: { allow_nil: true, greater_than_or_equal_to: 0 }
33
+ validates :tun_weight, numericality: { allow_nil: true, greater_than_or_equal_to: 0 }
34
34
 
35
35
  end
36
36
  end; end
@@ -19,13 +19,13 @@ module NRB; module BeerXML
19
19
  attr_accessor :type # list required
20
20
  attr_accessor :yield # percent required
21
21
 
22
- validates :add_after_boil, boolean: true
22
+ validates :add_after_boil, boolean: { allow_nil: true }
23
23
  validates :amount, presence: true
24
24
  validates :color, presence: true
25
25
  validates :type, inclusion: { in: [ "Adjunct", "Dry Extract", "Extract", "Grain", "Sugar" ] }, presence: true
26
26
  validates :yield, presence: true
27
27
 
28
- validates :diastatic_power, numericality: { greater_than_or_equal_to: 0 }
28
+ validates :diastatic_power, numericality: { allow_nil: true, greater_than_or_equal_to: 0 }
29
29
 
30
30
  end
31
31
  end; end
@@ -19,15 +19,15 @@ module NRB; module BeerXML
19
19
 
20
20
  validates :alpha, presence: true, percentage: true
21
21
  validates :amount, presence: true, numericality: { greater_than_or_equal_to: 0 }
22
- validates :beta, percentage: true
23
- validates :caryophyllene, percentage: true
24
- validates :cohumulone, percentage: true
25
- validates :form, inclusion: { in: %w(Leaf Pellet Plug) }
26
- validates :hsi, percentage: true
27
- validates :myrcene, percentage: true
22
+ validates :beta, percentage: { allow_nil: true }
23
+ validates :caryophyllene, percentage: { allow_nil: true }
24
+ validates :cohumulone, percentage: { allow_nil: true }
25
+ validates :form, inclusion: { allow_nil: true, in: %w(Leaf Pellet Plug) }
26
+ validates :hsi, percentage: { allow_nil: true }
27
+ validates :myrcene, percentage: { allow_nil: true }
28
28
  validates :time, presence: true,
29
29
  numericality: { greater_than_or_equal_to: 0 }
30
- validates :type, inclusion: { in: %w(Aroma Bittering Both) }
30
+ validates :type, inclusion: { allow_nil: true, in: %w(Aroma Bittering Both) }
31
31
 
32
32
  validates :use, presence: true,
33
33
  inclusion: { in: [ "Aroma", "Boil", "Dry Hop", "First Wort", "Mash" ] }
@@ -14,11 +14,11 @@ module NRB; module BeerXML
14
14
 
15
15
  validates :grain_temp, numericality: true, presence: true
16
16
  validates :mash_steps, presence: true
17
- validates :ph, numericality: { greater_than_or_equal_to: 0, less_than_or_equal_to: 14 }
18
- validates :sparge_temp, numericality: true
19
- validates :tun_specific_heat, numericality: { greater_than_or_equal_to: 0 }
20
- validates :tun_temp, numericality: true
21
- validates :tun_weight, numericality: { greater_than_or_equal_to: 0 }
17
+ validates :ph, numericality: { allow_nil: true, greater_than_or_equal_to: 0, less_than_or_equal_to: 14 }
18
+ validates :sparge_temp, numericality: { allow_nil: true }
19
+ validates :tun_specific_heat, numericality: { allow_nil: true, greater_than_or_equal_to: 0 }
20
+ validates :tun_temp, numericality: { allow_nil: true }
21
+ validates :tun_weight, numericality: { allow_nil: true, greater_than_or_equal_to: 0 }
22
22
 
23
23
 
24
24
  after_initialize :initialize_mash_steps
@@ -8,9 +8,9 @@ module NRB; module BeerXML
8
8
  attr_accessor :step_time # time required
9
9
  attr_accessor :type # list required
10
10
 
11
- validates :end_temp, numericality: true
12
- validates :infuse_amount, presence: { if: Proc.new { |step| step.infuse_amount_required? } }, numericality: true
13
- validates :ramp_time, numericality: { greater_than_or_equal_to: 0 }
11
+ validates :end_temp, numericality: { allow_nil: true }
12
+ validates :infuse_amount, presence: { if: Proc.new { |step| step.infuse_amount_required? } }, numericality: { allow_nil: true }
13
+ validates :ramp_time, numericality: { allow_nil: true, greater_than_or_equal_to: 0 }
14
14
  validates :step_temp, numericality: true, presence: true
15
15
  validates :step_time, numericality: { greater_than_or_equal_to: 0 }, presence: true
16
16
  validates :type, inclusion: { in: %w(Decoction Infusion Temperature) },
@@ -3,6 +3,24 @@ require 'nokogiri'
3
3
  module NRB; module BeerXML
4
4
  class Parser
5
5
 
6
+ class InvalidRecordError < RuntimeError
7
+
8
+ attr_reader :errors, :record
9
+
10
+ def initialize(record, errors={})
11
+ super nil
12
+ @errors = errors
13
+ @record = record
14
+ end
15
+
16
+ def to_s
17
+ errors.keys.inject("Invalid #{record.class} record\n") do |message,key|
18
+ message += "#{key}=#{record.send(key)} #{errors.fetch(key)}\n"
19
+ end
20
+ end
21
+
22
+ end
23
+
6
24
  include Inflector
7
25
 
8
26
  attr_reader :builder, :reader
@@ -49,7 +67,12 @@ module NRB; module BeerXML
49
67
 
50
68
 
51
69
  def attribute_value(node)
52
- node.children.first.text
70
+ value = node.children.first.text.strip
71
+ return value.to_i if value =~ /^-?[0-9]+$/
72
+ return value.to_f if value =~ /^-?[0-9.]+$/
73
+ return false if value == "FALSE"
74
+ return true if value == "TRUE"
75
+ value
53
76
  end
54
77
 
55
78
 
@@ -91,6 +114,8 @@ module NRB; module BeerXML
91
114
 
92
115
  assign_child_to_parent parent, obj
93
116
 
117
+ validate obj
118
+
94
119
  obj
95
120
  end
96
121
  end
@@ -110,5 +135,12 @@ module NRB; module BeerXML
110
135
  end
111
136
  end
112
137
 
138
+
139
+ def validate(obj)
140
+ return unless obj.respond_to?(:valid?)
141
+ return if obj.valid?
142
+ raise InvalidRecordError.new(obj, obj.errors.messages)
143
+ end
144
+
113
145
  end
114
146
  end; end
@@ -42,34 +42,34 @@ module NRB; module BeerXML
42
42
  attr_accessor :waters # waters record set required
43
43
  attr_accessor :yeasts # yeasts record set required
44
44
 
45
- validates :age, numericality: { greater_than_or_equal_to: 0 }
46
- validates :age_temp, numericality: true
47
- validates :batch_size, numericality: { greater_than_or_equal_to: 0 }, presence: true
48
- validates :boil_size, numericality: { greater_than_or_equal_to: 0 }, presence: true
49
- validates :boil_time, numericality: { greater_than_or_equal_to: 0 }, presence: true
45
+ validates :age, numericality: { allow_nil: true, greater_than_or_equal_to: 0 }
46
+ validates :age_temp, numericality: { allow_nil: true }
47
+ validates :batch_size, numericality: { allow_nil: true, greater_than_or_equal_to: 0 }, presence: true
48
+ validates :boil_size, numericality: { allow_nil: true, greater_than_or_equal_to: 0 }, presence: true
49
+ validates :boil_time, numericality: { allow_nil: true, greater_than_or_equal_to: 0 }, presence: true
50
50
  validates :brewer, presence: true
51
- validates :carbonation, numericality: { greater_than_or_equal_to: 0 }
52
- validates :carbonation_temp, numericality: true
51
+ validates :carbonation, numericality: { allow_nil: true, greater_than_or_equal_to: 0 }
52
+ validates :carbonation_temp, numericality: { allow_nil: true }
53
53
  validates :equipment, presence: true
54
- validates :efficiency, percentage: true, presence: { if: Proc.new { |recipe| recipe.efficiency_required? } }
54
+ validates :efficiency, percentage: { allow_nil: true }, presence: { if: Proc.new { |recipe| recipe.efficiency_required? } }
55
55
  validates :fermentables, presence: true
56
- validates :fermentation_stages, numericality: { only_integer: true }
57
- validates :fg, numericality: true
58
- validates :forced_carbonation, boolean: true
56
+ validates :fermentation_stages, numericality: { allow_nil: true, only_integer: true }
57
+ validates :fg, numericality: { allow_nil: true }
58
+ validates :forced_carbonation, boolean: { allow_nil: true }
59
59
  validates :hops, presence: true
60
- validates :keg_priming_factor, numericality: true
60
+ validates :keg_priming_factor, numericality: { allow_nil: true }
61
61
  validates :mash, presence: true
62
62
  validates :miscs, presence: true
63
- validates :og, numericality: true
64
- validates :primary_age, numericality: { greater_than_or_equal_to: 0 }
65
- validates :primary_temp, numericality: true
66
- validates :priming_sugar_equiv, numericality: true
67
- validates :secondary_age, numericality: { greater_than_or_equal_to: 0 }
68
- validates :secondary_temp, numericality: true
63
+ validates :og, numericality: { allow_nil: true }
64
+ validates :primary_age, numericality: { allow_nil: true, greater_than_or_equal_to: 0 }
65
+ validates :primary_temp, numericality: { allow_nil: true }
66
+ validates :priming_sugar_equiv, numericality: { allow_nil: true }
67
+ validates :secondary_age, numericality: { allow_nil: true, greater_than_or_equal_to: 0 }
68
+ validates :secondary_temp, numericality: { allow_nil: true }
69
69
  validates :style, presence: true
70
- validates :taste_rating, numericality: true
71
- validates :tertiary_age, numericality: { greater_than_or_equal_to: 0 }
72
- validates :tertiary_temp, numericality: true
70
+ validates :taste_rating, numericality: { allow_nil: true }
71
+ validates :tertiary_age, numericality: { allow_nil: true, greater_than_or_equal_to: 0 }
72
+ validates :tertiary_temp, numericality: { allow_nil: true }
73
73
  validates :type, inclusion: { in: [ "All Grain", "Extract", "Partial Mash" ] }, presence: true
74
74
  validates :waters, presence: true
75
75
  validates :yeasts, presence: true
@@ -29,7 +29,7 @@ module NRB; module BeerXML
29
29
  def equipment?; am_a? :equipment; end
30
30
  def fermentable?; am_a? :fermentable; end
31
31
  def hop?; am_a? :hop; end
32
- def mash_profile?; am_a? :mash_profile; end
32
+ def mash?; am_a? :mash; end
33
33
  def mash_step?; am_a? :mash_step; end
34
34
  def misc?; am_a? :misc; end
35
35
  def recipe?; am_a? :recipe; end
@@ -29,6 +29,11 @@ module NRB; module BeerXML
29
29
  @records = []
30
30
  end
31
31
 
32
+
33
+ def record_count
34
+ @records.size
35
+ end
36
+
32
37
  private
33
38
 
34
39
  def valid_record_type?(type)
@@ -8,7 +8,9 @@ module NRB; module BeerXML;
8
8
  end
9
9
  end
10
10
  private
11
- def delimiter; [false, true]; end
11
+ def delimiter
12
+ [false, true]
13
+ end
12
14
  end
13
15
  end
14
16
  end; end
@@ -6,7 +6,22 @@ module NRB; module BeerXML;
6
6
  def validate_each(record, attribute, value)
7
7
  return unless value
8
8
  unless value.is_a?(Numeric) && greater_than_min(value) && less_than_max(value)
9
- record.errors[attribute] << 'must be a BeerXML percentage (a number between 0 & 100)'
9
+
10
+ message = 'must be a percentage'
11
+
12
+ if options[:allow_negative] && options[:give_110]
13
+
14
+ elsif options[:allow_negative]
15
+ message += ' (greater than 0)'
16
+
17
+ elsif options[:give_110]
18
+ message += ' (less than 100)'
19
+
20
+ else
21
+ message += ' (between 0 & 100)'
22
+ end
23
+
24
+ record.errors[attribute] << message
10
25
  end
11
26
  end
12
27
 
@@ -24,10 +24,10 @@ module NRB; module BeerXML
24
24
  attr_accessor :style_letter # string required
25
25
  attr_accessor :type # list required
26
26
 
27
- validates :abv_max, numericality: { greater_than_or_equal_to: 0 }
28
- validates :abv_min, numericality: { greater_than_or_equal_to: 0 }
29
- validates :carb_max, numericality: { greater_than_or_equal_to: 0 }
30
- validates :carb_min, numericality: { greater_than_or_equal_to: 0 }
27
+ validates :abv_max, numericality: { allow_nil: true, greater_than_or_equal_to: 0 }
28
+ validates :abv_min, numericality: { allow_nil: true, greater_than_or_equal_to: 0 }
29
+ validates :carb_max, numericality: { allow_nil: true, greater_than_or_equal_to: 0 }
30
+ validates :carb_min, numericality: { allow_nil: true, greater_than_or_equal_to: 0 }
31
31
  validates :category, presence: true
32
32
  validates :category_number, presence: true
33
33
  validates :color_max, numericality: { greater_than_or_equal_to: 0 }, presence: true
@@ -1,4 +1,4 @@
1
1
  module NRB; module BeerXML
2
- VERSION = "0.0.4"
2
+ VERSION = "0.1.0"
3
3
  def self.version; VERSION; end
4
4
  end; end
@@ -16,7 +16,7 @@ module NRB; module BeerXML
16
16
  validates :calcium, numericality: true, presence: true
17
17
  validates :chloride, numericality: true, presence: true
18
18
  validates :magnesium, numericality: true, presence: true
19
- validates :ph, numericality: { greater_than_or_equal_to: 0, less_than_or_equal_to: 14 }
19
+ validates :ph, numericality: { allow_nil: true, greater_than_or_equal_to: 0, less_than_or_equal_to: 14 }
20
20
  validates :sodium, numericality: true, presence: true
21
21
  validates :sulfate, numericality: true, presence: true
22
22
 
@@ -19,16 +19,16 @@ module NRB; module BeerXML
19
19
  attr_accessor :times_cultured # integer
20
20
  attr_accessor :type # list required
21
21
 
22
- validates :add_to_secondary, boolean: true
22
+ validates :add_to_secondary, boolean: { allow_nil: true }
23
23
  validates :amount, presence: { greater_than_or_equal_to: 0 }
24
- validates :amount_is_weight, boolean: true
25
- validates :attenuation, percentage: true
26
- validates :flocculation, inclusion: { in: ["High", "Low", "Medium", "Very High" ] }
24
+ validates :amount_is_weight, boolean: { allow_nil: true }
25
+ validates :attenuation, percentage: { allow_nil: true }
26
+ validates :flocculation, inclusion: { allow_nil: true, in: ["High", "Low", "Medium", "Very High" ] }
27
27
  validates :form, presence: true, inclusion: { in: %w( Culture Dry Liquid Slant ) }
28
- validates :max_reuse, numericality: { greater_than_or_equal_to: 0, only_integer: true }
29
- validates :max_temperature, numericality: true
30
- validates :min_temperature, numericality: true
31
- validates :times_cultured, numericality: { greater_than_or_equal_to: 0, only_integer: true }
28
+ validates :max_reuse, numericality: { allow_nil: true, greater_than_or_equal_to: 0, only_integer: true }
29
+ validates :max_temperature, numericality: { allow_nil: true }
30
+ validates :min_temperature, numericality: { allow_nil: true }
31
+ validates :times_cultured, numericality: { allow_nil: true, greater_than_or_equal_to: 0, only_integer: true }
32
32
  validates :type, presence: true, inclusion: { in: %w(Ale Champagne Lager Wheat Wine) }
33
33
 
34
34
 
@@ -0,0 +1,80 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path(File.join('..','lib'), __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'nrb/beerxml/version'
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = 'nrb-beerxml'
8
+ s.version = NRB::BeerXML.version
9
+ s.authors = ['Dean Brundage']
10
+ s.email = ['dean@newrepublicbrewing.com']
11
+ s.summary = 'BeerXML parser'
12
+ s.description = 'Parses BeerXML files into ruby objects'
13
+ s.homepage = ""
14
+ s.license = "GPL-3"
15
+ s.required_ruby_version = '>=2'
16
+
17
+ s.require_paths = ['lib']
18
+
19
+ s.add_dependency 'activemodel'
20
+ s.add_dependency 'nokogiri'
21
+
22
+ s.add_development_dependency "bundler"
23
+ s.add_development_dependency "rake"
24
+ s.add_development_dependency "guard-rspec"
25
+ s.add_development_dependency "rspec"
26
+ s.add_development_dependency "shoulda"
27
+
28
+ s.files = [
29
+ 'README.md',
30
+ 'LICENSE',
31
+ 'lib/nrb/beerxml.rb',
32
+ 'lib/nrb/beerxml/builder.rb',
33
+ 'lib/nrb/beerxml/equipment.rb',
34
+ 'lib/nrb/beerxml/fermentable.rb',
35
+ 'lib/nrb/beerxml/hop.rb',
36
+ 'lib/nrb/beerxml/inflector.rb',
37
+ 'lib/nrb/beerxml/mash.rb',
38
+ 'lib/nrb/beerxml/mash_step.rb',
39
+ 'lib/nrb/beerxml/misc.rb',
40
+ 'lib/nrb/beerxml/parser.rb',
41
+ 'lib/nrb/beerxml/recipe.rb',
42
+ 'lib/nrb/beerxml/record.rb',
43
+ 'lib/nrb/beerxml/record_set.rb',
44
+ 'lib/nrb/beerxml/record_validators.rb',
45
+ 'lib/nrb/beerxml/record_validators/boolean_validator.rb',
46
+ 'lib/nrb/beerxml/record_validators/percentage_validator.rb',
47
+ 'lib/nrb/beerxml/style.rb',
48
+ 'lib/nrb/beerxml/version.rb',
49
+ 'lib/nrb/beerxml/water.rb',
50
+ 'lib/nrb/beerxml/yeast.rb',
51
+ 'nrb-beerxml.gemspec'
52
+ ]
53
+
54
+ s.test_files = [
55
+ 'spec/cases/beerxml/builder_spec.rb',
56
+ 'spec/cases/beerxml/equipment_spec.rb',
57
+ 'spec/cases/beerxml/fermentable_spec.rb',
58
+ 'spec/cases/beerxml/hop_spec.rb',
59
+ 'spec/cases/beerxml/mash_spec.rb',
60
+ 'spec/cases/beerxml/mash_step_spec.rb',
61
+ 'spec/cases/beerxml/misc_spec.rb',
62
+ 'spec/cases/beerxml/parser_spec.rb',
63
+ 'spec/cases/beerxml/recipe_spec.rb',
64
+ 'spec/cases/beerxml/record_set_spec.rb',
65
+ 'spec/cases/beerxml/record_spec.rb',
66
+ 'spec/cases/beerxml/record_validators/boolean_validator_spec.rb',
67
+ 'spec/cases/beerxml/record_validators/percentage_validator_spec.rb',
68
+ 'spec/cases/beerxml/style_spec.rb',
69
+ 'spec/cases/beerxml/version_spec.rb',
70
+ 'spec/cases/beerxml/water_spec.rb',
71
+ 'spec/cases/beerxml/yeast_spec.rb',
72
+ 'spec/cases/beerxml_spec.rb',
73
+ 'spec/fixtures/equipment.xml',
74
+ 'spec/fixtures/recipes.xml',
75
+ 'spec/shared/active_model_lint.rb',
76
+ 'spec/shared/record_typing.rb',
77
+ 'spec/spec_helper.rb'
78
+ ]
79
+
80
+ end
@@ -1,4 +1,5 @@
1
1
  require 'shared/active_model_lint'
2
+ require 'shared/record_typing'
2
3
  describe NRB::BeerXML::Equipment do
3
4
 
4
5
  it_behaves_like :ActiveModel
@@ -8,27 +9,14 @@ describe NRB::BeerXML::Equipment do
8
9
 
9
10
  it { should validate_numericality_of(:batch_size).is_greater_than_or_equal_to(0) }
10
11
  it { should validate_numericality_of(:boil_size).is_greater_than_or_equal_to(0) }
11
- it { should validate_numericality_of(:boil_time).is_greater_than_or_equal_to(0) }
12
- it { should validate_numericality_of(:lauter_tun_deadspace).is_greater_than_or_equal_to(0) }
13
- it { should validate_numericality_of(:top_up_kettle).is_greater_than_or_equal_to(0) }
14
- it { should validate_numericality_of(:top_up_water).is_greater_than_or_equal_to(0) }
15
- it { should validate_numericality_of(:trub_chiller_loss).is_greater_than_or_equal_to(0) }
16
- it { should validate_numericality_of(:tun_specific_heat).is_greater_than_or_equal_to(0) }
12
+ it { should validate_numericality_of(:boil_time).is_greater_than_or_equal_to(0).allow_nil }
13
+ it { should validate_numericality_of(:lauter_tun_deadspace).is_greater_than_or_equal_to(0).allow_nil }
14
+ it { should validate_numericality_of(:top_up_kettle).is_greater_than_or_equal_to(0).allow_nil }
15
+ it { should validate_numericality_of(:top_up_water).is_greater_than_or_equal_to(0).allow_nil }
16
+ it { should validate_numericality_of(:trub_chiller_loss).is_greater_than_or_equal_to(0).allow_nil }
17
+ it { should validate_numericality_of(:tun_specific_heat).is_greater_than_or_equal_to(0).allow_nil }
17
18
  it { should validate_numericality_of(:tun_volume).is_greater_than_or_equal_to(0) }
18
- it { should validate_numericality_of(:tun_weight).is_greater_than_or_equal_to(0) }
19
-
20
-
21
- shared_examples_for :record_typing do
22
- let(:all_types) { %i( equipment fermentable hop mash_profile mash_step misc recipe style water yeast ) }
23
- it 'correctly answers to its own type' do
24
- expect subject.send("#{type}?")
25
- end
26
- it 'correctly answers to other types' do
27
- (all_types - [type]).each do |question|
28
- expect ! subject.send("#{question}?")
29
- end
30
- end
31
- end
19
+ it { should validate_numericality_of(:tun_weight).is_greater_than_or_equal_to(0).allow_nil }
32
20
 
33
21
 
34
22
  it_behaves_like :record_typing do
@@ -1,4 +1,5 @@
1
1
  require 'shared/active_model_lint'
2
+ require 'shared/record_typing'
2
3
 
3
4
  describe NRB::BeerXML::Fermentable do
4
5
 
@@ -11,7 +12,11 @@ describe NRB::BeerXML::Fermentable do
11
12
 
12
13
  it { should validate_inclusion_of(:type).in_array( [ "Adjunct", "Dry Extract", "Extract", "Grain", "Sugar" ] ) }
13
14
 
14
- it { should validate_numericality_of(:diastatic_power).is_greater_than_or_equal_to(0) }
15
+ it { should validate_numericality_of(:diastatic_power).is_greater_than_or_equal_to(0).allow_nil }
15
16
 
16
17
 
18
+ it_behaves_like :record_typing do
19
+ let(:type) { :recipe }
20
+ end
21
+
17
22
  end
@@ -1,4 +1,5 @@
1
1
  require 'shared/active_model_lint'
2
+ require 'shared/record_typing'
2
3
 
3
4
  describe NRB::BeerXML::Hop do
4
5
 
@@ -9,13 +10,17 @@ describe NRB::BeerXML::Hop do
9
10
  it { should validate_presence_of :time }
10
11
  it { should validate_presence_of :use }
11
12
 
12
- it { should validate_inclusion_of(:form).in_array( ["Leaf", "Pellet", "Plug"] ) }
13
+ it { should validate_inclusion_of(:form).in_array( ["Leaf", "Pellet", "Plug"] ).allow_nil }
13
14
 
14
15
  it { should validate_numericality_of(:amount).is_greater_than_or_equal_to(0) }
15
- it { should validate_inclusion_of(:type).in_array(%w(Aroma Bittering Both) ) }
16
+ it { should validate_inclusion_of(:type).in_array(%w(Aroma Bittering Both) ).allow_nil }
16
17
  it { should validate_inclusion_of(:use).in_array( [ "Aroma", "Boil", "Dry Hop", "First Wort", "Mash" ] ) }
17
18
 
18
19
  it { should validate_numericality_of(:time).is_greater_than_or_equal_to(0) }
19
20
 
21
+ it_behaves_like :record_typing do
22
+ let(:type) { :hop }
23
+ end
24
+
20
25
 
21
26
  end
@@ -1,4 +1,6 @@
1
1
  require 'shared/active_model_lint'
2
+ require 'shared/record_typing'
3
+
2
4
  describe NRB::BeerXML::Mash do
3
5
 
4
6
  it_behaves_like :ActiveModel
@@ -7,11 +9,11 @@ describe NRB::BeerXML::Mash do
7
9
  it { should validate_presence_of :mash_steps }
8
10
 
9
11
  it { should validate_numericality_of :grain_temp }
10
- it { should validate_numericality_of(:ph).is_greater_than_or_equal_to(0).is_less_than_or_equal_to(14) }
11
- it { should validate_numericality_of :sparge_temp }
12
- it { should validate_numericality_of(:tun_specific_heat).is_greater_than_or_equal_to(0) }
13
- it { should validate_numericality_of :tun_temp }
14
- it { should validate_numericality_of(:tun_weight).is_greater_than_or_equal_to(0) }
12
+ it { should validate_numericality_of(:ph).is_greater_than_or_equal_to(0).is_less_than_or_equal_to(14).allow_nil }
13
+ it { should validate_numericality_of(:sparge_temp).allow_nil }
14
+ it { should validate_numericality_of(:tun_specific_heat).is_greater_than_or_equal_to(0).allow_nil }
15
+ it { should validate_numericality_of(:tun_temp).allow_nil }
16
+ it { should validate_numericality_of(:tun_weight).is_greater_than_or_equal_to(0).allow_nil }
15
17
 
16
18
 
17
19
  it 'should start with empty mash steps' do
@@ -22,4 +24,9 @@ describe NRB::BeerXML::Mash do
22
24
  expect( subject.mash_steps.record_type ).to eq :mash_step
23
25
  end
24
26
 
27
+ it_behaves_like :record_typing do
28
+ let(:type) { :mash }
29
+ end
30
+
31
+
25
32
  end
@@ -1,4 +1,5 @@
1
1
  require 'shared/active_model_lint'
2
+ require 'shared/record_typing'
2
3
 
3
4
  describe NRB::BeerXML::MashStep do
4
5
 
@@ -13,9 +14,9 @@ describe NRB::BeerXML::MashStep do
13
14
 
14
15
  it { should validate_inclusion_of(:type).in_array(%w(Decoction Infusion Temperature)) }
15
16
 
16
- it { should validate_numericality_of(:end_temp) }
17
- it { should validate_numericality_of(:infuse_amount) }
18
- it { should validate_numericality_of(:ramp_time).is_greater_than_or_equal_to(0) }
17
+ it { should validate_numericality_of(:end_temp).allow_nil }
18
+ it { should validate_numericality_of(:infuse_amount).allow_nil }
19
+ it { should validate_numericality_of(:ramp_time).is_greater_than_or_equal_to(0).allow_nil }
19
20
  it { should validate_numericality_of(:step_temp) }
20
21
  it { should validate_numericality_of(:step_time).is_greater_than_or_equal_to(0) }
21
22
 
@@ -36,4 +37,9 @@ describe NRB::BeerXML::MashStep do
36
37
  it { should_not validate_presence_of :infuse_amount }
37
38
  end
38
39
 
40
+
41
+ it_behaves_like :record_typing do
42
+ let(:type) { :mash_step }
43
+ end
44
+
39
45
  end
@@ -1,3 +1,5 @@
1
+ require 'shared/record_typing'
2
+
1
3
  describe NRB::BeerXML::Misc do
2
4
 
3
5
  it { should validate_presence_of :amount }
@@ -11,4 +13,9 @@ describe NRB::BeerXML::Misc do
11
13
  it { should validate_inclusion_of(:type).in_array(["Fining", "Flavor", "Herb", "Other", "Spice", "Water Agent"]) }
12
14
  it { should validate_inclusion_of(:use).in_array(%w(Boil Bottling Mash Primary Secondary)) }
13
15
 
16
+ it_behaves_like :record_typing do
17
+ let(:type) { :misc }
18
+ end
19
+
20
+
14
21
  end
@@ -1,5 +1,7 @@
1
1
  describe NRB::BeerXML::Parser do
2
2
 
3
+ # Need a few more cases since this is pretty much the heart of the gem
4
+
3
5
  context 'Parsing' do
4
6
 
5
7
  let(:base_dir) { File.expand_path File.join('..','..','..'), __FILE__ }
@@ -1,4 +1,5 @@
1
1
  require 'shared/active_model_lint'
2
+ require 'shared/record_typing'
2
3
 
3
4
  describe NRB::BeerXML::Recipe do
4
5
 
@@ -42,22 +43,22 @@ describe NRB::BeerXML::Recipe do
42
43
 
43
44
  it { should validate_inclusion_of(:type).in_array([ "All Grain", "Extract", "Partial Mash" ]) }
44
45
 
45
- it { should validate_numericality_of(:age).is_greater_than_or_equal_to(0) }
46
- it { should validate_numericality_of(:age_temp) }
46
+ it { should validate_numericality_of(:age).is_greater_than_or_equal_to(0).allow_nil }
47
+ it { should validate_numericality_of(:age_temp).allow_nil}
47
48
  it { should validate_numericality_of(:batch_size).is_greater_than_or_equal_to(0) }
48
49
  it { should validate_numericality_of(:boil_size).is_greater_than_or_equal_to(0) }
49
50
  it { should validate_numericality_of(:boil_time).is_greater_than_or_equal_to(0) }
50
- it { should validate_numericality_of(:carbonation).is_greater_than_or_equal_to(0) }
51
- it { should validate_numericality_of(:carbonation_temp) }
52
- it { should validate_numericality_of(:fermentation_stages).only_integer }
53
- it { should validate_numericality_of(:fg) }
54
- it { should validate_numericality_of(:og) }
55
- it { should validate_numericality_of(:primary_age).is_greater_than_or_equal_to(0) }
56
- it { should validate_numericality_of(:primary_temp) }
57
- it { should validate_numericality_of(:secondary_age).is_greater_than_or_equal_to(0) }
58
- it { should validate_numericality_of(:secondary_temp) }
59
- it { should validate_numericality_of(:tertiary_age).is_greater_than_or_equal_to(0) }
60
- it { should validate_numericality_of(:tertiary_temp) }
51
+ it { should validate_numericality_of(:carbonation).is_greater_than_or_equal_to(0).allow_nil }
52
+ it { should validate_numericality_of(:carbonation_temp).allow_nil }
53
+ it { should validate_numericality_of(:fermentation_stages).only_integer.allow_nil }
54
+ it { should validate_numericality_of(:fg).allow_nil }
55
+ it { should validate_numericality_of(:og).allow_nil }
56
+ it { should validate_numericality_of(:primary_age).is_greater_than_or_equal_to(0).allow_nil }
57
+ it { should validate_numericality_of(:primary_temp).allow_nil }
58
+ it { should validate_numericality_of(:secondary_age).is_greater_than_or_equal_to(0).allow_nil }
59
+ it { should validate_numericality_of(:secondary_temp).allow_nil }
60
+ it { should validate_numericality_of(:tertiary_age).is_greater_than_or_equal_to(0).allow_nil }
61
+ it { should validate_numericality_of(:tertiary_temp).allow_nil }
61
62
 
62
63
 
63
64
  %i(fermentable hop misc water yeast).each do |record_type|
@@ -95,4 +96,8 @@ describe NRB::BeerXML::Recipe do
95
96
  it_behaves_like :restricted_assignment
96
97
  end
97
98
 
99
+ it_behaves_like :record_typing do
100
+ let(:type) { :recipe }
101
+ end
102
+
98
103
  end
@@ -29,7 +29,7 @@ describe NRB::BeerXML::RecordValidators::PercentageValidator do
29
29
 
30
30
  it 'tells you why the record is invalid' do
31
31
  record.valid?
32
- expect(record.errors[:percentage]).to include('must be a BeerXML percentage (a number between 0 & 100)')
32
+ expect(record.errors[:percentage]).to include(message)
33
33
  end
34
34
 
35
35
  end
@@ -63,6 +63,7 @@ describe NRB::BeerXML::RecordValidators::PercentageValidator do
63
63
 
64
64
  context 'a vanilla percentage validator' do
65
65
  let(:okay) { 88 }
66
+ let(:message) { 'must be a percentage (between 0 & 100)' }
66
67
  let(:record) { NRB::Fake::VanillaFakePercentage.new percentage: percentage }
67
68
  let(:too_big) { 101 }
68
69
  let(:too_small) { -1 }
@@ -76,6 +77,7 @@ describe NRB::BeerXML::RecordValidators::PercentageValidator do
76
77
 
77
78
  context 'with no maximum' do
78
79
  let(:okay) { 1000 }
80
+ let(:message) { 'must be a percentage (less than 100)' }
79
81
  let(:record) { NRB::Fake::NoMaxFakePercentage.new percentage: percentage }
80
82
  let(:too_small) { -1 }
81
83
 
@@ -87,6 +89,7 @@ describe NRB::BeerXML::RecordValidators::PercentageValidator do
87
89
 
88
90
  context 'with no minimum' do
89
91
  let(:okay) { -10 }
92
+ let(:message) { 'must be a percentage (greater than 0)' }
90
93
  let(:record) { NRB::Fake::NoMinFakePercentage.new percentage: percentage }
91
94
  let(:too_big) { 101 }
92
95
 
@@ -1,4 +1,5 @@
1
1
  require 'shared/active_model_lint'
2
+ require 'shared/record_typing'
2
3
 
3
4
  describe NRB::BeerXML::Style do
4
5
 
@@ -20,10 +21,10 @@ describe NRB::BeerXML::Style do
20
21
 
21
22
  it { should validate_inclusion_of(:type).in_array(%w(Ale Cider Lager Mead Mixed Wheat) ) }
22
23
 
23
- it { should validate_numericality_of(:abv_max).is_greater_than_or_equal_to(0) }
24
- it { should validate_numericality_of(:abv_min).is_greater_than_or_equal_to(0) }
25
- it { should validate_numericality_of(:carb_max).is_greater_than_or_equal_to(0) }
26
- it { should validate_numericality_of(:carb_min).is_greater_than_or_equal_to(0) }
24
+ it { should validate_numericality_of(:abv_max).is_greater_than_or_equal_to(0).allow_nil }
25
+ it { should validate_numericality_of(:abv_min).is_greater_than_or_equal_to(0).allow_nil }
26
+ it { should validate_numericality_of(:carb_max).is_greater_than_or_equal_to(0).allow_nil }
27
+ it { should validate_numericality_of(:carb_min).is_greater_than_or_equal_to(0).allow_nil }
27
28
  it { should validate_numericality_of(:color_max).is_greater_than_or_equal_to(0) }
28
29
  it { should validate_numericality_of(:color_min).is_greater_than_or_equal_to(0) }
29
30
  it { should validate_numericality_of(:fg_max).is_greater_than_or_equal_to(0) }
@@ -33,4 +34,8 @@ describe NRB::BeerXML::Style do
33
34
  it { should validate_numericality_of(:og_max).is_greater_than_or_equal_to(0) }
34
35
  it { should validate_numericality_of(:og_min).is_greater_than_or_equal_to(0) }
35
36
 
37
+ it_behaves_like :record_typing do
38
+ let(:type) { :style }
39
+ end
40
+
36
41
  end
@@ -1,4 +1,5 @@
1
1
  require 'shared/active_model_lint'
2
+ require 'shared/record_typing'
2
3
 
3
4
  describe NRB::BeerXML::Water do
4
5
 
@@ -17,9 +18,13 @@ describe NRB::BeerXML::Water do
17
18
  it { should validate_numericality_of :calcium }
18
19
  it { should validate_numericality_of :chloride }
19
20
  it { should validate_numericality_of :magnesium }
20
- it { should validate_numericality_of(:ph).is_greater_than_or_equal_to(0).is_less_than_or_equal_to(14) }
21
+ it { should validate_numericality_of(:ph).is_greater_than_or_equal_to(0).is_less_than_or_equal_to(14).allow_nil }
21
22
 
22
23
  it { should validate_numericality_of :sodium }
23
24
  it { should validate_numericality_of :sulfate }
24
25
 
26
+ it_behaves_like :record_typing do
27
+ let(:type) { :water }
28
+ end
29
+
25
30
  end
@@ -1,4 +1,5 @@
1
1
  require 'shared/active_model_lint'
2
+ require 'shared/record_typing'
2
3
 
3
4
  describe NRB::BeerXML::Yeast do
4
5
 
@@ -8,13 +9,17 @@ describe NRB::BeerXML::Yeast do
8
9
  it { should validate_presence_of :form }
9
10
  it { should validate_presence_of :type }
10
11
 
11
- it { should validate_inclusion_of(:flocculation).in_array(["High","Low","Medium","Very High"]) }
12
+ it { should validate_inclusion_of(:flocculation).in_array(["High","Low","Medium","Very High"]).allow_nil }
12
13
  it { should validate_inclusion_of(:form).in_array(%w(Culture Dry Liquid Slant )) }
13
14
  it { should validate_inclusion_of(:type).in_array(%w(Ale Champagne Lager Wheat Wine)) }
14
15
 
15
- it { should validate_numericality_of(:max_reuse).only_integer.is_greater_than_or_equal_to(0) }
16
- it { should validate_numericality_of(:max_temperature) }
17
- it { should validate_numericality_of(:min_temperature) }
18
- it { should validate_numericality_of(:times_cultured).only_integer.is_greater_than_or_equal_to(0) }
16
+ it { should validate_numericality_of(:max_reuse).only_integer.is_greater_than_or_equal_to(0).allow_nil }
17
+ it { should validate_numericality_of(:max_temperature).allow_nil }
18
+ it { should validate_numericality_of(:min_temperature).allow_nil }
19
+ it { should validate_numericality_of(:times_cultured).only_integer.is_greater_than_or_equal_to(0).allow_nil }
20
+
21
+ it_behaves_like :record_typing do
22
+ let(:type) { :yeast }
23
+ end
19
24
 
20
25
  end
@@ -157,9 +157,9 @@ Also called &quot;Crystal&quot; malt.</NOTES>
157
157
  <SUPPLIER></SUPPLIER>
158
158
  <NOTES>Imparts a rich sweet flavor. Used in Scottish ales, holiday ales and some old ales.</NOTES>
159
159
  <COARSE_FINE_DIFF>-</COARSE_FINE_DIFF>
160
- <MOISTURE>-</MOISTURE>
161
- <DIASTATIC_POWER>-</DIASTATIC_POWER>
162
- <PROTEIN>-</PROTEIN>
160
+ <MOISTURE></MOISTURE>
161
+ <DIASTATIC_POWER></DIASTATIC_POWER>
162
+ <PROTEIN></PROTEIN>
163
163
  <MAX_IN_BATCH>10.0</MAX_IN_BATCH>
164
164
  <RECOMMEND_MASH>FALSE</RECOMMEND_MASH>
165
165
  <IBU_GAL_PER_LB>0.000</IBU_GAL_PER_LB>
@@ -265,7 +265,7 @@ Example: Bass Ale</NOTES>
265
265
  <COLOR_MIN>6.00000000</COLOR_MIN>
266
266
  <COLOR_MAX>12.00000000</COLOR_MAX>
267
267
  <CARB_MIN>1.5</CARB_MIN>
268
- <CARB_MAX>2.4></CARB_MAX>
268
+ <CARB_MAX>2.4</CARB_MAX>
269
269
  <ABV_MAX>5.5</ABV_MAX>
270
270
  <ABV_MIN>4.5</ABV_MIN>
271
271
  <NOTES>Famous style from Burton-on-Trent. Stronger body than ordinary bitter, but slightly less bitter. A balanced, easy drinking beer that is malty and strong but not overbearing. </NOTES>
@@ -602,7 +602,7 @@ Gives &quot;dryness&quot; to a stout or porter -- much more so than regular Roas
602
602
  <COLOR_MIN>35.00000000</COLOR_MIN>
603
603
  <COLOR_MAX>200.00000000</COLOR_MAX>
604
604
  <CARB_MIN>1.6</CARB_MIN>
605
- <CARB_MAX>2.1></CARB_MAX>
605
+ <CARB_MAX>2.1</CARB_MAX>
606
606
  <ABV_MAX>5.5</ABV_MAX>
607
607
  <ABV_MIN>3.0</ABV_MIN>
608
608
  <NOTES>Famous Irish Stout (AKA Guiness). Dry roasted almost coffee like flavor. Irish versions have low starting gravity. Often mixed with soured, pasturized beer to give a slight acidity as well.</NOTES>
@@ -955,6 +955,21 @@ Use for: Bock, Porter, Marzen, Oktoberfest beers</NOTES>
955
955
  </YEASTS>
956
956
 
957
957
  <WATERS>
958
+ <WATER>
959
+ <NAME>Burton On Trent, UK</NAME>
960
+ <VERSION>1</VERSION>
961
+ <AMOUNT>18.927168</AMOUNT>
962
+ <CALCIUM>295.0</CALCIUM>
963
+ <BICARBONATE>300.0</BICARBONATE>
964
+ <SULFATE>725.0</SULFATE>
965
+ <CHLORIDE>25.0</CHLORIDE>
966
+ <SODIUM>55.0</SODIUM>
967
+ <MAGNESIUM>45.0</MAGNESIUM>
968
+ <PH>8.0</PH>
969
+ <NOTES>Distinctive pale ales strongly hopped. Very hard water accentuates the hops flavor.
970
+ Example: Bass Ale</NOTES>
971
+ <DISPLAY_AMOUNT>5.00 gal</DISPLAY_AMOUNT>
972
+ </WATER>
958
973
  </WATERS>
959
974
 
960
975
  <STYLE>
@@ -974,7 +989,7 @@ Use for: Bock, Porter, Marzen, Oktoberfest beers</NOTES>
974
989
  <COLOR_MIN>30.00000000</COLOR_MIN>
975
990
  <COLOR_MAX>60.00000000</COLOR_MAX>
976
991
  <CARB_MIN>1.8</CARB_MIN>
977
- <CARB_MAX>2.5></CARB_MAX>
992
+ <CARB_MAX>2.5</CARB_MAX>
978
993
  <ABV_MAX>6.0</ABV_MAX>
979
994
  <ABV_MIN>4.8</ABV_MIN>
980
995
  <NOTES>Stronger, darker version of porter with a slight dryness. Flavor derived from chocolate and black malts, but lacks the strong roasted flavor of a dry stout.</NOTES>
@@ -1256,6 +1271,21 @@ Examples: Belgian White beer, Wit</NOTES>
1256
1271
  </YEASTS>
1257
1272
 
1258
1273
  <WATERS>
1274
+ <WATER>
1275
+ <NAME>Burton On Trent, UK</NAME>
1276
+ <VERSION>1</VERSION>
1277
+ <AMOUNT>18.927168</AMOUNT>
1278
+ <CALCIUM>295.0</CALCIUM>
1279
+ <BICARBONATE>300.0</BICARBONATE>
1280
+ <SULFATE>725.0</SULFATE>
1281
+ <CHLORIDE>25.0</CHLORIDE>
1282
+ <SODIUM>55.0</SODIUM>
1283
+ <MAGNESIUM>45.0</MAGNESIUM>
1284
+ <PH>8.0</PH>
1285
+ <NOTES>Distinctive pale ales strongly hopped. Very hard water accentuates the hops flavor.
1286
+ Example: Bass Ale</NOTES>
1287
+ <DISPLAY_AMOUNT>5.00 gal</DISPLAY_AMOUNT>
1288
+ </WATER>
1259
1289
  </WATERS>
1260
1290
 
1261
1291
  <STYLE>
@@ -1275,7 +1305,7 @@ Examples: Belgian White beer, Wit</NOTES>
1275
1305
  <COLOR_MIN>2.00000000</COLOR_MIN>
1276
1306
  <COLOR_MAX>4.00000000</COLOR_MAX>
1277
1307
  <CARB_MIN>2.1</CARB_MIN>
1278
- <CARB_MAX>2.7></CARB_MAX>
1308
+ <CARB_MAX>2.7</CARB_MAX>
1279
1309
  <ABV_MAX>5.5</ABV_MAX>
1280
1310
  <ABV_MIN>4.1</ABV_MIN>
1281
1311
  <NOTES>Distinctive Wit or &quot;White&quot; beer spiced with bitter Curacao orange peel and coriander. A distinctive yeast strain provides orange aroma/flavor.</NOTES>
@@ -3,7 +3,7 @@ require 'active_model/lint'
3
3
 
4
4
  shared_examples_for :record_typing do
5
5
 
6
- let(:all_types) { %i( equipment fermentable hop mash_profile mash_step misc recipe style water yeast ) }
6
+ let(:all_types) { %i( equipment fermentable hop mash mash_step misc recipe style water yeast ) }
7
7
 
8
8
  it 'correctly answers to its own type' do
9
9
  expect subject.send("#{type}?")
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nrb-beerxml
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dean Brundage
@@ -137,6 +137,7 @@ files:
137
137
  - lib/nrb/beerxml/version.rb
138
138
  - lib/nrb/beerxml/water.rb
139
139
  - lib/nrb/beerxml/yeast.rb
140
+ - nrb-beerxml.gemspec
140
141
  - spec/cases/beerxml/builder_spec.rb
141
142
  - spec/cases/beerxml/equipment_spec.rb
142
143
  - spec/cases/beerxml/fermentable_spec.rb