ae_page_objects 1.1.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -19,7 +19,7 @@ module AePageObjects
19
19
 
20
20
  self
21
21
  rescue Capybara::ElementNotFound => e
22
- raise LoadingFailed, e.message
22
+ raise LoadingElementFailed, e.message
23
23
  end
24
24
  end
25
25
  end
@@ -10,10 +10,14 @@ module AePageObjects
10
10
 
11
11
  def ensure_loaded!
12
12
  unless Waiter.wait_for { self.class.can_load_from_current_url? }
13
- raise LoadingFailed, "#{self.class.name} cannot be loaded with url '#{current_url_without_params}'"
13
+ raise LoadingPageFailed, "#{self.class.name} cannot be loaded with url '#{current_url_without_params}'"
14
14
  end
15
15
 
16
- super
16
+ begin
17
+ super
18
+ rescue LoadingElementFailed
19
+ raise LoadingPageFailed, e.message
20
+ end
17
21
  end
18
22
 
19
23
  module VisitMethod
@@ -55,7 +55,7 @@ module AePageObjects
55
55
  private
56
56
 
57
57
  def request_for(url, method)
58
- Rails.application.routes.request_class.new(env_for(url, method))
58
+ ::Rails.application.routes.request_class.new(env_for(url, method))
59
59
  end
60
60
 
61
61
  def env_for(url, method)
@@ -68,7 +68,7 @@ module AePageObjects
68
68
 
69
69
  def url_and_router(url)
70
70
  url = Rack::Mount::Utils.normalize_path(url) unless url =~ %r{://}
71
- router = Rails.application.routes.set
71
+ router = ::Rails.application.routes.set
72
72
 
73
73
  [url, router]
74
74
  end
@@ -76,7 +76,7 @@ module AePageObjects
76
76
  def routes
77
77
  @routes ||= begin
78
78
  routes_class = Class.new do
79
- include Rails.application.routes.url_helpers
79
+ include ::Rails.application.routes.url_helpers
80
80
  end
81
81
  routes_class.new
82
82
  end
@@ -88,7 +88,7 @@ module AePageObjects
88
88
  private
89
89
  def url_and_router(url)
90
90
  url = Journey::Router::Utils.normalize_path(url) unless url =~ %r{://}
91
- router = Rails.application.routes.router
91
+ router = ::Rails.application.routes.router
92
92
 
93
93
  [url, router]
94
94
  end
@@ -100,7 +100,7 @@ module AePageObjects
100
100
  def url_and_router(url)
101
101
  require 'action_dispatch/journey'
102
102
  url = ActionDispatch::Journey::Router::Utils.normalize_path(url) unless url =~ %r{://}
103
- router = Rails.application.routes.router
103
+ router = ::Rails.application.routes.router
104
104
 
105
105
  [url, router]
106
106
  end
@@ -128,18 +128,17 @@ module AePageObjects
128
128
 
129
129
  def recognizer
130
130
  @recognizer ||= begin
131
- if Rails.version =~ /\A2\.3/
131
+ if ::Rails.version =~ /\A2\.3/
132
132
  Recognizer::Rails23.new
133
- elsif Rails.version =~ /\A3\.[01]/
133
+ elsif ::Rails.version =~ /\A3\.[01]/
134
134
  Recognizer::Rails3.new
135
- elsif Rails.version =~ /\A3\.2/
135
+ elsif ::Rails.version =~ /\A3\.2/
136
136
  Recognizer::Rails32.new
137
- elsif Rails.version =~ /\A4\.[01]/
138
- warn "[WARNING]: AePageObjects works but is not thoroughly tested against Rails 4. Caveat emptor."
137
+ elsif ::Rails.version =~ /\A4\.[01]/
139
138
  Recognizer::Rails4.new
140
139
  else
141
- warn "[WARNING]: AePageObjects is not tested against Rails #{Rails.version} and may behave in an undefined manner."
142
- Recognizer::Rails32.new
140
+ warn "[WARNING]: AePageObjects is not tested against Rails #{::Rails.version} and may behave in an undefined manner."
141
+ Recognizer::Rails4.new
143
142
  end
144
143
  end
145
144
  end
@@ -101,6 +101,8 @@ module AePageObjects
101
101
  end
102
102
 
103
103
  parent.node
104
+ rescue Capybara::ElementNotFound => e
105
+ raise LoadingElementFailed, e.message
104
106
  end
105
107
  end
106
108
  end
@@ -44,7 +44,7 @@ module AePageObjects
44
44
 
45
45
  def presence
46
46
  element
47
- rescue Capybara::ElementNotFound
47
+ rescue AePageObjects::LoadingElementFailed
48
48
  nil
49
49
  end
50
50
 
@@ -7,9 +7,15 @@ module AePageObjects
7
7
  class LoadingFailed < Error
8
8
  end
9
9
 
10
+ class LoadingPageFailed < LoadingFailed
11
+ end
12
+
13
+ class LoadingElementFailed < LoadingFailed
14
+ end
15
+
10
16
  class PathNotResolvable < Error
11
17
  end
12
18
 
13
19
  class DocumentLoadError < Error
14
20
  end
15
- end
21
+ end
@@ -19,13 +19,13 @@ module AePageObjects
19
19
 
20
20
  def load_document(document_class)
21
21
  document_class.new
22
- rescue AePageObjects::LoadingFailed
22
+ rescue AePageObjects::LoadingPageFailed
23
23
  nil
24
24
  end
25
25
 
26
26
  def condition_matches?(document, condition)
27
27
  condition.match?(document)
28
- rescue Capybara::ElementNotFound
28
+ rescue AePageObjects::LoadingElementFailed
29
29
  false
30
30
  end
31
31
  end
@@ -1,3 +1,3 @@
1
1
  module AePageObjects
2
- VERSION = '1.1.0'.freeze
2
+ VERSION = '1.1.1'.freeze
3
3
  end
metadata CHANGED
@@ -1,42 +1,54 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: ae_page_objects
3
- version: !ruby/object:Gem::Version
4
- version: 1.1.0
3
+ version: !ruby/object:Gem::Version
4
+ hash: 17
5
+ prerelease:
6
+ segments:
7
+ - 1
8
+ - 1
9
+ - 1
10
+ version: 1.1.1
5
11
  platform: ruby
6
- authors:
12
+ authors:
7
13
  - Donnie Tognazzini
8
14
  autorequire:
9
15
  bindir: bin
10
16
  cert_chain: []
11
- date: 2014-06-06 00:00:00.000000000 Z
12
- dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: capybara
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - '>='
18
- - !ruby/object:Gem::Version
19
- version: '1.1'
17
+
18
+ date: 2014-09-10 00:00:00 Z
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ version_requirements: &id001 !ruby/object:Gem::Requirement
22
+ none: false
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ hash: 13
27
+ segments:
28
+ - 1
29
+ - 1
30
+ version: "1.1"
20
31
  - - <
21
- - !ruby/object:Gem::Version
22
- version: '2.3'
23
- type: :runtime
32
+ - !ruby/object:Gem::Version
33
+ hash: 5
34
+ segments:
35
+ - 2
36
+ - 3
37
+ version: "2.3"
24
38
  prerelease: false
25
- version_requirements: !ruby/object:Gem::Requirement
26
- requirements:
27
- - - '>='
28
- - !ruby/object:Gem::Version
29
- version: '1.1'
30
- - - <
31
- - !ruby/object:Gem::Version
32
- version: '2.3'
39
+ requirement: *id001
40
+ type: :runtime
41
+ name: capybara
33
42
  description: Capybara Page Objects pattern
34
- email:
43
+ email:
35
44
  - engineering@appfolio.com
36
45
  executables: []
46
+
37
47
  extensions: []
48
+
38
49
  extra_rdoc_files: []
39
- files:
50
+
51
+ files:
40
52
  - lib/ae_page_objects.rb
41
53
  - lib/ae_page_objects/concerns/load_ensuring.rb
42
54
  - lib/ae_page_objects/concerns/staleable.rb
@@ -76,27 +88,37 @@ files:
76
88
  - lib/ae_page_objects/version.rb
77
89
  - lib/ae_page_objects/window.rb
78
90
  homepage: http://github.com/appfolio/ae_page_objects
79
- licenses:
91
+ licenses:
80
92
  - MIT
81
- metadata: {}
82
93
  post_install_message:
83
94
  rdoc_options: []
84
- require_paths:
95
+
96
+ require_paths:
85
97
  - lib
86
- required_ruby_version: !ruby/object:Gem::Requirement
87
- requirements:
88
- - - '>='
89
- - !ruby/object:Gem::Version
90
- version: '0'
91
- required_rubygems_version: !ruby/object:Gem::Requirement
92
- requirements:
93
- - - '>='
94
- - !ruby/object:Gem::Version
95
- version: '0'
98
+ required_ruby_version: !ruby/object:Gem::Requirement
99
+ none: false
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ hash: 3
104
+ segments:
105
+ - 0
106
+ version: "0"
107
+ required_rubygems_version: !ruby/object:Gem::Requirement
108
+ none: false
109
+ requirements:
110
+ - - ">="
111
+ - !ruby/object:Gem::Version
112
+ hash: 3
113
+ segments:
114
+ - 0
115
+ version: "0"
96
116
  requirements: []
117
+
97
118
  rubyforge_project:
98
- rubygems_version: 2.1.11
119
+ rubygems_version: 1.8.25
99
120
  signing_key:
100
- specification_version: 4
121
+ specification_version: 3
101
122
  summary: Capybara Page Objects pattern
102
123
  test_files: []
124
+
checksums.yaml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- SHA1:
3
- metadata.gz: 5334b6a4fd2514a439fa323284a5893cb21005ca
4
- data.tar.gz: 64a263fd884d0e933ebf8000ad88ed689dc3f601
5
- SHA512:
6
- metadata.gz: 3af8bd7d6c91c8865641f2673cba8244ccc4d5db142bc95591f70dc57fdc2ecec8f924dfc71fe6fc38627b36fc5e1a1e8007d970b06a65ff17113f5b7f915fe3
7
- data.tar.gz: 2b3d973eb84a26923bd6db1dcbec1bcdc18a85a923f98e3f60dfeed2b44e7ffaffa886fb88c6bc9695f565baa12fc5a0ea7a3818e311ff004a299072388b1e6f