Skip to content

Instantly share code, notes, and snippets.

@evanwalsh
Forked from jnicklas/selector.rb
Created November 14, 2012 15:01
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save evanwalsh/4072617 to your computer and use it in GitHub Desktop.
Save evanwalsh/4072617 to your computer and use it in GitHub Desktop.
Capybara.add_selector :record do
xpath { |record| XPath.css("#" + ActionController::RecordIdentifier.dom_id(record)) }
match { |record| record.is_a?(ActiveRecord::Base) }
end
post = Post.first
find(post).click_link("Hello")
within post do
fill_in("What's going on here", :with => "Holy shit this works??")
click_button("Yes")
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment