ae_page_objects 2.0.0.beta1 → 2.0.0.beta2

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: 2dec9e34721561ba781508ef0b2c14b254fa4f5f
4
- data.tar.gz: 33356ca72c8529bbb1c64169c42c290c545b486b
3
+ metadata.gz: 4d1047792e65a7c7ddf5deca452f5f687e3d0ac1
4
+ data.tar.gz: d56f0eb00934b7e97aab199c5629867d06bd6c1a
5
5
  SHA512:
6
- metadata.gz: 3ff183bf91b4049702f1fbb32192e7f92d05e279743c1091e0a5740ea50dc89ccf595a7fdefa3ae7c3cdf14a77fef9c3f214d9ad5a8f1bcf58d5ae4b6b9e12ea
7
- data.tar.gz: 4b7c1c3de1d8f16b7f38b2cfaf4f67e5b5f0b1671b614d0be8a5e147bcf568104c82e00362d06428e2bebce6bdd29c939acb486441a8efd343eea461056b2ecf
6
+ metadata.gz: b4e0f544e11d234643955e2c2464df9fcaac81f70c0a9f7e399ea72123e7f96373f0d51e5674234653a41c694bb1adcf25198052625ae2d5c3ddd09f118b9905
7
+ data.tar.gz: cbdd37fb41439a93f26e019f8c0bf55d052a77aefb428915e96117528a2f509c3b3b3d4c81e1ece1dfac1902a5902a44e780e0f435edb3d48e335a11a1e3b650
@@ -5,39 +5,9 @@ require 'ae_page_objects/version'
5
5
  require 'ae_page_objects/exceptions'
6
6
 
7
7
  module AePageObjects
8
- autoload :Universe, 'ae_page_objects/core/universe'
9
- autoload :Site, 'ae_page_objects/core/site'
10
- autoload :BasicRouter, 'ae_page_objects/core/basic_router'
11
- autoload :ApplicationRouter, 'ae_page_objects/core/application_router'
12
- autoload :Dsl, 'ae_page_objects/core/dsl'
13
-
14
- autoload :Singleton, 'ae_page_objects/util/singleton'
15
- autoload :InternalHelpers, 'ae_page_objects/util/internal_helpers'
16
- autoload :HashSymbolizer, 'ae_page_objects/util/hash_symbolizer'
17
- autoload :Inflector, 'ae_page_objects/util/inflector'
18
-
19
- module MultipleWindows
20
- autoload :Browser, 'ae_page_objects/multiple_windows/browser'
21
- autoload :Window, 'ae_page_objects/multiple_windows/window'
22
- autoload :CrossWindowLoaderStrategy, 'ae_page_objects/multiple_windows/cross_window_loader_strategy'
23
- autoload :WindowList, 'ae_page_objects/multiple_windows/window_list'
24
- autoload :WindowHandleManager, 'ae_page_objects/multiple_windows/window_handle_manager'
25
- end
26
-
27
- module SingleWindow
28
- autoload :Browser, 'ae_page_objects/single_window/browser'
29
- autoload :Window, 'ae_page_objects/single_window/window'
30
- autoload :SameWindowLoaderStrategy, 'ae_page_objects/single_window/same_window_loader_strategy'
31
- end
32
-
33
- autoload :DocumentQuery, 'ae_page_objects/document_query'
34
- autoload :DocumentLoader, 'ae_page_objects/document_loader'
35
-
36
8
  autoload :Node, 'ae_page_objects/node'
37
9
  autoload :Document, 'ae_page_objects/document'
38
- autoload :DocumentProxy, 'ae_page_objects/document_proxy'
39
10
  autoload :Element, 'ae_page_objects/element'
40
- autoload :ElementProxy, 'ae_page_objects/element_proxy'
41
11
 
42
12
  autoload :Collection, 'ae_page_objects/elements/collection'
43
13
  autoload :Form, 'ae_page_objects/elements/form'
@@ -45,6 +15,7 @@ module AePageObjects
45
15
  autoload :Checkbox, 'ae_page_objects/elements/checkbox'
46
16
 
47
17
  class << self
18
+ attr_accessor :default_router
48
19
 
49
20
  def browser
50
21
  @browser ||= begin
@@ -52,8 +23,10 @@ module AePageObjects
52
23
 
53
24
  case driver
54
25
  when Capybara::Selenium::Driver then
26
+ require 'ae_page_objects/multiple_windows/browser'
55
27
  MultipleWindows::Browser.new
56
28
  else
29
+ require 'ae_page_objects/single_window/browser'
57
30
  SingleWindow::Browser.new
58
31
  end
59
32
  end
@@ -89,14 +62,5 @@ module AePageObjects
89
62
  end
90
63
  end
91
64
 
92
- require 'ae_page_objects/core_ext/module'
93
-
94
-
95
-
96
-
97
-
98
-
99
-
100
-
101
-
102
-
65
+ require 'ae_page_objects/core/basic_router'
66
+ AePageObjects.default_router = AePageObjects::BasicRouter.new
@@ -1,3 +1,6 @@
1
+ require 'ae_page_objects/util/internal_helpers'
2
+ require 'ae_page_objects/element_proxy'
3
+
1
4
  module AePageObjects
2
5
  module Dsl
3
6
  include InternalHelpers
@@ -1,13 +1,25 @@
1
1
  module AePageObjects
2
2
  class Document < Node
3
3
  class << self
4
+ attr_writer :router
5
+
6
+ def router
7
+ @router ||= begin
8
+ if [self, superclass].include?(Document)
9
+ AePageObjects.default_router
10
+ else
11
+ superclass.router
12
+ end
13
+ end
14
+ end
15
+
4
16
  def can_load_from_current_url?
5
17
  return true if paths.empty?
6
18
 
7
19
  url = current_url_without_params
8
20
 
9
21
  paths.any? do |path|
10
- site.path_recognizes_url?(path, url)
22
+ router.path_recognizes_url?(path, url)
11
23
  end
12
24
  end
13
25
 
@@ -17,7 +29,7 @@ module AePageObjects
17
29
 
18
30
  path = inner_options.delete(:via) || paths.first
19
31
 
20
- full_path = site.generate_path(path, *args)
32
+ full_path = router.generate_path(path, *args)
21
33
  raise PathNotResolvable, "#{self.name} not visitable via #{paths.first}(#{args.inspect})" unless full_path
22
34
 
23
35
  Capybara.current_session.visit(full_path)
@@ -36,10 +48,6 @@ module AePageObjects
36
48
 
37
49
  paths << path_method
38
50
  end
39
-
40
- def site
41
- @site ||= Site.from(self)
42
- end
43
51
  end
44
52
 
45
53
  attr_reader :window
@@ -1,3 +1,5 @@
1
+ require 'ae_page_objects/util/hash_symbolizer'
2
+
1
3
  module AePageObjects
2
4
  class Element < Node
3
5
  attr_reader :parent
@@ -1,3 +1,5 @@
1
+ require 'ae_page_objects/element_proxy'
2
+
1
3
  module AePageObjects
2
4
  class Collection < Element
3
5
  include Enumerable
@@ -4,14 +4,10 @@ module AePageObjects
4
4
  class StalePageObject < Error
5
5
  end
6
6
 
7
- # TODO: 2.0 - remove this base class.
8
- class LoadingFailed < Error
7
+ class LoadingPageFailed < Error
9
8
  end
10
9
 
11
- class LoadingPageFailed < LoadingFailed
12
- end
13
-
14
- class LoadingElementFailed < LoadingFailed
10
+ class LoadingElementFailed < Error
15
11
  end
16
12
 
17
13
  class ElementExpectationError < Error
@@ -1,3 +1,10 @@
1
+ require 'ae_page_objects/multiple_windows/cross_window_loader_strategy'
2
+ require 'ae_page_objects/multiple_windows/window_list'
3
+
4
+ require 'ae_page_objects/document_loader'
5
+ require 'ae_page_objects/document_proxy'
6
+ require 'ae_page_objects/document_query'
7
+
1
8
  module AePageObjects
2
9
  module MultipleWindows
3
10
  class Browser
@@ -1,3 +1,5 @@
1
+ require 'ae_page_objects/single_window/same_window_loader_strategy'
2
+
1
3
  module AePageObjects
2
4
  module MultipleWindows
3
5
  class CrossWindowLoaderStrategy
@@ -1,3 +1,7 @@
1
+ require 'ae_page_objects/multiple_windows/window_handle_manager'
2
+
3
+ require 'ae_page_objects/single_window/window'
4
+
1
5
  module AePageObjects
2
6
  module MultipleWindows
3
7
  class Window < SingleWindow::Window
@@ -25,4 +29,4 @@ module AePageObjects
25
29
  end
26
30
  end
27
31
  end
28
- end
32
+ end
@@ -1,3 +1,6 @@
1
+ require 'ae_page_objects/multiple_windows/window_handle_manager'
2
+ require 'ae_page_objects/multiple_windows/window'
3
+
1
4
  module AePageObjects
2
5
  module MultipleWindows
3
6
  class WindowList
@@ -57,4 +60,4 @@ module AePageObjects
57
60
  end
58
61
  end
59
62
  end
60
- end
63
+ end
@@ -1,3 +1,5 @@
1
+ require 'ae_page_objects/core/dsl'
2
+
1
3
  module AePageObjects
2
4
  class Node
3
5
  extend Dsl
@@ -0,0 +1,3 @@
1
+ require 'ae_page_objects/rails/application_router'
2
+
3
+ AePageObjects.default_router = AePageObjects::ApplicationRouter.new
@@ -1,3 +1,5 @@
1
+ require 'ae_page_objects/core/basic_router'
2
+
1
3
  module AePageObjects
2
4
  class ApplicationRouter < BasicRouter
3
5
 
@@ -1,3 +1,5 @@
1
+ require 'ae_page_objects/single_window/window'
2
+
1
3
  module AePageObjects
2
4
  module SingleWindow
3
5
  class Browser
@@ -8,4 +10,4 @@ module AePageObjects
8
10
  end
9
11
  end
10
12
  end
11
- end
13
+ end
@@ -1,3 +1,9 @@
1
+ require 'ae_page_objects/single_window/same_window_loader_strategy'
2
+
3
+ require 'ae_page_objects/document_loader'
4
+ require 'ae_page_objects/document_proxy'
5
+ require 'ae_page_objects/document_query'
6
+
1
7
  module AePageObjects
2
8
  module SingleWindow
3
9
  class Window
@@ -1,3 +1,3 @@
1
1
  module AePageObjects
2
- VERSION = '2.0.0.beta1'.freeze
2
+ VERSION = '2.0.0.beta2'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ae_page_objects
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0.beta1
4
+ version: 2.0.0.beta2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Donnie Tognazzini
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-05-13 00:00:00.000000000 Z
11
+ date: 2016-06-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: capybara
@@ -32,12 +32,8 @@ extensions: []
32
32
  extra_rdoc_files: []
33
33
  files:
34
34
  - lib/ae_page_objects.rb
35
- - lib/ae_page_objects/core/application_router.rb
36
35
  - lib/ae_page_objects/core/basic_router.rb
37
36
  - lib/ae_page_objects/core/dsl.rb
38
- - lib/ae_page_objects/core/site.rb
39
- - lib/ae_page_objects/core/universe.rb
40
- - lib/ae_page_objects/core_ext/module.rb
41
37
  - lib/ae_page_objects/document.rb
42
38
  - lib/ae_page_objects/document_loader.rb
43
39
  - lib/ae_page_objects/document_proxy.rb
@@ -55,14 +51,14 @@ files:
55
51
  - lib/ae_page_objects/multiple_windows/window_handle_manager.rb
56
52
  - lib/ae_page_objects/multiple_windows/window_list.rb
57
53
  - lib/ae_page_objects/node.rb
54
+ - lib/ae_page_objects/rails.rb
55
+ - lib/ae_page_objects/rails/application_router.rb
58
56
  - lib/ae_page_objects/single_window/browser.rb
59
57
  - lib/ae_page_objects/single_window/same_window_loader_strategy.rb
60
58
  - lib/ae_page_objects/single_window/window.rb
61
59
  - lib/ae_page_objects/util/hash_symbolizer.rb
62
- - lib/ae_page_objects/util/inflector.rb
63
60
  - lib/ae_page_objects/util/internal_helpers.rb
64
61
  - lib/ae_page_objects/util/page_polling.rb
65
- - lib/ae_page_objects/util/singleton.rb
66
62
  - lib/ae_page_objects/version.rb
67
63
  homepage: http://github.com/appfolio/ae_page_objects
68
64
  licenses:
@@ -79,9 +75,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
79
75
  version: 1.9.3
80
76
  required_rubygems_version: !ruby/object:Gem::Requirement
81
77
  requirements:
82
- - - ">="
78
+ - - ">"
83
79
  - !ruby/object:Gem::Version
84
- version: '0'
80
+ version: 1.3.1
85
81
  requirements: []
86
82
  rubyforge_project:
87
83
  rubygems_version: 2.4.3
@@ -1,61 +0,0 @@
1
- module AePageObjects
2
- class Site
3
- extend AePageObjects::Singleton
4
-
5
- class << self
6
- private :new
7
-
8
- def initialize!
9
- instance.initialize!
10
- end
11
-
12
- def router=(router)
13
- instance.router = router
14
- end
15
-
16
- def inherited(site_class)
17
- super
18
-
19
- site_class.universe.send(:include, Universe)
20
- site_class.universe.page_objects_site_class = site_class
21
- end
22
-
23
- def universe
24
- parent
25
- end
26
-
27
- def from(from_mod)
28
- until from_mod == Object
29
- if from_mod < Universe
30
- return from_mod.page_objects_site_class.instance
31
- end
32
-
33
- from_mod = from_mod.parent
34
- end
35
-
36
- nil
37
- end
38
- end
39
-
40
- attr_writer :router
41
-
42
- def universe
43
- self.class.universe
44
- end
45
-
46
- def path_recognizes_url?(*args)
47
- self.router.path_recognizes_url?(*args)
48
- end
49
-
50
- def generate_path(*args)
51
- self.router.generate_path(*args)
52
- end
53
-
54
- def router
55
- @router ||= ApplicationRouter.new
56
- end
57
-
58
- def initialize!
59
- end
60
- end
61
- end
@@ -1,11 +0,0 @@
1
- module AePageObjects
2
- module Universe
3
- def self.included(target)
4
- target.class_eval do
5
- class << self
6
- attr_accessor :page_objects_site_class
7
- end
8
- end
9
- end
10
- end
11
- end
@@ -1,34 +0,0 @@
1
- # lifted from activesupport
2
-
3
- class Module
4
-
5
- # Returns the name of the module containing this one.
6
- #
7
- # M::N.parent_name # => "M"
8
- def parent_name
9
- unless defined? @parent_name
10
- @parent_name = name =~ /::[^:]+\Z/ ? $`.freeze : nil
11
- end
12
- @parent_name
13
- end
14
-
15
- # Returns the module which contains this one according to its name.
16
- #
17
- # module M
18
- # module N
19
- # end
20
- # end
21
- # X = M::N
22
- #
23
- # M::N.parent # => M
24
- # X.parent # => M
25
- #
26
- # The parent of top-level and anonymous modules is Object.
27
- #
28
- # M.parent # => Object
29
- # Module.new.parent # => Object
30
- #
31
- def parent
32
- parent_name ? AePageObjects::Inflector.constantize(parent_name) : Object
33
- end
34
- end
@@ -1,48 +0,0 @@
1
- module AePageObjects
2
- module Inflector
3
- extend self
4
-
5
- # Ruby 1.9 introduces an inherit argument for Module#const_get and
6
- # #const_defined? and changes their default behavior.
7
- if Module.method(:const_get).arity == 1
8
- # Tries to find a constant with the name specified in the argument string:
9
- #
10
- # "Module".constantize # => Module
11
- # "Test::Unit".constantize # => Test::Unit
12
- #
13
- # The name is assumed to be the one of a top-level constant, no matter whether
14
- # it starts with "::" or not. No lexical context is taken into account:
15
- #
16
- # C = 'outside'
17
- # module M
18
- # C = 'inside'
19
- # C # => 'inside'
20
- # "C".constantize # => 'outside', same as ::C
21
- # end
22
- #
23
- # NameError is raised when the name is not in CamelCase or the constant is
24
- # unknown.
25
- def constantize(camel_cased_word)
26
- names = camel_cased_word.split('::')
27
- names.shift if names.empty? || names.first.empty?
28
-
29
- constant = Object
30
- names.each do |name|
31
- constant = constant.const_defined?(name) ? constant.const_get(name) : constant.const_missing(name)
32
- end
33
- constant
34
- end
35
- else
36
- def constantize(camel_cased_word) #:nodoc:
37
- names = camel_cased_word.split('::')
38
- names.shift if names.empty? || names.first.empty?
39
-
40
- constant = Object
41
- names.each do |name|
42
- constant = constant.const_defined?(name, false) ? constant.const_get(name) : constant.const_missing(name)
43
- end
44
- constant
45
- end
46
- end
47
- end
48
- end
@@ -1,22 +0,0 @@
1
- module AePageObjects
2
- module Singleton
3
-
4
- def instance
5
- @instance ||= new
6
- end
7
-
8
- def respond_to?(*args)
9
- super || instance.respond_to?(*args)
10
- end
11
-
12
- def configure(&block)
13
- class_eval(&block)
14
- end
15
-
16
- protected
17
-
18
- def method_missing(*args, &block)
19
- instance.send(*args, &block)
20
- end
21
- end
22
- end