capybara_watcher 0.1.1 → 0.1.2
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.
- checksums.yaml +4 -4
- data/lib/capybara_watcher.rb +14 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3443c023e36264ff832ed242a3de1785e64b342ff9b0c8031f9c624e4d9337b7
|
4
|
+
data.tar.gz: c440175395e5d6629a890df56c81fe93a5bc376953eef9dff83cb1d135713546
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 83d178a888a87f9c357bd14823f9227a0ce6f97cbe6834929d81ee4fef33c3b695549af43023d3d5b9a849da674531fed7404d053842c5d316d00c5b233a8d66
|
7
|
+
data.tar.gz: 7f381ed091e5f934fb2dde481639a82516b57df1f1c7e92737fafd61511c3d8fad5baa95995226f597df629387ba74fb216259f33cf477d37121bd870662cf55
|
data/lib/capybara_watcher.rb
CHANGED
@@ -19,6 +19,20 @@ module CapybaraWatcher
|
|
19
19
|
begin_to_watch(body, repeat)
|
20
20
|
end
|
21
21
|
|
22
|
+
def wait_until_content_has(text)
|
23
|
+
snap = body
|
24
|
+
5.times do
|
25
|
+
@seconds = 0 # reset seconds count
|
26
|
+
|
27
|
+
while snap == body do
|
28
|
+
break if page.has_content?(text) && yield(text)
|
29
|
+
break if looped?
|
30
|
+
sleep 0.1
|
31
|
+
@seconds += 0.1
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
22
36
|
private
|
23
37
|
|
24
38
|
def begin_to_watch(snap = body, repeat = 1)
|