'Validate if all Grid records are active with capybara. Please?

I need to validate two situations: The first one I want to validate if all returned records are active. When they are active the corresponding column is:

<th colspan="1" style="white-space:nowrap;" class="tvHeader">Active?</th>

And the other situation is if the Grid is empty.

I use a validation to check if a certain record doesn't exist with the following code:

tr = page.find(:xpath, '/html/body/div[2]/div/div[2]/div/div[2]/div[2]/div/form/div[4]/div[2]/div/div/div/table/tbody/tr[1]/th[2]')
expect(tr).to_not have_css('td.Código', text: 'teste')

<div style="display:table-cell;">
   <table width="100%" class="tvGrid">
      <tbody>
         <tr>
            <th colspan="1" class="tvHeader">Id</th>
            <th colspan="1" class="tvHeader">Código</th>
            <th colspan="1" class="tvHeader">Área Solicitante</th>
            <th colspan="1" class="tvHeader">Usuário Inclusão</th>
            <th colspan="1" class="tvHeader">Data Inclusão</th>
            <th colspan="1" class="tvHeader">Usuário Alteração</th>
            <th colspan="1" class="tvHeader">Data Alteração</th>
            <th colspan="1" style="white-space:nowrap;" class="tvHeader">Ativo?</th>
         </tr>
         <tr class="tvRowEmpty">
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
         </tr>
                     
      </tbody>
   </table>
</div>


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source