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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2ac8ff324327298695ce17961339c03d8c47649a
4
- data.tar.gz: d255a4751b415d6d49d661c76025fd10805b2cd6
3
+ metadata.gz: 5408b07ad5d32cdf3f45dcae687569cb2156b700
4
+ data.tar.gz: 8750ee9ebdbb859dccd254050afdad37cabe8b81
5
5
  SHA512:
6
- metadata.gz: 6a6fba191388f26e7a2ab41db205d7150e606cfbeb0ad3a4ee5544a30e2e9cc1cd15c2f9853a3bad74b9d10a2ca01ca8d75cf318be51e57cd09ec95b2bcdc4ac
7
- data.tar.gz: 016d49c366165d7d2b7272acf7eea1cea53ac242f5ffddda2e0bf9b85eb78fe91f6b7257e681cc48ae20ac623ed4e3db8050814e9441d2b328ce2634954791ec
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.0"
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(seconds=Capybara.default_wait_time, options = {}, &block)
7
+ def synchronize_with_timeout_error(*args, &block)
8
8
  start_time = Time.now
9
- synchronize_without_timeout_error(seconds, options, &block)
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.0
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-05 00:00:00.000000000 Z
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.1
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