diff --git a/spec/support/matchers/table_matchers.rb b/spec/support/matchers/table_matchers.rb index 0a4c3b1e09..448b9a89a3 100644 --- a/spec/support/matchers/table_matchers.rb +++ b/spec/support/matchers/table_matchers.rb @@ -3,14 +3,18 @@ RSpec::Matchers.define :have_table_row do |row| match do |node| @row = row - node.has_selector? "tr", text: row.join(" ").strip # Check for appearance + text_without_blanks = row.select(&:present?).join(" ").strip + return false unless node.has_selector? "tr", text: text_without_blanks # Check for appearance + rows_under(node).include? row # Robust check of columns end match_when_negated do |node| @row = row - node.has_no_selector? "tr", text: row.join(" ").strip # Check for appearance + text_without_blanks = row.select(&:present?).join(" ").strip + return false unless node.has_no_selector? "tr", text: text_without_blanks # Check for appearance + !rows_under(node).include? row # Robust check of columns end