From 1407ae77789cafc181ce2ad360f5a8ad0ebeaa26 Mon Sep 17 00:00:00 2001 From: Maikel Linke Date: Fri, 6 Jul 2018 16:00:11 +1000 Subject: [PATCH] Make TableMatcher match exactly, not part of row Reverts dbf3a7aaaf9d458f99e14983ca9db2d4cbe4b564. The reverted commit tried to avoid a 30 second delay by using have_selector. While that was successful in reducing test time, it made the matcher find rows that where not exactly the wanted row, but contained text of the wanted row. This wasn't a problem until we experimented with Chrome as test browser returns text on select boxes. This commit makes the matcher precise again. We still have to deal with the 30 second delay. --- spec/support/matchers/table_matchers.rb | 8 -------- 1 file changed, 8 deletions(-) diff --git a/spec/support/matchers/table_matchers.rb b/spec/support/matchers/table_matchers.rb index 448b9a89a3..7b3d7ebf96 100644 --- a/spec/support/matchers/table_matchers.rb +++ b/spec/support/matchers/table_matchers.rb @@ -2,19 +2,11 @@ RSpec::Matchers.define :have_table_row do |row| match do |node| @row = row - - 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 - - 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