Commit 7941cd80be4f12567f84e2011e4d7bf8ef687fb0
Committed by
Rafael Manzo
1 parent
b0c9c0d7
Exists in
colab
and in
4 other branches
Fixed acceptance tests for new required fields
Signed off by: Heitor Reis <marcheing@gmail.com>
Showing
2 changed files
with
7 additions
and
3 deletions
Show diff stats
app/models/validators/name_script_presence_validator.rb
| 1 | 1 | class NameScriptPresenceValidator < ActiveModel::Validator |
| 2 | 2 | def validate(record) |
| 3 | - if record.metric.name.empty? | |
| 3 | + if record.metric.name.strip.empty? | |
| 4 | 4 | record.errors[:name] << "can't be blank" |
| 5 | 5 | end |
| 6 | - if record.metric.script.empty? | |
| 6 | + if record.metric.script.strip.empty? | |
| 7 | 7 | record.errors[:script] << "can't be blank" |
| 8 | 8 | end |
| 9 | 9 | end | ... | ... |
features/compound_metric_configuration/edition.feature
| ... | ... | @@ -39,14 +39,18 @@ Feature: Compound Metric Configuration edition |
| 39 | 39 | And I have a sample metric configuration within the given mezuro configuration |
| 40 | 40 | And I have a sample compound metric configuration within the given mezuro configuration |
| 41 | 41 | When I visit the sample compound metric configuration edit page |
| 42 | + And I fill the Name field with " " | |
| 43 | + And I fill the Script field with " " | |
| 42 | 44 | And I fill the Code field with " " |
| 43 | 45 | And I fill the Weight field with " " |
| 44 | - And I fill the Name field with " " | |
| 45 | 46 | And I press the Save button |
| 46 | 47 | Then I should see "Edit Compound Metric Configuration" |
| 48 | + And I should see "Name can't be blank" | |
| 49 | + And I should see "Script can't be blank" | |
| 47 | 50 | And I should see "Code can't be blank" |
| 48 | 51 | And I should see "Weight can't be blank" |
| 49 | 52 | |
| 53 | + | |
| 50 | 54 | @kalibro_restart |
| 51 | 55 | Scenario: trying to edit with an existing code |
| 52 | 56 | Given I am a regular user | ... | ... |