From 3b40ede0b8e4fbc9faca3308e926f63ebee31d54 Mon Sep 17 00:00:00 2001 From: Rob Harrington Date: Sat, 2 Jun 2018 15:53:19 +1000 Subject: [PATCH] Fix table row matchers The matcher was silently failing on the check step (adding ~30 seconds to out specs each time it was used!), so I changed it to fail if the basic step does not succeed --- spec/support/matchers/table_matchers.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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