site_prism 2.16 → 2.17

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: 91f1632193e711e5407036c5674c839746dc6411bd9d4b851f5872aff13f67dc
4
- data.tar.gz: 0847ba2fe40e538940888176910aad356357f6fad87e2d7bff87af20a2b03f67
3
+ metadata.gz: 6285ddbcaebdf2970ed1d74ff56800c196124e984ea6973ab4d9f083dcff8b10
4
+ data.tar.gz: cc137169a3dcaf0f3b05eb9fdaae5bdb31970a53ebc8e8c3bf88e65658c56a31
5
5
  SHA512:
6
- metadata.gz: bc11978a37f85598d22081d96ede596181866c9533357bf42e5fe17530c4082780c9272186e3b579eff61d89d5d1ef6afa6e5a009eba26f655d6eefa70d41ca4
7
- data.tar.gz: c609309f64ba914756fffcb9038345741e14c73f07d508fe246a96e5b7697e7e8486011e4d95d7a6dd8145d58113e07fab533ce503b4eee3ec54240f230e9db6
6
+ metadata.gz: 870e2b8e512b5b5deeeb909598ca20d032ef35b4b153ae4c3f6b832336aaa873ad416fd73005e2f5715739150f67b0e61cb57a724603998aa8343a631020870f
7
+ data.tar.gz: 0df084b3f02295206ecc82154209cd83c6b1208810fba3cc8b2c8f828333a6b4baf4b87ec919c575503ea72c8cf833a958e9d50b460efb0b2000d560331a2bc8
@@ -30,6 +30,7 @@ module SitePrism
30
30
  def raise_wait_for_if_failed(obj, name, timeout, failed)
31
31
  return unless SitePrism.raise_on_wait_fors && failed
32
32
 
33
+ deprecate('Listening for TimeOutWaitingForExistenceError')
33
34
  raise SitePrism::TimeOutWaitingForExistenceError, \
34
35
  "Timed out after #{timeout}s waiting for #{obj.class}##{name}"
35
36
  end
@@ -37,6 +38,7 @@ module SitePrism
37
38
  def raise_wait_for_no_if_failed(obj, name, timeout, failed)
38
39
  return unless SitePrism.raise_on_wait_fors && failed
39
40
 
41
+ deprecate('Listening for TimeOutWaitingForNonExistenceError')
40
42
  raise SitePrism::TimeOutWaitingForNonExistenceError, \
41
43
  "Timed out after #{timeout}s waiting for no #{obj.class}##{name}"
42
44
  end
@@ -64,6 +66,11 @@ module SitePrism
64
66
  SitePrism.use_implicit_waits || options.key?(:wait)
65
67
  end
66
68
 
69
+ def deprecate(previous, new = nil)
70
+ warn "Usage of #{previous} is now deprecated and should be not used."
71
+ warn "Use #{new} instead." if new
72
+ end
73
+
67
74
  # rubocop:disable Metrics/ModuleLength
68
75
  module ClassMethods
69
76
  attr_reader :mapped_items, :expected_items
@@ -86,12 +93,6 @@ module SitePrism
86
93
  end
87
94
  end
88
95
 
89
- def collection(name, *find_args)
90
- warn 'Using collection is now deprecated and will be removed.'
91
- warn 'Use elements DSL notation instead.'
92
- elements(name, *find_args)
93
- end
94
-
95
96
  def expected_elements(*elements)
96
97
  @expected_items = elements
97
98
  end
@@ -199,6 +200,7 @@ module SitePrism
199
200
  method_name = "wait_for_#{element_name}"
200
201
  create_helper_method(method_name, *find_args) do
201
202
  define_method(method_name) do |timeout = wait_time, *runtime_args|
203
+ deprecate('wait_for methods', 'wait key assignment at runtime')
202
204
  visibility_args = { wait: timeout }
203
205
  args = merge_args(find_args, runtime_args, visibility_args)
204
206
  result = element_exists?(*args)
@@ -212,6 +214,7 @@ module SitePrism
212
214
  method_name = "wait_for_no_#{element_name}"
213
215
  create_helper_method(method_name, *find_args) do
214
216
  define_method(method_name) do |timeout = wait_time, *runtime_args|
217
+ deprecate('wait_for_no methods', 'wait key assignment at runtime')
215
218
  visibility_args = { wait: timeout }
216
219
  args = merge_args(find_args, runtime_args, visibility_args)
217
220
  result = element_does_not_exist?(*args)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SitePrism
4
- VERSION = '2.16'.freeze
4
+ VERSION = '2.17'.freeze
5
5
  end
data/lib/site_prism.rb CHANGED
@@ -12,13 +12,44 @@ module SitePrism
12
12
  autoload :AddressableUrlMatcher, 'site_prism/addressable_url_matcher'
13
13
 
14
14
  class << self
15
- attr_accessor :use_implicit_waits,
16
- :raise_on_wait_fors,
17
- :default_load_validations
18
-
19
15
  def configure
20
16
  yield self
21
17
  end
18
+
19
+ def use_implicit_waits
20
+ show_removed_config_warning_messages
21
+ @use_implicit_waits
22
+ end
23
+
24
+ def use_implicit_waits=(value)
25
+ show_removed_config_warning_messages
26
+ @use_implicit_waits = value
27
+ end
28
+
29
+ def raise_on_wait_fors
30
+ show_removed_config_warning_messages
31
+ @raise_on_wait_fors
32
+ end
33
+
34
+ def raise_on_wait_fors=(value)
35
+ show_removed_config_warning_messages
36
+ @raise_on_wait_fors = value
37
+ end
38
+
39
+ def default_load_validations
40
+ show_removed_config_warning_messages
41
+ @default_load_validations
42
+ end
43
+
44
+ def default_load_validations=(value)
45
+ show_removed_config_warning_messages
46
+ @default_load_validations = value
47
+ end
48
+
49
+ def show_removed_config_warning_messages
50
+ warn 'This config option is being removed in SitePrism v3. See UPGRADING.md on the repo for more details.'
51
+ warn 'Going forwards the configuration / configurability will more closely mimic Capybara.'
52
+ end
22
53
  end
23
54
 
24
55
  @default_load_validations = true
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: site_prism
3
3
  version: !ruby/object:Gem::Version
4
- version: '2.16'
4
+ version: '2.17'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nat Ritmeyer
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2018-08-22 00:00:00.000000000 Z
12
+ date: 2018-09-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: addressable