From 03e60525cc15278437f3a3d6e5ce91c41e22abf2 Mon Sep 17 00:00:00 2001 From: Rafael Reggiani Manzo Date: Thu, 7 Aug 2014 12:30:01 -0300 Subject: [PATCH] cucumber steps using expects instead of should --- features/step_definitions/compound_metric_configuration_steps.rb | 8 ++++---- features/step_definitions/configuration_steps.rb | 10 +++++----- features/step_definitions/homepage_steps.rb | 2 +- features/step_definitions/metric_configuration_steps.rb | 18 +++++++++--------- features/step_definitions/mezuro_range_steps.rb | 14 +++++++------- features/step_definitions/project_steps.rb | 22 +++++++++++----------- features/step_definitions/reading_group_steps.rb | 12 ++++++------ features/step_definitions/repository_steps.rb | 40 ++++++++++++++++++++-------------------- features/step_definitions/user_steps.rb | 4 ++-- 9 files changed, 65 insertions(+), 65 deletions(-) diff --git a/features/step_definitions/compound_metric_configuration_steps.rb b/features/step_definitions/compound_metric_configuration_steps.rb index 1a0168a..79a9767 100644 --- a/features/step_definitions/compound_metric_configuration_steps.rb +++ b/features/step_definitions/compound_metric_configuration_steps.rb @@ -1,9 +1,9 @@ Given(/^I see the sample metric configuration name$/) do - page.should have_content(@metric_configuration.metric.name) + expect(page).to have_content(@metric_configuration.metric.name) end Given(/^I see the sample metric configuration code$/) do - page.should have_content(@metric_configuration.code) + expect(page).to have_content(@metric_configuration.code) end 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 end Then(/^I should be at compound metric configuration sample page$/) do - page.should have_content(@compound_metric_configuration.metric.name) - page.should have_content("Ranges") + expect(page).to have_content(@compound_metric_configuration.metric.name) + expect(page).to have_content("Ranges") end diff --git a/features/step_definitions/configuration_steps.rb b/features/step_definitions/configuration_steps.rb index dc56f8e..01dd447 100644 --- a/features/step_definitions/configuration_steps.rb +++ b/features/step_definitions/configuration_steps.rb @@ -37,15 +37,15 @@ When(/^I visit the sample configuration edit page$/) do end Then(/^I should be in the Edit Configuration page$/) do - page.should have_content("Edit Configuration") + expect(page).to have_content("Edit Configuration") end Then(/^The field "(.*?)" should be filled with the sample configuration "(.*?)"$/) do |field, value| - page.find_field(field).value.should eq(@mezuro_configuration.send(value)) + expect(page.find_field(field).value).to eq(@mezuro_configuration.send(value)) end Then(/^I should be in the All configurations page$/) do - page.should have_content("Configurations") + expect(page).to have_content("Configurations") end Then(/^the sample configuration should not be there$/) do @@ -53,6 +53,6 @@ Then(/^the sample configuration should not be there$/) do end Then(/^the sample configuration should be there$/) do - page.should have_content(@mezuro_configuration.name) - page.should have_content(@mezuro_configuration.description) + expect(page).to have_content(@mezuro_configuration.name) + expect(page).to have_content(@mezuro_configuration.description) end \ No newline at end of file diff --git a/features/step_definitions/homepage_steps.rb b/features/step_definitions/homepage_steps.rb index 32f72d0..90be273 100644 --- a/features/step_definitions/homepage_steps.rb +++ b/features/step_definitions/homepage_steps.rb @@ -11,5 +11,5 @@ Given(/^I am a regular user$/) do end Then(/^I should see "(.+)"$/) do |text| - page.should have_content(text) + expect(page).to have_content(text) end \ No newline at end of file diff --git a/features/step_definitions/metric_configuration_steps.rb b/features/step_definitions/metric_configuration_steps.rb index f92fb2f..d96cda4 100644 --- a/features/step_definitions/metric_configuration_steps.rb +++ b/features/step_definitions/metric_configuration_steps.rb @@ -1,5 +1,5 @@ Given(/^I have a sample metric configuration within the given mezuro configuration$/) do - @metric_configuration = FactoryGirl.create(:metric_configuration, + @metric_configuration = FactoryGirl.create(:metric_configuration, {id: nil, configuration_id: @mezuro_configuration.id, reading_group_id: @reading_group.id} ) end @@ -22,21 +22,21 @@ end Then(/^I am at the sample metric configuration page$/) do visit mezuro_configuration_metric_configuration_path(@metric_configuration.configuration_id, @metric_configuration.id) - page.should have_content(@metric_configuration.metric.name) - page.should have_content("Ranges") + expect(page).to have_content(@metric_configuration.metric.name) + expect(page).to have_content("Ranges") end Then(/^I should see the sample metric configuration content$/) do - page.should have_content(@metric_configuration.metric.name) - page.should have_content(@metric_configuration.code) - page.should have_content(@metric_configuration.weight) + expect(page).to have_content(@metric_configuration.metric.name) + expect(page).to have_content(@metric_configuration.code) + expect(page).to have_content(@metric_configuration.weight) end Then(/^I should be at metric configuration sample page$/) do - page.should have_content(@metric_configuration.metric.name) - page.should have_content("Ranges") + expect(page).to have_content(@metric_configuration.metric.name) + expect(page).to have_content("Ranges") end Then(/^I should be at the choose metric page$/) do - page.should have_content("Choose a metric from a base tool:") + expect(page).to have_content("Choose a metric from a base tool:") end diff --git a/features/step_definitions/mezuro_range_steps.rb b/features/step_definitions/mezuro_range_steps.rb index 213230f..e54def3 100644 --- a/features/step_definitions/mezuro_range_steps.rb +++ b/features/step_definitions/mezuro_range_steps.rb @@ -26,16 +26,16 @@ When(/^I am at the New Range page$/) do end Then(/^I should be at the New Range page$/) do - page.should have_content("New Range") - page.should have_content("Beginning") - page.should have_content("End") - page.should have_content("Comments") + expect(page).to have_content("New Range") + expect(page).to have_content("Beginning") + expect(page).to have_content("End") + expect(page).to have_content("Comments") end Then(/^I should see the sample range$/) do - page.should have_content(@mezuro_range.label) - page.should have_content(@mezuro_range.beginning) - page.should have_content(@mezuro_range.end) + expect(page).to have_content(@mezuro_range.label) + expect(page).to have_content(@mezuro_range.beginning) + expect(page).to have_content(@mezuro_range.end) end diff --git a/features/step_definitions/project_steps.rb b/features/step_definitions/project_steps.rb index 7a8953d..a0e1742 100644 --- a/features/step_definitions/project_steps.rb +++ b/features/step_definitions/project_steps.rb @@ -39,40 +39,40 @@ Given(/^I am at the New Project page$/) do end Then(/^I should not see (.+)$/) do |text| - page.should_not have_content(text) + expect(page).to_not have_content(text) end #FIXME: this is step is not matched Then(/^I should not see "(.+)"" within "(.+)"$/) do |text, selector| - page.find(selector).should_not have_content(text) + expect(page.find(selector)).to_not have_content(text) end Then(/^the sample project should be there$/) do - page.should have_content(@project.name) - page.should have_content(@project.description) + expect(page).to have_content(@project.name) + expect(page).to have_content(@project.description) end Then(/^I should be in the All Projects page$/) do - page.should have_content("Projects") + expect(page).to have_content("Projects") end Then(/^I should be in the Edit Project page$/) do - page.should have_content("Edit Project") + expect(page).to have_content("Edit Project") end Then(/^I should be in the Sample Project page$/) do - page.should have_content(@project.name) - page.should have_content(@project.description) + expect(page).to have_content(@project.name) + expect(page).to have_content(@project.description) end Then(/^I should be in the Login page$/) do - page.should have_content("Sign in") + expect(page).to have_content("Sign in") end Then(/^the sample project should not be there$/) do - expect { Project.find(@project.id) }.to raise_error + expect { Project.find(@project.id) }.to raise_error end Then(/^The field "(.*?)" should be filled with the sample project "(.*?)"$/) do |field, value| - page.find_field(field).value.should eq(@project.send(value)) + expect(page.find_field(field).value).to eq(@project.send(value)) end diff --git a/features/step_definitions/reading_group_steps.rb b/features/step_definitions/reading_group_steps.rb index ecad611..b14d69e 100644 --- a/features/step_definitions/reading_group_steps.rb +++ b/features/step_definitions/reading_group_steps.rb @@ -43,21 +43,21 @@ When(/^I visit the sample reading group edit page$/) do end Then(/^The field "(.*?)" should be filled with the sample reading group "(.*?)"$/) do |field, value| - page.find_field(field).value.should eq(@reading_group.send(value)) + expect(page.find_field(field).value).to eq(@reading_group.send(value)) end Then(/^I should be in the Sample Reading Group page$/) do - page.should have_content(@reading_group.name) - page.should have_content(@reading_group.description) + expect(page).to have_content(@reading_group.name) + expect(page).to have_content(@reading_group.description) end Then(/^I should see the information of the sample reading$/) do - page.should have_content(@reading.label) - page.should have_content(@reading.grade) + expect(page).to have_content(@reading.label) + expect(page).to have_content(@reading.grade) pager = page.body color = @reading.color.downcase var = (pager =~ /#{color}/) - var.should_not be_nil + expect(var).to_not be_nil end Then(/^I should be in the Edit Reading Group page$/) do diff --git a/features/step_definitions/repository_steps.rb b/features/step_definitions/repository_steps.rb index c1e5ff7..5385cca 100644 --- a/features/step_definitions/repository_steps.rb +++ b/features/step_definitions/repository_steps.rb @@ -59,7 +59,7 @@ Given(/^I ask for the metric results of the given module result$/) do end Given(/^I see a sample metric's name$/) do - page.should have_content(@metric_results.first.metric_configuration_snapshot.metric.name) + expect(page).to have_content(@metric_results.first.metric_configuration_snapshot.metric.name) end When(/^I click on the sample metric's name$/) do @@ -94,33 +94,33 @@ When(/^I get the Creation date information as "(.*?)"$/) do |variable| end Then(/^I should see the sample repository name$/) do - page.should have_content(@repository.name) + expect(page).to have_content(@repository.name) end Then(/^the field "(.*?)" should be filled with "(.*?)"$/) do |field, value| - page.find_field(field).value.should eq(value) + expect(page.find_field(field).value).to eq(value) end Then(/^I should see the given module result$/) do - page.should have_content(@module_result.module.name) + expect(page).to have_content(@module_result.module.name) end Then(/^I should see a sample child's name$/) do - page.should have_content(@module_result.children.first.module.name) + expect(page).to have_content(@module_result.children.first.module.name) end Then(/^I should see the given repository's content$/) do - page.should have_content(@repository.type) - page.should have_content(@repository.description) - page.should have_content(@repository.name) - page.should have_content(@repository.license) - page.should have_content(@repository.address) - page.should have_content(@configuration.name) - page.should have_content("1 day") # The given repository periodicity + expect(page).to have_content(@repository.type) + expect(page).to have_content(@repository.description) + expect(page).to have_content(@repository.name) + expect(page).to have_content(@repository.license) + expect(page).to have_content(@repository.address) + expect(page).to have_content(@configuration.name) + expect(page).to have_content("1 day") # The given repository periodicity end Then(/^I should see a loaded graphic for the sample metric$/) do - page.all("canvas#container" + @metric_results.first.id.to_s)[0].should_not be_nil + expect(page.all("canvas#container" + @metric_results.first.id.to_s)[0]).to_not be_nil end 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| sleep 1 end - page.should have_content(text) + expect(page).to have_content(text) end Then(/^I wait for "(.*?)" seconds$/) do |timeout| @@ -139,12 +139,12 @@ end Then(/^I should see the saved repository's content$/) do @repository = Repository.all.last # suposing the last repository created is the only created too. - page.should have_content(@repository.type) - page.should have_content(@repository.description) - page.should have_content(@repository.name) - page.should have_content(@repository.license) - page.should have_content(@repository.address) - page.should have_content(@configuration.name) + expect(page).to have_content(@repository.type) + expect(page).to have_content(@repository.description) + expect(page).to have_content(@repository.name) + expect(page).to have_content(@repository.license) + expect(page).to have_content(@repository.address) + expect(page).to have_content(@configuration.name) end Then(/^"(.*?)" should be less than "(.*?)"$/) do |arg1, arg2| diff --git a/features/step_definitions/user_steps.rb b/features/step_definitions/user_steps.rb index d138836..1b77a8e 100644 --- a/features/step_definitions/user_steps.rb +++ b/features/step_definitions/user_steps.rb @@ -17,11 +17,11 @@ end Then(/^my name should have changed to (.+)$/) do |text| @user.reload - @user.name.should eq(text) + expect(@user.name).to eq(text) end Then(/^I should be in the User Projects page$/) do - page.should have_content("#{@user.name} Projects") + expect(page).to have_content("#{@user.name} Projects") end When(/^I take a picture of the page$/) do -- libgit2 0.21.2