Skip to content

Instantly share code, notes, and snippets.

@bunnymatic
Last active March 12, 2016 18:37
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
module Capybara
class Session
def has_flash?(kind, msg)
within ".alert-#{kind}" do
has_content?(msg)
end
end
end
end
module CapybaraHelpers
def table_row_matching(content)
content_matcher = content.is_a?(String) ? /#{content}/ : content
match = all('table tbody tr').select do |row|
content_matcher =~ row.text
end
raise "Can't find row matching \"#{content}\"" unless match.first
match.first
end
end
RSpec.configure do |config|
config.include CapybaraHelpers, type: :feature
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment