Commit 5dd18d6f4a70a4d167d3f62f3c7c8a4450e8c7f8
1 parent
6a76dc11
Exists in
colab
and in
4 other branches
Fixed beginning uniqueness validator error.
signed-off-by: Renan Fichberg <rfichberg@gmail.com> signed-off-by: Guilherme Rojas V. de Lima <guilhermehrojas@gmail.com>
Showing
2 changed files
with
7 additions
and
2 deletions
Show diff stats
app/controllers/mezuro_ranges_controller.rb
| ... | ... | @@ -49,6 +49,7 @@ class MezuroRangesController < ApplicationController |
| 49 | 49 | private |
| 50 | 50 | |
| 51 | 51 | def mezuro_range_params |
| 52 | + params[:mezuro_range][:beginning] = params[:mezuro_range][:beginning].to_f.to_s if numeric?(params[:mezuro_range][:beginning]) # this is necessary for the beginning validator | |
| 52 | 53 | params[:mezuro_range] |
| 53 | 54 | end |
| 54 | 55 | |
| ... | ... | @@ -78,6 +79,10 @@ class MezuroRangesController < ApplicationController |
| 78 | 79 | @metric_configuration_id = params[:metric_configuration_id].to_i |
| 79 | 80 | end |
| 80 | 81 | |
| 82 | + # used on mezuro_range_params | |
| 83 | + def numeric?(text) | |
| 84 | + Float(text) != nil rescue false | |
| 85 | + end | |
| 81 | 86 | |
| 82 | 87 | def set_mezuro_range |
| 83 | 88 | @mezuro_range = MezuroRange.find(params[:id].to_i) | ... | ... |
features/mezuro_range/deletion.feature
| ... | ... | @@ -13,7 +13,7 @@ Feature: Range Deletion |
| 13 | 13 | And I have a sample reading within the sample reading group labeled "My Reading" |
| 14 | 14 | And I have a sample range within the sample metric configuration |
| 15 | 15 | And I am at the sample metric configuration page |
| 16 | - When I click the Destroy Range link | |
| 16 | + When I click the Destroy link | |
| 17 | 17 | Then I should be at metric configuration sample page |
| 18 | 18 | And I should see "There are no ranges yet!" |
| 19 | 19 | |
| ... | ... | @@ -27,4 +27,4 @@ Feature: Range Deletion |
| 27 | 27 | And I have a sample reading within the sample reading group labeled "My Reading" |
| 28 | 28 | And I have a sample range within the sample metric configuration |
| 29 | 29 | When I am at the sample metric configuration page |
| 30 | - Then I should not see "Destroy Range" | |
| 30 | + Then I should not see "Destroy" | ... | ... |