17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
# File 'lib/booth/testing/support/assert_partial.rb', line 17
def call
log { "Looking for view `#{partial}`" }
content = nil
begin
::Timeout.timeout(Capybara.default_max_wait_time) do
loop do
content = page.html.match(%r{<template>([^<]+)</template>})[1].strip
unless content == partial
sleep 0.1
next
end
log { "The expected view `#{partial}` was rendered." }
self.class.asserted_partials << partial
return
end
end
rescue ::Timeout::Error
raise "Expected view '#{partial}' but timed out with '#{page.html}'"
end
raise "Expected view '#{partial}' but got '#{content}'"
end
|