Commit 03e60525cc15278437f3a3d6e5ce91c41e22abf2
1 parent
7b2c5ab7
Exists in
colab
and in
4 other branches
cucumber steps using expects instead of should
Showing
9 changed files
with
65 additions
and
65 deletions
Show diff stats
features/step_definitions/compound_metric_configuration_steps.rb
| 1 | 1 | Given(/^I see the sample metric configuration name$/) do |
| 2 | - page.should have_content(@metric_configuration.metric.name) | |
| 2 | + expect(page).to have_content(@metric_configuration.metric.name) | |
| 3 | 3 | end |
| 4 | 4 | |
| 5 | 5 | Given(/^I see the sample metric configuration code$/) do |
| 6 | - page.should have_content(@metric_configuration.code) | |
| 6 | + expect(page).to have_content(@metric_configuration.code) | |
| 7 | 7 | end |
| 8 | 8 | |
| 9 | 9 | Given(/^I have a sample compound metric configuration within the given mezuro configuration$/) do |
| ... | ... | @@ -23,6 +23,6 @@ When(/^I click the edit link of the Coumpound Metric$/) do |
| 23 | 23 | end |
| 24 | 24 | |
| 25 | 25 | Then(/^I should be at compound metric configuration sample page$/) do |
| 26 | - page.should have_content(@compound_metric_configuration.metric.name) | |
| 27 | - page.should have_content("Ranges") | |
| 26 | + expect(page).to have_content(@compound_metric_configuration.metric.name) | |
| 27 | + expect(page).to have_content("Ranges") | |
| 28 | 28 | end | ... | ... |
features/step_definitions/configuration_steps.rb
| ... | ... | @@ -37,15 +37,15 @@ When(/^I visit the sample configuration edit page$/) do |
| 37 | 37 | end |
| 38 | 38 | |
| 39 | 39 | Then(/^I should be in the Edit Configuration page$/) do |
| 40 | - page.should have_content("Edit Configuration") | |
| 40 | + expect(page).to have_content("Edit Configuration") | |
| 41 | 41 | end |
| 42 | 42 | |
| 43 | 43 | Then(/^The field "(.*?)" should be filled with the sample configuration "(.*?)"$/) do |field, value| |
| 44 | - page.find_field(field).value.should eq(@mezuro_configuration.send(value)) | |
| 44 | + expect(page.find_field(field).value).to eq(@mezuro_configuration.send(value)) | |
| 45 | 45 | end |
| 46 | 46 | |
| 47 | 47 | Then(/^I should be in the All configurations page$/) do |
| 48 | - page.should have_content("Configurations") | |
| 48 | + expect(page).to have_content("Configurations") | |
| 49 | 49 | end |
| 50 | 50 | |
| 51 | 51 | Then(/^the sample configuration should not be there$/) do |
| ... | ... | @@ -53,6 +53,6 @@ Then(/^the sample configuration should not be there$/) do |
| 53 | 53 | end |
| 54 | 54 | |
| 55 | 55 | Then(/^the sample configuration should be there$/) do |
| 56 | - page.should have_content(@mezuro_configuration.name) | |
| 57 | - page.should have_content(@mezuro_configuration.description) | |
| 56 | + expect(page).to have_content(@mezuro_configuration.name) | |
| 57 | + expect(page).to have_content(@mezuro_configuration.description) | |
| 58 | 58 | end |
| 59 | 59 | \ No newline at end of file | ... | ... |
features/step_definitions/homepage_steps.rb
features/step_definitions/metric_configuration_steps.rb
| 1 | 1 | Given(/^I have a sample metric configuration within the given mezuro configuration$/) do |
| 2 | - @metric_configuration = FactoryGirl.create(:metric_configuration, | |
| 2 | + @metric_configuration = FactoryGirl.create(:metric_configuration, | |
| 3 | 3 | {id: nil, configuration_id: @mezuro_configuration.id, reading_group_id: @reading_group.id} ) |
| 4 | 4 | end |
| 5 | 5 | |
| ... | ... | @@ -22,21 +22,21 @@ end |
| 22 | 22 | |
| 23 | 23 | Then(/^I am at the sample metric configuration page$/) do |
| 24 | 24 | visit mezuro_configuration_metric_configuration_path(@metric_configuration.configuration_id, @metric_configuration.id) |
| 25 | - page.should have_content(@metric_configuration.metric.name) | |
| 26 | - page.should have_content("Ranges") | |
| 25 | + expect(page).to have_content(@metric_configuration.metric.name) | |
| 26 | + expect(page).to have_content("Ranges") | |
| 27 | 27 | end |
| 28 | 28 | |
| 29 | 29 | Then(/^I should see the sample metric configuration content$/) do |
| 30 | - page.should have_content(@metric_configuration.metric.name) | |
| 31 | - page.should have_content(@metric_configuration.code) | |
| 32 | - page.should have_content(@metric_configuration.weight) | |
| 30 | + expect(page).to have_content(@metric_configuration.metric.name) | |
| 31 | + expect(page).to have_content(@metric_configuration.code) | |
| 32 | + expect(page).to have_content(@metric_configuration.weight) | |
| 33 | 33 | end |
| 34 | 34 | |
| 35 | 35 | Then(/^I should be at metric configuration sample page$/) do |
| 36 | - page.should have_content(@metric_configuration.metric.name) | |
| 37 | - page.should have_content("Ranges") | |
| 36 | + expect(page).to have_content(@metric_configuration.metric.name) | |
| 37 | + expect(page).to have_content("Ranges") | |
| 38 | 38 | end |
| 39 | 39 | |
| 40 | 40 | Then(/^I should be at the choose metric page$/) do |
| 41 | - page.should have_content("Choose a metric from a base tool:") | |
| 41 | + expect(page).to have_content("Choose a metric from a base tool:") | |
| 42 | 42 | end | ... | ... |
features/step_definitions/mezuro_range_steps.rb
| ... | ... | @@ -26,16 +26,16 @@ When(/^I am at the New Range page$/) do |
| 26 | 26 | end |
| 27 | 27 | |
| 28 | 28 | Then(/^I should be at the New Range page$/) do |
| 29 | - page.should have_content("New Range") | |
| 30 | - page.should have_content("Beginning") | |
| 31 | - page.should have_content("End") | |
| 32 | - page.should have_content("Comments") | |
| 29 | + expect(page).to have_content("New Range") | |
| 30 | + expect(page).to have_content("Beginning") | |
| 31 | + expect(page).to have_content("End") | |
| 32 | + expect(page).to have_content("Comments") | |
| 33 | 33 | end |
| 34 | 34 | |
| 35 | 35 | Then(/^I should see the sample range$/) do |
| 36 | - page.should have_content(@mezuro_range.label) | |
| 37 | - page.should have_content(@mezuro_range.beginning) | |
| 38 | - page.should have_content(@mezuro_range.end) | |
| 36 | + expect(page).to have_content(@mezuro_range.label) | |
| 37 | + expect(page).to have_content(@mezuro_range.beginning) | |
| 38 | + expect(page).to have_content(@mezuro_range.end) | |
| 39 | 39 | end |
| 40 | 40 | |
| 41 | 41 | ... | ... |
features/step_definitions/project_steps.rb
| ... | ... | @@ -39,40 +39,40 @@ Given(/^I am at the New Project page$/) do |
| 39 | 39 | end |
| 40 | 40 | |
| 41 | 41 | Then(/^I should not see (.+)$/) do |text| |
| 42 | - page.should_not have_content(text) | |
| 42 | + expect(page).to_not have_content(text) | |
| 43 | 43 | end |
| 44 | 44 | |
| 45 | 45 | #FIXME: this is step is not matched |
| 46 | 46 | Then(/^I should not see "(.+)"" within "(.+)"$/) do |text, selector| |
| 47 | - page.find(selector).should_not have_content(text) | |
| 47 | + expect(page.find(selector)).to_not have_content(text) | |
| 48 | 48 | end |
| 49 | 49 | |
| 50 | 50 | Then(/^the sample project should be there$/) do |
| 51 | - page.should have_content(@project.name) | |
| 52 | - page.should have_content(@project.description) | |
| 51 | + expect(page).to have_content(@project.name) | |
| 52 | + expect(page).to have_content(@project.description) | |
| 53 | 53 | end |
| 54 | 54 | |
| 55 | 55 | Then(/^I should be in the All Projects page$/) do |
| 56 | - page.should have_content("Projects") | |
| 56 | + expect(page).to have_content("Projects") | |
| 57 | 57 | end |
| 58 | 58 | |
| 59 | 59 | Then(/^I should be in the Edit Project page$/) do |
| 60 | - page.should have_content("Edit Project") | |
| 60 | + expect(page).to have_content("Edit Project") | |
| 61 | 61 | end |
| 62 | 62 | |
| 63 | 63 | Then(/^I should be in the Sample Project page$/) do |
| 64 | - page.should have_content(@project.name) | |
| 65 | - page.should have_content(@project.description) | |
| 64 | + expect(page).to have_content(@project.name) | |
| 65 | + expect(page).to have_content(@project.description) | |
| 66 | 66 | end |
| 67 | 67 | |
| 68 | 68 | Then(/^I should be in the Login page$/) do |
| 69 | - page.should have_content("Sign in") | |
| 69 | + expect(page).to have_content("Sign in") | |
| 70 | 70 | end |
| 71 | 71 | |
| 72 | 72 | Then(/^the sample project should not be there$/) do |
| 73 | - expect { Project.find(@project.id) }.to raise_error | |
| 73 | + expect { Project.find(@project.id) }.to raise_error | |
| 74 | 74 | end |
| 75 | 75 | |
| 76 | 76 | Then(/^The field "(.*?)" should be filled with the sample project "(.*?)"$/) do |field, value| |
| 77 | - page.find_field(field).value.should eq(@project.send(value)) | |
| 77 | + expect(page.find_field(field).value).to eq(@project.send(value)) | |
| 78 | 78 | end | ... | ... |
features/step_definitions/reading_group_steps.rb
| ... | ... | @@ -43,21 +43,21 @@ When(/^I visit the sample reading group edit page$/) do |
| 43 | 43 | end |
| 44 | 44 | |
| 45 | 45 | Then(/^The field "(.*?)" should be filled with the sample reading group "(.*?)"$/) do |field, value| |
| 46 | - page.find_field(field).value.should eq(@reading_group.send(value)) | |
| 46 | + expect(page.find_field(field).value).to eq(@reading_group.send(value)) | |
| 47 | 47 | end |
| 48 | 48 | |
| 49 | 49 | Then(/^I should be in the Sample Reading Group page$/) do |
| 50 | - page.should have_content(@reading_group.name) | |
| 51 | - page.should have_content(@reading_group.description) | |
| 50 | + expect(page).to have_content(@reading_group.name) | |
| 51 | + expect(page).to have_content(@reading_group.description) | |
| 52 | 52 | end |
| 53 | 53 | |
| 54 | 54 | Then(/^I should see the information of the sample reading$/) do |
| 55 | - page.should have_content(@reading.label) | |
| 56 | - page.should have_content(@reading.grade) | |
| 55 | + expect(page).to have_content(@reading.label) | |
| 56 | + expect(page).to have_content(@reading.grade) | |
| 57 | 57 | pager = page.body |
| 58 | 58 | color = @reading.color.downcase |
| 59 | 59 | var = (pager =~ /#{color}/) |
| 60 | - var.should_not be_nil | |
| 60 | + expect(var).to_not be_nil | |
| 61 | 61 | end |
| 62 | 62 | |
| 63 | 63 | Then(/^I should be in the Edit Reading Group page$/) do | ... | ... |
features/step_definitions/repository_steps.rb
| ... | ... | @@ -59,7 +59,7 @@ Given(/^I ask for the metric results of the given module result$/) do |
| 59 | 59 | end |
| 60 | 60 | |
| 61 | 61 | Given(/^I see a sample metric's name$/) do |
| 62 | - page.should have_content(@metric_results.first.metric_configuration_snapshot.metric.name) | |
| 62 | + expect(page).to have_content(@metric_results.first.metric_configuration_snapshot.metric.name) | |
| 63 | 63 | end |
| 64 | 64 | |
| 65 | 65 | When(/^I click on the sample metric's name$/) do |
| ... | ... | @@ -94,33 +94,33 @@ When(/^I get the Creation date information as "(.*?)"$/) do |variable| |
| 94 | 94 | end |
| 95 | 95 | |
| 96 | 96 | Then(/^I should see the sample repository name$/) do |
| 97 | - page.should have_content(@repository.name) | |
| 97 | + expect(page).to have_content(@repository.name) | |
| 98 | 98 | end |
| 99 | 99 | |
| 100 | 100 | Then(/^the field "(.*?)" should be filled with "(.*?)"$/) do |field, value| |
| 101 | - page.find_field(field).value.should eq(value) | |
| 101 | + expect(page.find_field(field).value).to eq(value) | |
| 102 | 102 | end |
| 103 | 103 | |
| 104 | 104 | Then(/^I should see the given module result$/) do |
| 105 | - page.should have_content(@module_result.module.name) | |
| 105 | + expect(page).to have_content(@module_result.module.name) | |
| 106 | 106 | end |
| 107 | 107 | |
| 108 | 108 | Then(/^I should see a sample child's name$/) do |
| 109 | - page.should have_content(@module_result.children.first.module.name) | |
| 109 | + expect(page).to have_content(@module_result.children.first.module.name) | |
| 110 | 110 | end |
| 111 | 111 | |
| 112 | 112 | Then(/^I should see the given repository's content$/) do |
| 113 | - page.should have_content(@repository.type) | |
| 114 | - page.should have_content(@repository.description) | |
| 115 | - page.should have_content(@repository.name) | |
| 116 | - page.should have_content(@repository.license) | |
| 117 | - page.should have_content(@repository.address) | |
| 118 | - page.should have_content(@configuration.name) | |
| 119 | - page.should have_content("1 day") # The given repository periodicity | |
| 113 | + expect(page).to have_content(@repository.type) | |
| 114 | + expect(page).to have_content(@repository.description) | |
| 115 | + expect(page).to have_content(@repository.name) | |
| 116 | + expect(page).to have_content(@repository.license) | |
| 117 | + expect(page).to have_content(@repository.address) | |
| 118 | + expect(page).to have_content(@configuration.name) | |
| 119 | + expect(page).to have_content("1 day") # The given repository periodicity | |
| 120 | 120 | end |
| 121 | 121 | |
| 122 | 122 | Then(/^I should see a loaded graphic for the sample metric$/) do |
| 123 | - page.all("canvas#container" + @metric_results.first.id.to_s)[0].should_not be_nil | |
| 123 | + expect(page.all("canvas#container" + @metric_results.first.id.to_s)[0]).to_not be_nil | |
| 124 | 124 | end |
| 125 | 125 | |
| 126 | 126 | Then(/^I wait for "(.*?)" seconds or until I see "(.*?)"$/) do |timeout, text| |
| ... | ... | @@ -130,7 +130,7 @@ Then(/^I wait for "(.*?)" seconds or until I see "(.*?)"$/) do |timeout, text| |
| 130 | 130 | sleep 1 |
| 131 | 131 | end |
| 132 | 132 | |
| 133 | - page.should have_content(text) | |
| 133 | + expect(page).to have_content(text) | |
| 134 | 134 | end |
| 135 | 135 | |
| 136 | 136 | Then(/^I wait for "(.*?)" seconds$/) do |timeout| |
| ... | ... | @@ -139,12 +139,12 @@ end |
| 139 | 139 | |
| 140 | 140 | Then(/^I should see the saved repository's content$/) do |
| 141 | 141 | @repository = Repository.all.last # suposing the last repository created is the only created too. |
| 142 | - page.should have_content(@repository.type) | |
| 143 | - page.should have_content(@repository.description) | |
| 144 | - page.should have_content(@repository.name) | |
| 145 | - page.should have_content(@repository.license) | |
| 146 | - page.should have_content(@repository.address) | |
| 147 | - page.should have_content(@configuration.name) | |
| 142 | + expect(page).to have_content(@repository.type) | |
| 143 | + expect(page).to have_content(@repository.description) | |
| 144 | + expect(page).to have_content(@repository.name) | |
| 145 | + expect(page).to have_content(@repository.license) | |
| 146 | + expect(page).to have_content(@repository.address) | |
| 147 | + expect(page).to have_content(@configuration.name) | |
| 148 | 148 | end |
| 149 | 149 | |
| 150 | 150 | Then(/^"(.*?)" should be less than "(.*?)"$/) do |arg1, arg2| | ... | ... |
features/step_definitions/user_steps.rb
| ... | ... | @@ -17,11 +17,11 @@ end |
| 17 | 17 | |
| 18 | 18 | Then(/^my name should have changed to (.+)$/) do |text| |
| 19 | 19 | @user.reload |
| 20 | - @user.name.should eq(text) | |
| 20 | + expect(@user.name).to eq(text) | |
| 21 | 21 | end |
| 22 | 22 | |
| 23 | 23 | Then(/^I should be in the User Projects page$/) do |
| 24 | - page.should have_content("#{@user.name} Projects") | |
| 24 | + expect(page).to have_content("#{@user.name} Projects") | |
| 25 | 25 | end |
| 26 | 26 | |
| 27 | 27 | When(/^I take a picture of the page$/) do | ... | ... |