ae_page_objects 1.2.0 → 1.2.1

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
  SHA1:
3
- metadata.gz: e5eeebecb74ccaec9739afd6183c3d8906ce2b9e
4
- data.tar.gz: 6752901420af4fe99325e9735cbc3a5e9ddf68de
3
+ metadata.gz: 1496697b39e5a7662d536eda0f8ca5fef935b6b7
4
+ data.tar.gz: 18b7a97561c00230d65f3e5a9c2ab540e5c9dc6d
5
5
  SHA512:
6
- metadata.gz: 4b420a7c14fcde32afb609815550643a84b828f58654ebee477e4ef3bbf762ef70ff01ad16d09f174a68eddaa881cb706e3656fc7153a2ed1df401cb409f28ea
7
- data.tar.gz: 25adc0b0e01e95ed700ee6a1bae61544662441b877778609db2449c091e36bb419c45ed5459a68e7a435b3ddd1d2391d9ab392cd5a41d9c6d3ba8cf60dba818c
6
+ metadata.gz: 6ec2500cc1c2ded7fa193dabd15f3e3813a427b459508d1732ba182f29ec39fb8e4b530abd96ea89d94875c156ab67c68fb53431fcbe34fbbeb2e2fef780c831
7
+ data.tar.gz: cb79d33d0817bfede524f924a1ccb660cf22b6f124d9dc96bccb2755d445a96311f4aa7e1792293e44c7d066d3e76a591f10a8ff62c39e4045ba213021b07309
@@ -16,24 +16,10 @@ module AePageObjects
16
16
  class Rails23 < Base
17
17
  def recognizes?(path, url)
18
18
  ["GET", "PUT", "POST", "DELETE", "PATCH"].map(&:downcase).map(&:to_sym).each do |method|
19
- path_route_result = ActionController::Routing::Routes.named_routes[path].requirements
20
- recognized_result = nil
21
-
22
- begin
23
- recognized_result = ActionController::Routing::Routes.recognize_path(url, {:method => method}).select do
24
- |key, _|
25
- key.to_s.match(/(controller|action)/)
26
- end
27
- rescue ActionController::MethodNotAllowed
28
- end
19
+ route = ActionController::Routing::Routes.named_routes[path]
20
+ route.recognize(url, {:method => method})
29
21
 
30
- # Only the first recognized path returned by Rails is considered,
31
- # which means, we only want highest prioritized route.
32
- if recognized_result && path_route_result == Hash[recognized_result]
33
- return true
34
- else
35
- next
36
- end
22
+ return true if route && route.recognize(url, {:method => method})
37
23
  end
38
24
 
39
25
  false
@@ -58,18 +44,14 @@ module AePageObjects
58
44
 
59
45
  ["GET", "PUT", "POST", "DELETE", "PATCH"].each do |method|
60
46
  router.recognize(request_for(url, method)) do |route, matches, params|
61
- if route.name.to_s == path.to_s
62
- return true
63
- else
64
- # We break the inner loop here because only the first recognized path returned by Rails is considered,
65
- # which means, we only want highest prioritized route.
66
- break
67
- end
47
+ return true if route.name.to_s == path.to_s
68
48
  end
69
49
  end
50
+
70
51
  false
71
52
  end
72
53
 
54
+
73
55
  private
74
56
 
75
57
  def request_for(url, method)
@@ -104,7 +86,6 @@ module AePageObjects
104
86
  class Rails32 < Rails3
105
87
 
106
88
  private
107
-
108
89
  def url_and_router(url)
109
90
  url = Journey::Router::Utils.normalize_path(url) unless url =~ %r{://}
110
91
  router = ::Rails.application.routes.router
@@ -115,8 +96,7 @@ module AePageObjects
115
96
 
116
97
  class Rails4 < Rails32
117
98
 
118
- private
119
-
99
+ private
120
100
  def url_and_router(url)
121
101
  require 'action_dispatch/journey'
122
102
  url = ActionDispatch::Journey::Router::Utils.normalize_path(url) unless url =~ %r{://}
@@ -125,6 +105,7 @@ module AePageObjects
125
105
  [url, router]
126
106
  end
127
107
  end
108
+
128
109
  end
129
110
 
130
111
  def path_recognizes_url?(path, url)
@@ -1,3 +1,3 @@
1
1
  module AePageObjects
2
- VERSION = '1.2.0'.freeze
2
+ VERSION = '1.2.1'.freeze
3
3
  end
metadata CHANGED
@@ -1,33 +1,33 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ae_page_objects
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Donnie Tognazzini
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-04 00:00:00.000000000 Z
11
+ date: 2014-10-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: capybara
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.1'
20
- - - <
20
+ - - "<"
21
21
  - !ruby/object:Gem::Version
22
22
  version: '2.3'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
- - - '>='
27
+ - - ">="
28
28
  - !ruby/object:Gem::Version
29
29
  version: '1.1'
30
- - - <
30
+ - - "<"
31
31
  - !ruby/object:Gem::Version
32
32
  version: '2.3'
33
33
  description: Capybara Page Objects pattern
@@ -85,17 +85,17 @@ require_paths:
85
85
  - lib
86
86
  required_ruby_version: !ruby/object:Gem::Requirement
87
87
  requirements:
88
- - - '>='
88
+ - - ">="
89
89
  - !ruby/object:Gem::Version
90
90
  version: '0'
91
91
  required_rubygems_version: !ruby/object:Gem::Requirement
92
92
  requirements:
93
- - - '>='
93
+ - - ">="
94
94
  - !ruby/object:Gem::Version
95
95
  version: '0'
96
96
  requirements: []
97
97
  rubyforge_project:
98
- rubygems_version: 2.1.11
98
+ rubygems_version: 2.2.2
99
99
  signing_key:
100
100
  specification_version: 4
101
101
  summary: Capybara Page Objects pattern