Skip to content

Commit

Permalink
Updating the step definitions to use the "expect" syntax instead of "…
Browse files Browse the repository at this point in the history
…should", which will be deprecated in future versions of RSpec.
  • Loading branch information
Paul-Clewell committed Aug 21, 2014
1 parent f284d33 commit 7732f09
Show file tree
Hide file tree
Showing 12 changed files with 27 additions and 26 deletions.
1 change: 0 additions & 1 deletion features/autocomplete.feature
Expand Up @@ -3,7 +3,6 @@ Feature: Using the JQueryUI Autocomplete widget
Background:
Given I am on the autocomplete page

@focus
Scenario: Entering a letter
When I enter "b" in the autocomplete widget
Then I should see that each item in the autocomplete list contains "b"
Expand Down
3 changes: 2 additions & 1 deletion features/menus.feature
Expand Up @@ -15,5 +15,6 @@ Feature: Using the menus widget
When I select "Salzburg" and "Delphi" and "Ada"
Then I should see the "Salzburg", "Delphi", "Ada" option

@focus
Scenario: Should raise error when non-existing menu item is given
Then I should have an error when I search for menu item "b"
Then I should have an error when I search for menu item "Taco"
8 changes: 4 additions & 4 deletions features/step_definitions/accordion_steps.rb
Expand Up @@ -7,17 +7,17 @@
end

Then /^the current accordion element should be "([^"]*)"$/ do |label|
on(AccordionPage).accordion.selected.should == label
expect(on(AccordionPage).accordion.selected).to eql label
end

Then /^the accordion labels should include "([^"]*)"$/ do |label|
on(AccordionPage).accordion.labels.should include label
expect(on(AccordionPage).accordion.labels).to include label
end

Then /^the "([^"]*)" element should be selected$/ do |label|
on(AccordionPage).accordion.selected?(label).should be_true
expect(on(AccordionPage).accordion.selected?(label)).to be_true
end

When /^the "([^"]*)" element should not be selected$/ do |label|
on(AccordionPage).accordion.selected?(label).should be_false
expect(on(AccordionPage).accordion.selected?(label)).to be_false
end
2 changes: 1 addition & 1 deletion features/step_definitions/autocomplete_steps.rb
Expand Up @@ -9,7 +9,7 @@
Then(/^I should see that each item in the autocomplete list contains "([^"]*)"$/) do |text|
on(AutocompletePage) do |page|
page.autocomplete_unordered_list_element.list_item_element.when_visible
page.autocomplete_unordered_list_element.list_item_elements.to_s.should include text
expect(page.autocomplete_unordered_list_element.list_item_elements.to_s).to include text
end
end

Expand Down
6 changes: 3 additions & 3 deletions features/step_definitions/basic_dialog_steps.rb
Expand Up @@ -3,18 +3,18 @@
end

Then /^the basic dialog title should be "(.+)"$/ do |title|
on(BasicDialogPage).the_dialog_title.should == title
expect(on(BasicDialogPage).the_dialog_title).to eql title
end

When /^the content should include "(.+)"$/ do |content|
on(BasicDialogPage).the_dialog_content.should include content
expect(on(BasicDialogPage).the_dialog_content).to include content
end

When /^I close the basic dialog$/ do
on(BasicDialogPage).close_the_dialog
end

Then /^the basic dialog should not be visible$/ do
on(BasicDialogPage).the_dialog_element.should_not be_visible
expect(on(BasicDialogPage).the_dialog_element).to_not be_visible
end

2 changes: 1 addition & 1 deletion features/step_definitions/common_steps.rb
@@ -1,3 +1,3 @@
Then /^I should see "(.+)"$/ do |expected|
@current_page.text.should include expected
expect(@current_page.text).to include expected
end
11 changes: 6 additions & 5 deletions features/step_definitions/datepicker_steps.rb
Expand Up @@ -7,7 +7,8 @@
end

Then(/^the date should be "([^\"]*)"$/) do |day|
on(DatepickerPage).datepicker_one.should == day
#on(DatepickerPage).datepicker_one.should == day
expect(on(DatepickerPage).datepicker_one).to eql day
end

When(/^I enter the date "([^\"]*)"$/) do |date|
Expand All @@ -20,9 +21,9 @@

Then(/^the day should be "(\d*)" the month should be "(\w+)" and the year should be "(\d+)"$/) do |day, month, year|
on(DatepickerPage) do |page|
page.datepicker_one_day.should == day unless page.datepicker_one_day == nil
page.datepicker_one_month.should == month
page.datepicker_one_year.should == year
expect(page.datepicker_one_day).to eql day unless page.datepicker_one_day == nil
expect(page.datepicker_one_month).to eql month
expect(page.datepicker_one_year).to eql year
end
end

Expand All @@ -35,5 +36,5 @@
end

Then(/^the date of the second datepicker should be "([^\"]*)"$/) do |date|
on(DatepickerPage).datepicker_two.should == date
expect(on(DatepickerPage).datepicker_two).to eql date
end
6 changes: 3 additions & 3 deletions features/step_definitions/menu_steps.rb
Expand Up @@ -8,12 +8,12 @@

Then /^I should see the inactive option "(.+)", "(.+)"$/ do |item1, item2|
item = on(MenuPage).menus.search_for(item1, item2)
item.attribute('class').should include 'ui-state-disabled'
expect(item.attribute('class')).to include 'ui-state-disabled'
end

When /^I should see the "(.+)", "(.+)", "(.+)" option$/ do |item1, item2, item3|
item = on(MenuPage).menus.search_for(item1, item2, item3)
item.should_not be_nil
expect(item).to_not be_nil
end

When /^I select "(.+)" and "(.+)" and "(.+)"$/ do |item1, item2, item3|
Expand All @@ -26,5 +26,5 @@

When /^I should see the "([^"]*)", "([^"]*)" option$/ do |item1, item2|
item = on(MenuPage).menus.search_for(item1, item2)
item.should_not be_nil
expect(item).to_not be_nil
end
6 changes: 3 additions & 3 deletions features/step_definitions/progress_bar_steps.rb
Expand Up @@ -3,13 +3,13 @@
end

Then /^the minimum value should be "(.+)"$/ do |minimum_value|
on(ProgressBarPage).the_progress_min.should == minimum_value.to_i
expect(on(ProgressBarPage).the_progress_min).to eql minimum_value.to_i
end

Then /^the maximum value should be "(.+)"$/ do |maximum_value|
on(ProgressBarPage).the_progress_max.should == maximum_value.to_i
expect(on(ProgressBarPage).the_progress_max).to eql maximum_value.to_i
end

Then /^the current value should be "(.+)"$/ do |current_value|
on(ProgressBarPage).the_progress.should == current_value.to_i
expect(on(ProgressBarPage).the_progress).to eql current_value.to_i
end
2 changes: 1 addition & 1 deletion features/step_definitions/slider_steps.rb
Expand Up @@ -3,7 +3,7 @@
end

Then /^the current value of the slider should be "([^"]*)"$/ do |percent|
on(SliderPage).the_slider.should == percent
expect(on(SliderPage).the_slider).to eql percent
end

When(/^I move the slider to "([^"]*)"$/) do |value|
Expand Down
2 changes: 1 addition & 1 deletion features/step_definitions/spinner_steps.rb
Expand Up @@ -7,7 +7,7 @@
end

Then(/^the Spinner Widget should read "([^"]*)"$/) do |value|
on(SpinnerPage).the_spinner.should == value
expect(on(SpinnerPage).the_spinner).to eql value
end

When(/^I click the decrement button$/) do
Expand Down
4 changes: 2 additions & 2 deletions features/step_definitions/tab_steps.rb
Expand Up @@ -7,9 +7,9 @@
end

Then /^the current tab should be "(.+)"$/ do |label|
on(TabsPage).tabs.selected.should == label
expect(on(TabsPage).tabs.selected).to eql label
end

Then /^the tab labels should include "([^"]*)"$/ do |label|
on(TabsPage).tabs.labels.should include label
expect(on(TabsPage).tabs.labels).to include label
end

0 comments on commit 7732f09

Please sign in to comment.