capybara_watcher 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. checksums.yaml +7 -0
  2. data/lib/capybara_watcher.rb +35 -0
  3. metadata +43 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 50c599d9b2c689faffde3ca7baf9c9fe17fdaee868fc6b8705a8e069b55b917e
4
+ data.tar.gz: 4238e85f404f31f0df6bb6ce059e31609498d0e69670542a96d892b55d22ab93
5
+ SHA512:
6
+ metadata.gz: d52762e2bf68971681888b0b8d9125b3243809e3e43cc12cdd4008a51289914f32430f7bed71a772067436a6235a9810c3a183946c443d4ab41c3cb10d63a045
7
+ data.tar.gz: c7c628eb039c77d56228c3d8405d6a2bad527d103a53fc2974bb3045635ee634ecd949dd5ad2b9c6e19f02bd1c63e17dbaaa4d5470165b3eda2d480c30902192
@@ -0,0 +1,35 @@
1
+ require_relative './capybara_watcher/configuration'
2
+
3
+ module CapybaraWatcher
4
+ def self.configure
5
+ yield Configuration.options
6
+ end
7
+
8
+ def looped?
9
+ # define N seconds to let test continue.
10
+ @seconds >= Configuration.options[:timeout]
11
+ end
12
+
13
+ def wait_for_changes(repeat = 1)
14
+ begin_to_watch(body, repeat)
15
+ end
16
+
17
+ def before_wait(repeat = 1)
18
+ yield
19
+ begin_to_watch(body, repeat)
20
+ end
21
+
22
+ private
23
+
24
+ def begin_to_watch(snap = body, repeat = 1)
25
+ repeat.times do
26
+ @seconds = 0 # reset seconds count
27
+
28
+ while snap == body do
29
+ break if looped?
30
+ sleep 0.1
31
+ @seconds += 0.1
32
+ end
33
+ end
34
+ end
35
+ end
metadata ADDED
@@ -0,0 +1,43 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: capybara_watcher
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Ricardo Villagrana
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2019-04-15 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Watch body elements and wait for changes in Capybara integration tests.
14
+ email: 'ricardovillagranal@gmail.com '
15
+ executables: []
16
+ extensions: []
17
+ extra_rdoc_files: []
18
+ files:
19
+ - lib/capybara_watcher.rb
20
+ homepage: https://github.com/ricvillagrana/capybara_watcher
21
+ licenses:
22
+ - MIT
23
+ metadata: {}
24
+ post_install_message:
25
+ rdoc_options: []
26
+ require_paths:
27
+ - lib
28
+ required_ruby_version: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ required_rubygems_version: !ruby/object:Gem::Requirement
34
+ requirements:
35
+ - - ">="
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ requirements: []
39
+ rubygems_version: 3.0.1
40
+ signing_key:
41
+ specification_version: 4
42
+ summary: Capybara Watcher.
43
+ test_files: []