diff --git a/features/mezuro_range/deletion.feature b/features/mezuro_range/deletion.feature index 464466e..86a3da0 100644 --- a/features/mezuro_range/deletion.feature +++ b/features/mezuro_range/deletion.feature @@ -17,7 +17,7 @@ Feature: Range Deletion Then I should be at metric configuration sample page And I should see "There are no ranges yet!" - @kalibro_restart @wip @javascript + @kalibro_restart Scenario: Should not see the destroy range link in the range that I not own Given I am a regular user And I am signed in @@ -27,5 +27,4 @@ Feature: Range Deletion And I have a sample reading within the sample reading group labeled "My Reading" And I have a sample range within the sample metric configuration When I am at the sample metric configuration page - And I take a picture of the page Then I should not see "Destroy Range" diff --git a/features/mezuro_range/edit.feature b/features/mezuro_range/edit.feature new file mode 100644 index 0000000..ed80c1a --- /dev/null +++ b/features/mezuro_range/edit.feature @@ -0,0 +1,36 @@ +Feature: Mezuro Range Edit + In Order to be able to update my mezuro range info + As a regular user + I should be able to edit my mezuro ranges + + @kalibro_restart + Scenario: editing a mezuro range successfully + Given I am a regular user + And I am signed in + And I own a sample configuration + And I own a sample reading group + And I have a sample metric configuration within the given mezuro configuration + And I have a sample reading within the sample reading group labeled "My Reading" + And I have a sample range within the sample metric configuration with beginning "1.1" + And I am at the Edit Mezuro Range page + And the select field "Reading" is set as "My Reading" + And the field "Beginning" should be filled with "1.1" + And the field "End" should be filled with "5.1" + And the field "Comments" should be filled with "Comment" + When I fill the Beginning field with "2.2" + And I press the Save button + Then I should see "2.2" + + @kalibro_restart + Scenario: editing a mezuro range with blank fields + Given I am a regular user + And I am signed in + And I own a sample configuration + And I own a sample reading group + And I have a sample metric configuration within the given mezuro configuration + And I have a sample reading within the sample reading group labeled "My Reading" + And I have a sample range within the sample metric configuration with beginning "1" + And I am at the Edit Mezuro Range page + When I fill the Beginning field with " " + And I press the Save button + Then I should see "Beginning can't be blank" diff --git a/features/step_definitions/mezuro_range_steps.rb b/features/step_definitions/mezuro_range_steps.rb index 74081a2..7e0105d 100644 --- a/features/step_definitions/mezuro_range_steps.rb +++ b/features/step_definitions/mezuro_range_steps.rb @@ -3,6 +3,14 @@ Given(/^I have a sample range within the sample metric configuration with beginn reading_id: @reading.id, id: nil}) end +Given(/^I am at the Edit Mezuro Range page$/) do + visit edit_mezuro_configuration_metric_configuration_mezuro_range_path(@metric_configuration.configuration_id, @metric_configuration.id, @mezuro_range.id) +end + +Given(/^the select field "(.*?)" is set as "(.*?)"$/) do |field, text| + select text, from: field +end + Given(/^I have a sample range within the sample metric configuration$/) do @mezuro_range = FactoryGirl.create(:mezuro_range, {metric_configuration_id: @metric_configuration.id, reading_id: @reading.id, id: nil}) -- libgit2 0.21.2