From ba7e29074f825f54150628dbf64be97b02942b71 Mon Sep 17 00:00:00 2001 From: Rohan Mitchell Date: Thu, 15 May 2014 16:20:02 +1000 Subject: [PATCH] have_table_row waits --- spec/support/matchers/table_matchers.rb | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/spec/support/matchers/table_matchers.rb b/spec/support/matchers/table_matchers.rb index 7a06965c67..71fb297e33 100644 --- a/spec/support/matchers/table_matchers.rb +++ b/spec/support/matchers/table_matchers.rb @@ -2,7 +2,14 @@ RSpec::Matchers.define :have_table_row do |row| match do |node| @row = row - node.all('tr').map { |tr| tr.all('th, td').map(&:text) }.include? row + + begin + wait_until { node.all('tr').map { |tr| tr.all('th, td').map(&:text) }.include? row } + rescue TimeoutError + false + else + true + end end failure_message_for_should do |text|