Last active
December 22, 2015 00:58
-
-
Save andrewhavens/6393018 to your computer and use it in GitHub Desktop.
Example of Capybara feature file, declarative style
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
| feature "widget management" do | |
| include AuthenticationSteps | |
| include WidgetSteps | |
| background do | |
| i_log_in_as_a_user | |
| end | |
| scenario "creating a new widget" do | |
| i_create_a_widget | |
| expect(page).to have_text("Widget was successfully created.") | |
| end | |
| end |
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
| module AuthenticationSteps | |
| def i_log_in_as_a_user | |
| @user = Fabricate(:user) | |
| visit auth_login_path | |
| fill_in "Username", with: @user.username | |
| fill_in "Password", with: "password" | |
| click_button "Log In" | |
| end | |
| end |
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
| module WidgetSteps | |
| def i_create_a_widget | |
| visit root_url | |
| click_link "New Widget" | |
| fill_in "Name", with: "Awesome Widget" | |
| click_button "Create Widget" | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Compare to Cucumber feature file, declarative style