Skip to content

Instantly share code, notes, and snippets.

@andrewhavens
Last active December 22, 2015 00:58
Show Gist options
  • Save andrewhavens/6392707 to your computer and use it in GitHub Desktop.
Save andrewhavens/6392707 to your computer and use it in GitHub Desktop.
Example of a Capybara feature file, imperative style
feature "widget management" do
background do
@user = Fabricate(:user)
visit auth_login_path
fill_in "Username", with: @user.username
fill_in "Password", with: "password"
click_button "Log In"
end
scenario "creating a new widget" do
visit root_url
click_link "New Widget"
fill_in "Name", with: "Awesome Widget"
click_button "Create Widget"
expect(page).to have_text("Widget was successfully created.")
end
end
@andrewhavens
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment