ski_binding_calculator 0.8.2 → 0.8.5

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.
@@ -36,7 +36,13 @@ class SkiBinding::Calculator
36
36
  raise SkiBinding::Error.new(*[:weight, "is less than 10kg"])
37
37
  end
38
38
  hashy[:height] = attrs[:height].to_f
39
+ if hashy[:height] <= 0.0
40
+ raise SkiBinding::Error.new(*[:height, "must be bigger than 0"])
41
+ end
39
42
  hashy[:sole_length] = attrs[:sole_length].to_f
43
+ if hashy[:sole_length] <= 0.0
44
+ raise SkiBinding::Error.new(*[:sole_length, "must be bigger than 0"])
45
+ end
40
46
  hashy[:birthday_year] = attrs[:birthday_year].to_i
41
47
  hashy[:birthday_month] = attrs[:birthday_month].to_i
42
48
  hashy[:birthday_day] = attrs[:birthday_day].to_i
@@ -1,3 +1,3 @@
1
1
  module SkiBinding
2
- VERSION = "0.8.2"
2
+ VERSION = "0.8.5"
3
3
  end
@@ -93,14 +93,36 @@ describe SkiBinding::Calculator do
93
93
  end
94
94
  end
95
95
 
96
- context "when weight is less than 9kg" do
96
+ context "when weight is less than 10kg" do
97
97
  let(:parameters) do
98
98
  skiers_parameter[:weight] = 9
99
99
  skiers_parameter
100
100
  end
101
101
  it "raises SkiBinding::Error" do
102
- expect { calculated_preped }.to raise_error(SkiBinding::Error) { |e|
103
- e.messages.should == { :weight => "is less than 10kg" } }
102
+ expect { calculated_preped }.to raise_error(SkiBinding::Error) { |e|
103
+ e.messages.should == { :weight => "is less than 10kg" } }
104
+ end
105
+ end
106
+
107
+ context "when height is less than one" do
108
+ let(:parameters) do
109
+ skiers_parameter[:height] = 0
110
+ skiers_parameter
111
+ end
112
+ it "raises SkiBinding::Error" do
113
+ expect { calculated_preped }.to raise_error(SkiBinding::Error) { |e|
114
+ e.messages.should == { :height => "must be bigger than 0" } }
115
+ end
116
+ end
117
+
118
+ context "when sole_length is less than one" do
119
+ let(:parameters) do
120
+ skiers_parameter[:sole_length] = 0
121
+ skiers_parameter
122
+ end
123
+ it "raises SkiBinding::Error" do
124
+ expect { calculated_preped }.to raise_error(SkiBinding::Error) { |e|
125
+ e.messages.should == { :sole_length => "must be bigger than 0" } }
104
126
  end
105
127
  end
106
128
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ski_binding_calculator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.2
4
+ version: 0.8.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-08-18 00:00:00.000000000 Z
12
+ date: 2014-02-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport