ski_binding_calculator 0.6.9 → 0.7.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.
@@ -21,17 +21,23 @@ class SkiBinding::Calculator
|
|
21
21
|
|
22
22
|
if attrs[:weight].blank?
|
23
23
|
error.add_message(*[:weight, "weight is blank"])
|
24
|
-
|
24
|
+
end
|
25
|
+
if attrs[:height].blank?
|
25
26
|
error.add_message(*[:height, "height is blank"])
|
26
|
-
|
27
|
+
end
|
28
|
+
if attrs[:sole_length].blank?
|
27
29
|
error.add_message(*[:sole_length, "sole length is blank"])
|
28
|
-
|
30
|
+
end
|
31
|
+
if attrs[:birthday_year].blank?
|
29
32
|
error.add_message(*[:birthday_year, "birthday year is blank"])
|
30
|
-
|
33
|
+
end
|
34
|
+
if attrs[:birthday_month].blank?
|
31
35
|
error.add_message(*[:birthday_month, "birthday month is blank"])
|
32
|
-
|
36
|
+
end
|
37
|
+
if attrs[:birthday_day].blank?
|
33
38
|
error.add_message(*[:birthday_day, "birthday day is blank"])
|
34
|
-
|
39
|
+
end
|
40
|
+
if attrs[:type].blank?
|
35
41
|
error.add_message(*[:type, "type is blank"])
|
36
42
|
end
|
37
43
|
|
data/spec/lib/calculator_spec.rb
CHANGED
@@ -70,12 +70,9 @@ describe SkiBinding::Calculator do
|
|
70
70
|
end
|
71
71
|
|
72
72
|
it "raise error with two messages" do
|
73
|
-
expect { calculated_attr_validation }.to raise_error(SkiBinding::Error)
|
74
|
-
e.
|
75
|
-
end
|
73
|
+
expect { calculated_attr_validation }.to raise_error(SkiBinding::Error) { |e|
|
74
|
+
e.messages.should == {:weight => "weight is blank", :height => "height is blank"} }
|
76
75
|
end
|
77
|
-
#it { expect { calculated_attr_validation }
|
78
|
-
# .to raise_error(ArgumentError, "height is blank") }
|
79
76
|
end
|
80
77
|
|
81
78
|
describe "#prep_attributes" do
|