New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

capybara_table

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

capybara_table

  • 0.3.0
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

CapybaraTable

Some neat Capybara selectors and matchers for working with HTML tables.

Installation

Add this line to your application's Gemfile:

gem 'capybara_table'

And then execute:

$ bundle

Or install it yourself as:

$ gem install capybara_table

If you're using RSpec, require the matchers:

require "capybara_table/rspec"

Otherwise

Usage

If you have a table like this:

<table>
  <caption>People</caption>
  <tr>
    <th>First Name</th>
    <th>Last Name</th>
    <th>Age</th>
  </tr>
  <tr>
    <td>Jonas</td>
    <td>Nicklas</td>
    <td>31</td>
  </tr>
  <tr>
    <td colspan="2">John</td>
    <td>22</td>
  </tr>
</table>

Then you can do this

# find a table by caption
find(:table, "People") # by caption

# find a table row by its headers, even works with colspans!
# (note the extra hash at the end)
find(:table_row, {"First Name" => "Jonas", "Last Name" => "Nicklas"}, {})

# Assert on a table row with RSpec
expect(find(:table, "People")).to have_table_row("First Name" => "Jonas", "Last Name" => "Nicklas")

# Assert on a table row with MiniTest
within :table, "People" do
  assert_selector(:table_row, {"First Name" => "Jonas", "Last Name" => "Nicklas"}, {})
end

License

The gem is available as open source under the terms of the MIT License.

FAQs

Package last updated on 19 Jul 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc