Project

have_table

0.0
No commit activity in last 3 years
No release in over 3 years
An RSpec matcher for tables with headers.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Runtime

>= 1.2.9
>= 0.7.1
 Project Readme

have_table matcher¶ ↑

This gem provides a custom matcher for testing tables in an intuitive way.

Requirements¶ ↑

Currently only works for tables with headers, and no colspans or rowspans.

eg:

response.should have_table do
  with_row do 
    with_cell("Username" => "jsmith")
    with_cell("First Name" => "John")
    with_cell("Last Name" => "Smith")
    with_cell("Email" => "jsmith@email.com")
  end
end

matches:

<table>
  <tr>
    <th>Username</th>
    <th>First Name</th>
    <th>Last Name</th>
    <th>Email</th>
  </tr>
  <tr>
    <td>jsmith</td>
    <td>John</td>
    <td>Smith</td>
    <td>jsmith@email.com</td>
  </tr>
</table>