mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-15 23:57:48 +00:00
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
This commit is contained in:
committed by
luisramos0
parent
56c07aac5c
commit
3b40ede0b8
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user