Created
March 6, 2013 22:17
-
-
Save ssaadh/5103612 to your computer and use it in GitHub Desktop.
Using the capybara DSL elsewhere - You can mix the DSL into any context by including Capybara::DSL. - This enables its use in unsupported testing frameworks, and for general-purpose scripting.
This file contains 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
# You can mix the DSL into any context by including Capybara::DSL | |
# This enables its use in unsupported testing frameworks, and for general-purpose scripting | |
require 'capybara' | |
require 'capybara/dsl' | |
Capybara.default_driver = :webkit | |
module MyModule | |
include Capybara::DSL | |
def login! | |
within("//form[@id='session']") do | |
fill_in 'Login', :with => 'user@example.com' | |
fill_in 'Password', :with => 'password' | |
end | |
click_link 'Sign in' | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment