module CapybaraWatcher
Public Class Methods
configure() { |options| ... }
click to toggle source
# File lib/capybara_watcher.rb, line 4 def self.configure yield Configuration.options end
Public Instance Methods
before_wait(repeat = 1) { || ... }
click to toggle source
# File lib/capybara_watcher.rb, line 17 def before_wait(repeat = 1) yield begin_to_watch(body, repeat) end
looped?()
click to toggle source
# File lib/capybara_watcher.rb, line 8 def looped? # define N seconds to let test continue. @seconds >= Configuration.options[:timeout] end
wait_for_changes(repeat = 1)
click to toggle source
# File lib/capybara_watcher.rb, line 13 def wait_for_changes(repeat = 1) begin_to_watch(body, repeat) end
wait_until_content_has(text) { |text| ... }
click to toggle source
# File lib/capybara_watcher.rb, line 22 def wait_until_content_has(text) snap = body 5.times do @seconds = 0 # reset seconds count while snap == body do break if page.has_content?(text) && yield(text) break if looped? sleep 0.1 @seconds += 0.1 end end end
Private Instance Methods
begin_to_watch(snap = body, repeat = 1)
click to toggle source
# File lib/capybara_watcher.rb, line 38 def begin_to_watch(snap = body, repeat = 1) repeat.times do @seconds = 0 # reset seconds count while snap == body do break if looped? sleep 0.1 @seconds += 0.1 end end end