ae_page_objects 0.1.2 → 0.1.3.rl1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/ae_page_objects.rb +1 -7
- data/lib/ae_page_objects/core/application.rb +2 -38
- data/lib/ae_page_objects/element.rb +2 -2
- data/lib/ae_page_objects/version.rb +1 -1
- metadata +7 -8
- data/lib/ae_page_objects/core/configuration.rb +0 -15
- data/lib/ae_page_objects/core/constant_resolver.rb +0 -38
- data/lib/ae_page_objects/core/dependencies_hook.rb +0 -7
data/lib/ae_page_objects.rb
CHANGED
@@ -5,16 +5,12 @@ require 'active_support/core_ext/module/delegation'
|
|
5
5
|
require 'active_support/core_ext/hash/keys'
|
6
6
|
require 'active_support/core_ext/object/try'
|
7
7
|
require 'active_support/core_ext/class'
|
8
|
-
require 'active_support/
|
8
|
+
require 'active_support/core_ext/module/introspection'
|
9
9
|
|
10
10
|
require 'ae_page_objects/version'
|
11
11
|
|
12
12
|
module AePageObjects
|
13
13
|
autoload :Universe, 'ae_page_objects/core/universe'
|
14
|
-
autoload :ConstantResolver, 'ae_page_objects/core/constant_resolver'
|
15
|
-
autoload :DependenciesHook, 'ae_page_objects/core/dependencies_hook'
|
16
|
-
autoload :Installable, 'ae_page_objects/core/installable'
|
17
|
-
autoload :Configuration, 'ae_page_objects/core/configuration'
|
18
14
|
autoload :Singleton, 'ae_page_objects/core/singleton'
|
19
15
|
autoload :Application, 'ae_page_objects/core/application'
|
20
16
|
autoload :ApplicationRouter, 'ae_page_objects/core/application_router'
|
@@ -44,8 +40,6 @@ module AePageObjects
|
|
44
40
|
autoload :Checkbox, 'ae_page_objects/elements/checkbox'
|
45
41
|
end
|
46
42
|
|
47
|
-
ActiveSupport::Dependencies.extend AePageObjects::DependenciesHook
|
48
|
-
|
49
43
|
|
50
44
|
|
51
45
|
|
@@ -5,19 +5,11 @@ module AePageObjects
|
|
5
5
|
class << self
|
6
6
|
private :new
|
7
7
|
|
8
|
-
attr_accessor :called_from
|
9
|
-
|
10
8
|
delegate :initialize!, :to => :instance
|
11
|
-
delegate :config, :to => :instance
|
12
9
|
|
13
10
|
def inherited(application_class)
|
14
11
|
super
|
15
12
|
|
16
|
-
application_class.called_from = begin
|
17
|
-
call_stack = caller.map { |p| p.sub(/:\d+.*/, '') }
|
18
|
-
File.dirname(call_stack.detect { |p| p !~ %r[railties[\w.-]*/lib/rails|rack[\w.-]*/lib/rack] })
|
19
|
-
end
|
20
|
-
|
21
13
|
application_class.universe.send(:include, Universe)
|
22
14
|
application_class.universe.page_objects_application_class = application_class
|
23
15
|
end
|
@@ -41,42 +33,14 @@ module AePageObjects
|
|
41
33
|
|
42
34
|
delegate :universe, :to => 'self.class'
|
43
35
|
|
44
|
-
delegate :paths, :to => :config
|
45
|
-
delegate :router, :to => :config
|
46
|
-
|
47
36
|
delegate :path_recognizes_url?, :to => :router
|
48
37
|
delegate :generate_path, :to => :router
|
49
38
|
|
50
|
-
def
|
51
|
-
@
|
39
|
+
def router
|
40
|
+
@router ||= ApplicationRouter.new
|
52
41
|
end
|
53
42
|
|
54
43
|
def initialize!
|
55
|
-
ActiveSupport::Dependencies.autoload_paths.unshift(*paths)
|
56
|
-
eager_load!
|
57
|
-
end
|
58
|
-
|
59
|
-
def resolve_constant(from_mod, const_name)
|
60
|
-
resolver = ConstantResolver.new(self, from_mod, const_name)
|
61
|
-
|
62
|
-
resolved = nil
|
63
|
-
paths.each do |path|
|
64
|
-
break if resolved = resolver.load_constant_from_path(path)
|
65
|
-
end
|
66
|
-
resolved
|
67
|
-
end
|
68
|
-
|
69
|
-
private
|
70
|
-
|
71
|
-
def eager_load!
|
72
|
-
paths.each do |path|
|
73
|
-
matcher = /\A#{Regexp.escape(path)}\/(.*)\.rb\Z/
|
74
|
-
|
75
|
-
Dir.glob("#{path}/**/*.rb").sort.each do |file|
|
76
|
-
dependency_name = file.sub(matcher, '\1')
|
77
|
-
require_dependency dependency_name
|
78
|
-
end
|
79
|
-
end
|
80
44
|
end
|
81
45
|
end
|
82
46
|
end
|
@@ -20,7 +20,7 @@ module AePageObjects
|
|
20
20
|
raise ArgumentError, ":name or :locator is required" unless @name || @locator
|
21
21
|
|
22
22
|
@locator ||= default_locator
|
23
|
-
|
23
|
+
|
24
24
|
super(scoped_node)
|
25
25
|
end
|
26
26
|
|
@@ -38,7 +38,7 @@ module AePageObjects
|
|
38
38
|
|
39
39
|
def __full_name__
|
40
40
|
if parent.respond_to?(:__full_name__)
|
41
|
-
[ parent.__full_name__, __name__ ].compact.join
|
41
|
+
[ parent.__full_name__, __name__ ].compact.presence.try(:join, '_')
|
42
42
|
else
|
43
43
|
__name__
|
44
44
|
end
|
metadata
CHANGED
@@ -1,13 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ae_page_objects
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: -262409518
|
5
|
+
prerelease: 6
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
|
9
|
+
- 3
|
10
|
+
- rl
|
11
|
+
- 1
|
12
|
+
version: 0.1.3.rl1
|
11
13
|
platform: ruby
|
12
14
|
authors:
|
13
15
|
- Donnie Tognazzini
|
@@ -15,7 +17,7 @@ autorequire:
|
|
15
17
|
bindir: bin
|
16
18
|
cert_chain: []
|
17
19
|
|
18
|
-
date: 2013-06-
|
20
|
+
date: 2013-06-24 00:00:00 Z
|
19
21
|
dependencies:
|
20
22
|
- !ruby/object:Gem::Dependency
|
21
23
|
type: :runtime
|
@@ -126,9 +128,6 @@ files:
|
|
126
128
|
- lib/ae_page_objects/concerns/visitable.rb
|
127
129
|
- lib/ae_page_objects/core/application.rb
|
128
130
|
- lib/ae_page_objects/core/application_router.rb
|
129
|
-
- lib/ae_page_objects/core/configuration.rb
|
130
|
-
- lib/ae_page_objects/core/constant_resolver.rb
|
131
|
-
- lib/ae_page_objects/core/dependencies_hook.rb
|
132
131
|
- lib/ae_page_objects/core/dsl/collection.rb
|
133
132
|
- lib/ae_page_objects/core/dsl/element.rb
|
134
133
|
- lib/ae_page_objects/core/dsl/form_for.rb
|
@@ -1,15 +0,0 @@
|
|
1
|
-
module AePageObjects
|
2
|
-
class Configuration
|
3
|
-
attr_accessor :router, :paths
|
4
|
-
|
5
|
-
def initialize(application)
|
6
|
-
@application = application
|
7
|
-
@paths = [application.class.called_from]
|
8
|
-
end
|
9
|
-
|
10
|
-
def router
|
11
|
-
@router ||= ApplicationRouter.new
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
@@ -1,38 +0,0 @@
|
|
1
|
-
module AePageObjects
|
2
|
-
class ConstantResolver
|
3
|
-
def initialize(application, from_mod, const_name)
|
4
|
-
@application = application
|
5
|
-
@from_mod = from_mod
|
6
|
-
@const_name = const_name
|
7
|
-
|
8
|
-
@path_for_constant = path_for_constant
|
9
|
-
end
|
10
|
-
|
11
|
-
def load_constant_from_path(path)
|
12
|
-
file_path = File.join(path, "#{@path_for_constant}.rb").sub(/(\.rb)?$/, ".rb")
|
13
|
-
|
14
|
-
if File.file?(file_path) && ! ActiveSupport::Dependencies.loaded.include?(File.expand_path(file_path))
|
15
|
-
ActiveSupport::Dependencies.require_or_load file_path
|
16
|
-
|
17
|
-
unless ActiveSupport::Dependencies.local_const_defined?(@from_mod, @const_name)
|
18
|
-
qualified_name = ActiveSupport::Dependencies.qualified_name_for(@from_mod, @const_name)
|
19
|
-
raise LoadError, "Expected #{@file_path} to define #{qualified_name}"
|
20
|
-
end
|
21
|
-
|
22
|
-
@from_mod.const_get(@const_name)
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
private
|
27
|
-
|
28
|
-
def path_for_constant
|
29
|
-
name_within_universe = ""
|
30
|
-
if @application.universe != @from_mod
|
31
|
-
name_within_universe = @from_mod.name.split("#{@application.universe.name}::")[1]
|
32
|
-
end
|
33
|
-
|
34
|
-
name_within_universe += "::#{@const_name}"
|
35
|
-
name_within_universe.underscore
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|