capybara-slow_finder_errors 0.1.0 → 0.1.1
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/README.md +10 -0
- data/capybara-slow_finder_errors.gemspec +1 -1
- data/lib/capybara/slow_finder_errors.rb +5 -3
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5408b07ad5d32cdf3f45dcae687569cb2156b700
|
4
|
+
data.tar.gz: 8750ee9ebdbb859dccd254050afdad37cabe8b81
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 876319a7a881519ba2adb705cc119256070df010e2636cc243d1790e2f5264d2d27942a8e8c02b252ecb7833f9cf3436b05f5a98257db423ef640910ac79db47
|
7
|
+
data.tar.gz: 078c29ea8a2dacb349857c78c3b51d5b2cd27eedd2230e1e699acdf82543a10c6a46d028d40b7319f8054c940ffaf3b23cfb026136d51ba11f5fb79b86772084
|
data/README.md
CHANGED
@@ -64,6 +64,16 @@ execution expired (Timeout::Error)
|
|
64
64
|
|
65
65
|
If you look at the lines below the gem's trace, you'll see that the slow finder is in `signed_in_user.rb` on line 31 in the `signed_in?` method. Just follow those traces and clean up your code!
|
66
66
|
|
67
|
+
## RSpec
|
68
|
+
|
69
|
+
If you're using RSpec and the matchers provided by Capybara like:
|
70
|
+
|
71
|
+
```ruby
|
72
|
+
expect(page).to_not have_content("abc")
|
73
|
+
```
|
74
|
+
|
75
|
+
then Capybara is already telling RSpec to use the negated method (`has_no_content?`) and thus Capybara is not waiting for the timeout before continuing.
|
76
|
+
|
67
77
|
## Common Fixes
|
68
78
|
|
69
79
|
This section will hopefully grow as people contribute common situations and fixes.
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |spec|
|
4
4
|
spec.name = "capybara-slow_finder_errors"
|
5
|
-
spec.version = "0.1.
|
5
|
+
spec.version = "0.1.1"
|
6
6
|
spec.authors = ["Nick Gauthier"]
|
7
7
|
spec.email = ["ngauthier@gmail.com"]
|
8
8
|
spec.summary = %q{Raises an error when you use a Capybara finder improperly}
|
@@ -4,13 +4,15 @@ module Capybara
|
|
4
4
|
|
5
5
|
module Node
|
6
6
|
class Base
|
7
|
-
def synchronize_with_timeout_error(
|
7
|
+
def synchronize_with_timeout_error(*args, &block)
|
8
8
|
start_time = Time.now
|
9
|
-
synchronize_without_timeout_error(
|
9
|
+
synchronize_without_timeout_error(*args, &block)
|
10
10
|
rescue Capybara::ElementNotFound => e
|
11
|
+
seconds = args.first || Capybara.default_wait_time
|
11
12
|
if Time.now-start_time > seconds
|
12
|
-
raise SlowFinderError
|
13
|
+
raise SlowFinderError, "Timeout reached while running a *waiting* Capybara finder...perhaps you wanted to return immediately? Use a non-waiting Capybara finder. More info: http://blog.codeship.com/faster-rails-tests?utm_source=gem_exception"
|
13
14
|
end
|
15
|
+
raise
|
14
16
|
end
|
15
17
|
alias_method :synchronize_without_timeout_error, :synchronize
|
16
18
|
alias_method :synchronize, :synchronize_with_timeout_error
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capybara-slow_finder_errors
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nick Gauthier
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-12-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -86,7 +86,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
86
86
|
version: '0'
|
87
87
|
requirements: []
|
88
88
|
rubyforge_project:
|
89
|
-
rubygems_version: 2.4.
|
89
|
+
rubygems_version: 2.4.2
|
90
90
|
signing_key:
|
91
91
|
specification_version: 4
|
92
92
|
summary: Raises an error when you use a Capybara finder improperly
|