Skip to content

Instantly share code, notes, and snippets.

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