Created
November 14, 2012 12:40
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
Capybara.add_selector :record do | |
xpath { |record| XPath.css("#" + ActionController::RecordIdentifier.dom_id(record)) } | |
match { |record| record.is_a?(ActiveRecord::Base) } | |
end |
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
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 |
Maybe?
Capybara.add_selector :post
@gmile, it works with any ActiveRecord instance, not just Posts. That's the beauty of it. In fact it could be made to work with anything that works with dom_id
, not just ActiveRecord, but I'm too lazy to figure out how.
Awesome :)
🍻
nice
\o/
nice
Awesome ❤️
😻
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
❤️