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
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