Commit 2dbd28489f8adf1c6cb5de06c60e070d4c54a0c7
Committed by
Rafael Manzo
1 parent
933ff3c4
Exists in
colab
and in
4 other branches
Acceptance test for Range create feature
signed-off-by: Diego Araújo <diegoamc90@gmail.com>
Showing
3 changed files
with
170 additions
and
1 deletions
Show diff stats
| ... | ... | @@ -0,0 +1,143 @@ |
| 1 | +Feature: Create range | |
| 2 | + In order to be able to create new ranges | |
| 3 | + As a metric specialist | |
| 4 | + I should be able to fill up a form with its informations and submit it | |
| 5 | + | |
| 6 | + @kalibro_restart | |
| 7 | + Scenario: Visiting range creation page when the user own an non-empty reading group | |
| 8 | + Given I am a regular user | |
| 9 | + And I am signed in | |
| 10 | + And I own a sample configuration | |
| 11 | + And I own a sample reading group | |
| 12 | + And I have a sample metric configuration within the given mezuro configuration | |
| 13 | + And I have a sample reading within the sample reading group labeled "My Reading" | |
| 14 | + And I am at the sample metric configuration page | |
| 15 | + When I click the Add Range link | |
| 16 | + Then I should be at the New Range page | |
| 17 | + And I should see "Beginning" | |
| 18 | + And I should see "End" | |
| 19 | + And I should see "Comments" | |
| 20 | + And I should see "Reading" | |
| 21 | + | |
| 22 | + @kalibro_restart | |
| 23 | + Scenario: Visiting range creation page when the user don't own the reading group and this reading group is empty | |
| 24 | + Given I am a regular user | |
| 25 | + And I am signed in | |
| 26 | + And I own a sample configuration | |
| 27 | + And I have a reading group named "Scholar" | |
| 28 | + And I have a sample metric configuration within the given mezuro configuration | |
| 29 | + And I am at the sample metric configuration page | |
| 30 | + When I click the Add Range link | |
| 31 | + Then I should be at the New Range page | |
| 32 | + And I should see "Beginning" | |
| 33 | + And I should see "End" | |
| 34 | + And I should see "Comments" | |
| 35 | + And I should see "You must have readings in your associated reading group to create a new range." | |
| 36 | + And I should see "Your metric configurations' reading group belongs to another user and you are not allowed to modify it." | |
| 37 | + | |
| 38 | + @kalibro_restart | |
| 39 | + Scenario: Visiting range creation page when the user own an empty reading group (testing link to New Reading) | |
| 40 | + Given I am a regular user | |
| 41 | + And I am signed in | |
| 42 | + And I own a sample configuration | |
| 43 | + And I own a sample reading group | |
| 44 | + And I have a sample metric configuration within the given mezuro configuration | |
| 45 | + And I am at the sample metric configuration page | |
| 46 | + When I click the Add Range link | |
| 47 | + Then I should be at the New Range page | |
| 48 | + And I should see "Beginning" | |
| 49 | + And I should see "End" | |
| 50 | + And I should see "Comments" | |
| 51 | + And I should see "You must have readings in your associated reading group to create a new range." | |
| 52 | + When I click the Create New Reading link | |
| 53 | + Then I should be at the New Reading page | |
| 54 | + And I take a picture of the page | |
| 55 | + And I should see "Label" | |
| 56 | + And I should see "Grade" | |
| 57 | + And I should see "Color" | |
| 58 | + | |
| 59 | + @kalibro_restart | |
| 60 | + Scenario: With valid fields and owning a non-empty reading group | |
| 61 | + Given I am a regular user | |
| 62 | + And I am signed in | |
| 63 | + And I own a sample configuration | |
| 64 | + And I own a sample reading group | |
| 65 | + And I have a sample metric configuration within the given mezuro configuration | |
| 66 | + And I have a sample reading within the sample reading group labeled "My Reading" | |
| 67 | + And I am at the New Range page | |
| 68 | + And I fill the Beginning field with "42" | |
| 69 | + And I fill the End field with "666" | |
| 70 | + And I fill the Comments field with "My Comment" | |
| 71 | + And I set the select field "Reading" as "My Reading" | |
| 72 | + When I press the Save button | |
| 73 | + Then I should be at metric configuration sample page | |
| 74 | + | |
| 75 | + @kalibro_restart | |
| 76 | + Scenario: With invalid fields and owning a non-empty reading group (Beginning > End) | |
| 77 | + Given I am a regular user | |
| 78 | + And I am signed in | |
| 79 | + And I own a sample configuration | |
| 80 | + And I own a sample reading group | |
| 81 | + And I have a sample metric configuration within the given mezuro configuration | |
| 82 | + And I have a sample reading within the sample reading group labeled "My Reading" | |
| 83 | + And I am at the New Range page | |
| 84 | + And I fill the Beginning field with "666" | |
| 85 | + And I fill the End field with "42" | |
| 86 | + And I fill the Comments field with "My Comment" | |
| 87 | + And I set the select field "Reading" as "My Reading" | |
| 88 | + When I press the Save button | |
| 89 | + Then I should be at the New Range page | |
| 90 | + And I should see "1 error prohibited this MezuroRange from getting saved" | |
| 91 | + And I should see "[666.0, 42.0[ is not a valid range" | |
| 92 | + | |
| 93 | + @kalibro_restart | |
| 94 | + Scenario: With an invalid beggining (not a number) | |
| 95 | + Given I am a regular user | |
| 96 | + And I am signed in | |
| 97 | + And I own a sample configuration | |
| 98 | + And I own a sample reading group | |
| 99 | + And I have a sample metric configuration within the given mezuro configuration | |
| 100 | + And I have a sample reading within the sample reading group labeled "My Reading" | |
| 101 | + And I am at the New Range page | |
| 102 | + And I fill the Beginning field with "z" | |
| 103 | + And I fill the End field with "42" | |
| 104 | + And I fill the Comments field with "My Comment" | |
| 105 | + And I set the select field "Reading" as "My Reading" | |
| 106 | + When I press the Save button | |
| 107 | + Then I should be at the New Range page | |
| 108 | + And I should see "1 error prohibited this MezuroRange from getting saved" | |
| 109 | + | |
| 110 | + @kalibro_restart | |
| 111 | + Scenario: With an invalid end (not a number) | |
| 112 | + Given I am a regular user | |
| 113 | + And I am signed in | |
| 114 | + And I own a sample configuration | |
| 115 | + And I own a sample reading group | |
| 116 | + And I have a sample metric configuration within the given mezuro configuration | |
| 117 | + And I have a sample reading within the sample reading group labeled "My Reading" | |
| 118 | + And I am at the New Range page | |
| 119 | + And I fill the Beginning field with "42" | |
| 120 | + And I fill the End field with "z" | |
| 121 | + And I fill the Comments field with "My Comment" | |
| 122 | + And I set the select field "Reading" as "My Reading" | |
| 123 | + When I press the Save button | |
| 124 | + Then I should see "1 error prohibited this MezuroRange from getting saved" | |
| 125 | + And I should be at the New Range page | |
| 126 | + | |
| 127 | + @kalibro_restart | |
| 128 | + Scenario: With an already taken beginning | |
| 129 | + Given I am a regular user | |
| 130 | + And I am signed in | |
| 131 | + And I own a sample configuration | |
| 132 | + And I own a sample reading group | |
| 133 | + And I have a sample metric configuration within the given mezuro configuration | |
| 134 | + And I have a sample reading within the sample reading group labeled "My Reading" | |
| 135 | + And I have a sample range within the sample metric configuration with beginning "2" | |
| 136 | + And I am at the New Range page | |
| 137 | + And I fill the Beginning field with "2" | |
| 138 | + And I fill the End field with "666" | |
| 139 | + And I fill the Comments field with "My Comment" | |
| 140 | + And I set the select field "Reading" as "My Reading" | |
| 141 | + When I press the Save button | |
| 142 | + Then I should be at the New Range page | |
| 143 | + And I should see "1 error prohibited this MezuroRange from getting saved" | ... | ... |
features/step_definitions/metric_configuration_steps.rb
| ... | ... | @@ -12,6 +12,16 @@ When(/^I visit the sample metric configuration edit page$/) do |
| 12 | 12 | visit edit_mezuro_configuration_metric_configuration_path(@metric_configuration.configuration_id, @metric_configuration.id) |
| 13 | 13 | end |
| 14 | 14 | |
| 15 | +When(/^I visit the sample metric configuration page$/) do | |
| 16 | + visit mezuro_configuration_metric_configuration_path(@metric_configuration.configuration_id, @metric_configuration.id) | |
| 17 | +end | |
| 18 | + | |
| 19 | +Then(/^I am at the sample metric configuration page$/) do | |
| 20 | + visit mezuro_configuration_metric_configuration_path(@metric_configuration.configuration_id, @metric_configuration.id) | |
| 21 | + page.should have_content(@metric_configuration.metric.name) | |
| 22 | + page.should have_content("Ranges") | |
| 23 | +end | |
| 24 | + | |
| 15 | 25 | Then(/^I should see the sample metric configuration content$/) do |
| 16 | 26 | page.should have_content(@metric_configuration.metric.name) |
| 17 | 27 | page.should have_content(@metric_configuration.code) |
| ... | ... | @@ -26,4 +36,4 @@ end |
| 26 | 36 | Then(/^I should be at metric configuration sample page$/) do |
| 27 | 37 | page.should have_content(@metric_configuration.metric.name) |
| 28 | 38 | page.should have_content("Ranges") |
| 29 | -end | |
| 30 | 39 | \ No newline at end of file |
| 40 | +end | ... | ... |
| ... | ... | @@ -0,0 +1,16 @@ |
| 1 | +Given(/^I have a sample range within the sample metric configuration with beginning "(.*?)"$/) do |beginning| | |
| 2 | + @mezuro_range = FactoryGirl.create(:mezuro_range, {beginning: beginning, metric_configuration_id: @metric_configuration.id, | |
| 3 | + reading_id: @reading.id, id: nil}) | |
| 4 | +end | |
| 5 | + | |
| 6 | +Then(/^I should be at the New Range page$/) do | |
| 7 | + page.should have_content("New Range") | |
| 8 | + page.should have_content("Beginning") | |
| 9 | + page.should have_content("End") | |
| 10 | + page.should have_content("Comments") | |
| 11 | +end | |
| 12 | + | |
| 13 | +When(/^I am at the New Range page$/) do | |
| 14 | + visit mezuro_configuration_metric_configuration_new_mezuro_range_path(@metric_configuration.configuration_id, @metric_configuration.id) | |
| 15 | +end | |
| 16 | + | ... | ... |