Commit f5693a835caa3e9b49c85a22502f0994002fd962

Authored by Rafael Manzo
1 parent ac3f9b5f

Fixes range overlapping checking

All the values are converted to Float

Signed off by: Diego Araújo <diegoamc90@gmail.com>
app/models/validators/range_overlapping_validator.rb
... ... @@ -21,6 +21,7 @@ class RangeOverlappingValidator &lt; ActiveModel::Validator
21 21 def to_float(value)
22 22 return 1.0/0 if value=="INF"
23 23 return -1.0/0 if value=="-INF"
  24 + return value.to_f if value.is_a?(String)
24 25 return value
25 26 end
26 27 end
... ...
features/mezuro_range/create.feature
... ... @@ -158,4 +158,28 @@ Feature: Create range
158 158 When I press the Save button
159 159 Then I should be at metric configuration sample page
160 160 And I should see "-INF"
  161 + And I should see "INF"
  162 +
  163 + @kalibro_restart @javascript
  164 + Scenario: Two valid ranges (one with INF)
  165 + Given I am a regular user
  166 + And I am signed in
  167 + And I own a sample configuration
  168 + And I own a sample reading group
  169 + And I have a sample metric configuration within the given mezuro configuration
  170 + And I have a sample reading within the sample reading group labeled "My Reading"
  171 + And I am at the New Range page
  172 + And I fill the Beginning field with "2"
  173 + And I fill the End field with "666"
  174 + And I fill the Comments field with "My Comment"
  175 + And I set the select field "Reading" as "My Reading"
  176 + And I press the Save button
  177 + And I am at the New Range page
  178 + And I fill the Beginning field with "666"
  179 + And I click the ∞ link
  180 + And I fill the Comments field with "My Comment"
  181 + And I set the select field "Reading" as "My Reading"
  182 + When I press the Save button
  183 + Then I should be at metric configuration sample page
  184 + And I should see "666"
161 185 And I should see "INF"
162 186 \ No newline at end of file
... ...