Created
October 17, 2014 17:45
-
-
Save he9lin/edb3e2deeb0746d9f357 to your computer and use it in GitHub Desktop.
Interface steps
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
step "I visit the :page_path page" do |path| | |
path = send(path) unless path.is_a?(String) | |
visit path | |
end | |
step "I click :text" do |text| | |
click_on text | |
end | |
step "I click :text within the :page_element" do |text, element_css| | |
within element_css do | |
click_on text | |
end | |
end | |
step "I submit the :form_name form" do |form_data| | |
within form_data[0] do | |
click_button form_data[1] | |
end | |
end | |
step "I submit the :form_name form with:" do |form_data, table| | |
within form_data[0] do | |
table.rows_hash.each do |key, value| | |
fill_in key, with: value, exact: false | |
end | |
click_button form_data[1] | |
end | |
end | |
# Expectations | |
step "I should see :content" do |content| | |
expect(page).to have_content(content) | |
end | |
step "I should not see :content" do |content| | |
expect(page).not_to have_content(content) | |
end | |
step "I should see :content within the :page_element" do |content, element_css| | |
within element_css do | |
expect(page).to have_content(content) | |
end | |
end | |
step "I should not see :page_element" do |element_css| | |
expect(page).not_to have_css(element_css) | |
end | |
step "I should have received an email at :email_address" do |email_address| | |
last_email.should_not be_nil | |
last_email.destinations.should include(email_address) | |
end | |
step "I should be on the :page_path page" do |path| | |
path = send(path) unless path.is_a?(String) | |
expect(current_path).to eq(path) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Sample placeholder_steps.rb