Created
June 12, 2012 23:09
-
-
Save gkop/2920731 to your computer and use it in GitHub Desktop.
Drag thing in to other thing capybara step
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
## in features/support/selectors.rb | |
when /^the (?<type>\w+){1} "(?<name>[^"]*){1}"$/ | |
[:xpath, "//li[contains(@class, '#{$~[:type]}') and contains(., '#{$~[:name]}')]"] | |
## in features/step_definitions/drag_things_steps.rb | |
def find_by_selector(thing) | |
selector = selector_for(thing) | |
find(selector[0], selector[1]) | |
end | |
When /^I drag (.+) into (.+)$/ do |thing, other_thing| | |
find_by_selector(thing).drag_to(find_by_selector(other_thing)) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment