dmc_kanye 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b682bcb0bb6c5c91b8e408a1b85c2a0aeade68f23714a706fc0116fe38a34194
4
- data.tar.gz: 9a1bfd714daaf8c91fefe3a3fd49f99f0d574dddb6c24de842c4f576dcde1a86
3
+ metadata.gz: 25ea4799ce74fe7f6ff18f93cb71713584eb69434d7072c91077d8a57af67766
4
+ data.tar.gz: 7a121ed0195cc0c3ef0930743b24222b0b3da07dc16e591a9b44d6ef5edc7aa5
5
5
  SHA512:
6
- metadata.gz: a54b9eb9434a5bd874898f77b0685a21d2ce30f7510057a0787ef3982101bc628927b509755aeb8014f09a117de9e85ed034e41ff712c70ce28cf52bcf533be0
7
- data.tar.gz: 92b86f267b806701348a006f29f93823ee2b4c6ff9f57c717425629d14a04f59ef1ea8be1cca4b67f1eadf57de1abf1eac489087346f896da26500b1c1becf05
6
+ metadata.gz: 686ab35f8ed38d2b0d73bc572a708b79d594c0bd482c845805f43dbd563f694b9b4b9615c488de099ba52187010482d524a7f9c5fa262c79ab1f0aea267804b8
7
+ data.tar.gz: 2c7afd64412d629843850aa28422e399a6df6b7140dddc6c7a36d37f319f77c33f228998086b6f9c095a441abcfbd243dc5d2b82613e9f7fb0d1b0f93e6de3bf
data/dmc_kanye.gemspec CHANGED
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
18
18
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
19
19
  spec.require_paths = ["lib"]
20
20
 
21
- spec.add_dependency "capybara"
21
+ spec.add_dependency "capybara", "~> 3.40"
22
22
  spec.add_dependency "poltergeist"
23
23
  spec.add_development_dependency "rake"
24
24
  end
@@ -42,58 +42,58 @@ end
42
42
  # Here we have overridden the behavior of a method in Capybara. The part
43
43
  # that we added is highlighted below to make it easier when upgrading
44
44
  # to a future version of Capybara.
45
+ #
46
+ # Original code lives here: https://github.com/teamcapybara/capybara/blob/3.40.0/lib/capybara/node/base.rb#L76
45
47
 
46
48
  ##### THIS CODE IS ORIGINAL
47
49
  module Capybara
48
50
  module Node
49
51
  class Base
52
+ def synchronize(seconds = nil, errors: nil)
53
+ return yield if session.synchronized
50
54
  ##### START PUNCHING DUCKS
51
55
  # orig code:
52
- # def synchronize(seconds=Capybara.default_max_wait_time, options = {})
56
+ # seconds = session_options.default_max_wait_time if [nil, true].include? seconds
53
57
  # new code:
54
- def synchronize(seconds = nil, options = {})
55
58
  kanye_in_the_house = session.driver.respond_to?(:kanye_invited?) && session.driver.kanye_invited?
56
- if seconds
57
- seconds_to_wait = seconds
58
- elsif kanye_in_the_house
59
- seconds_to_wait = DmcKanye::Config.default_wait_time || Capybara.default_max_wait_time
60
- else
61
- seconds_to_wait = Capybara.default_max_wait_time
59
+ if [nil, true].include? seconds
60
+ if kanye_in_the_house
61
+ seconds = DmcKanye::Config.default_wait_time || session_options.default_max_wait_time
62
+ else
63
+ seconds = session_options.default_max_wait_time
64
+ end
62
65
  end
63
66
  ##### STOP PUNCHING DUCKS, BACK TO ORIGINAL CODE
64
- start_time = Capybara::Helpers.monotonic_time
65
-
66
- if session.synchronized
67
- yield
68
- else
69
- session.synchronized = true
70
- begin
67
+ interval = session_options.default_retry_interval
68
+ session.synchronized = true
69
+ timer = Capybara::Helpers.timer(expire_in: seconds)
70
+ begin
71
71
  ##### START PUNCHING DUCKS
72
72
  # orig code:
73
- # yield
73
+ # yield
74
74
  # new code:
75
- session.driver.send(:imma_let_you_finish) if kanye_in_the_house
76
- result = yield
77
- session.driver.send(:imma_let_you_finish) if kanye_in_the_house
78
- result
75
+ session.driver.send(:imma_let_you_finish) if kanye_in_the_house
76
+ result = yield
77
+ session.driver.send(:imma_let_you_finish) if kanye_in_the_house
78
+ result
79
79
  ##### STOP PUNCHING DUCKS, BACK TO ORIGINAL CODE
80
- rescue => e
81
- session.raise_server_error!
82
- raise e unless driver.wait?
83
- raise e unless catch_error?(e, options[:errors])
84
- ##### START PUNCHING DUCKS
85
- # orig code:
86
- # raise e if (Capybara::Helpers.monotonic_time - start_time) >= seconds
87
- # new code:
88
- raise e if (Capybara::Helpers.monotonic_time - start_time) >= seconds_to_wait
89
- ##### STOP PUNCHING DUCKS, BACK TO ORIGINAL CODE
90
- sleep(0.05)
91
- raise Capybara::FrozenInTime, "time appears to be frozen, Capybara does not work with libraries which freeze time, consider using time travelling instead" if Capybara::Helpers.monotonic_time == start_time
92
- reload if Capybara.automatic_reload
93
- retry
94
- ensure
95
- session.synchronized = false
80
+ rescue StandardError => e
81
+ session.raise_server_error!
82
+ raise e unless catch_error?(e, errors)
83
+
84
+ if driver.wait?
85
+ raise e if timer.expired?
86
+
87
+ sleep interval
88
+ reload if session_options.automatic_reload
89
+ else
90
+ old_base = @base
91
+ reload if session_options.automatic_reload
92
+ raise e if old_base == @base
96
93
  end
94
+ retry
95
+ ensure
96
+ session.synchronized = false
97
97
  end
98
98
  end
99
99
  end
@@ -1,3 +1,3 @@
1
1
  module DmcKanye
2
- VERSION = "0.2.0"
2
+ VERSION = "0.3.0" # major version is 0; minor version is the major version of the Capybara we are overriding
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dmc_kanye
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Wyatt Greene
@@ -9,22 +9,22 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2024-09-09 00:00:00.000000000 Z
12
+ date: 2025-01-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: capybara
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - ">="
18
+ - - "~>"
19
19
  - !ruby/object:Gem::Version
20
- version: '0'
20
+ version: '3.40'
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
- - - ">="
25
+ - - "~>"
26
26
  - !ruby/object:Gem::Version
27
- version: '0'
27
+ version: '3.40'
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: poltergeist
30
30
  requirement: !ruby/object:Gem::Requirement