Module: CapybaraWatcher
- Defined in:
- lib/capybara_watcher.rb,
lib/capybara_watcher/configuration.rb
Defined Under Namespace
Modules: Configuration
Class Method Summary collapse
Instance Method Summary collapse
- #before_wait(repeat = 1) ⇒ Object
- #looped? ⇒ Boolean
- #wait_for_changes(repeat = 1) ⇒ Object
- #wait_until_content_has(text) ⇒ Object
Class Method Details
.configure {|Configuration.options| ... } ⇒ Object
4 5 6 |
# File 'lib/capybara_watcher.rb', line 4 def self.configure yield Configuration. end |
Instance Method Details
#before_wait(repeat = 1) ⇒ Object
17 18 19 20 |
# File 'lib/capybara_watcher.rb', line 17 def before_wait(repeat = 1) yield begin_to_watch(body, repeat) end |
#looped? ⇒ Boolean
8 9 10 11 |
# File 'lib/capybara_watcher.rb', line 8 def looped? # define N seconds to let test continue. @seconds >= Configuration.[:timeout] end |
#wait_for_changes(repeat = 1) ⇒ Object
13 14 15 |
# File 'lib/capybara_watcher.rb', line 13 def wait_for_changes(repeat = 1) begin_to_watch(body, repeat) end |
#wait_until_content_has(text) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 |
# 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 |