ae_page_objects 0.0.1.beta.5 → 0.0.1.beta.6.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -22,7 +22,6 @@ module AePageObjects
22
22
 
23
23
  module Dsl
24
24
  autoload :Element, 'ae_page_objects/core/dsl/element'
25
- autoload :NestedElement, 'ae_page_objects/core/dsl/nested_element'
26
25
  autoload :Collection, 'ae_page_objects/core/dsl/collection'
27
26
  autoload :FormFor, 'ae_page_objects/core/dsl/form_for'
28
27
  end
@@ -38,7 +37,6 @@ module AePageObjects
38
37
  autoload :Element, 'ae_page_objects/element'
39
38
  autoload :ElementProxy, 'ae_page_objects/element_proxy'
40
39
 
41
- autoload :HasOne, 'ae_page_objects/elements/has_one'
42
40
  autoload :Collection, 'ae_page_objects/elements/collection'
43
41
  autoload :Form, 'ae_page_objects/elements/form'
44
42
  autoload :Select, 'ae_page_objects/elements/select'
@@ -15,9 +15,9 @@ module AePageObjects
15
15
  end
16
16
  end
17
17
 
18
- def element(name, options = {})
19
- options = options.dup
20
- klass = field_klass(options)
18
+ def element(name, options = {}, &block)
19
+ options = options.dup
20
+ klass = field_klass(options, &block)
21
21
 
22
22
  self.element_attributes[name.to_sym] = klass
23
23
 
@@ -30,13 +30,13 @@ module AePageObjects
30
30
 
31
31
  private
32
32
 
33
- def field_klass(options)
34
- field_type = options.delete(:is)
35
-
36
- if field_type.is_a? Class
37
- field_type
33
+ def field_klass(options, &block)
34
+ klass = options.delete(:is) || ::AePageObjects::Element
35
+
36
+ if block_given?
37
+ klass.new_subclass(&block)
38
38
  else
39
- ::AePageObjects::Element
39
+ klass
40
40
  end
41
41
  end
42
42
  end
@@ -19,9 +19,9 @@ module AePageObjects
19
19
 
20
20
  element(form_name, options)
21
21
 
22
- klass.element_attributes.each do |node_name, node_klazz|
23
- delegate node_name, :to => form_name
24
- self.element_attributes[node_name] = node_klazz
22
+ klass.element_attributes.each do |element_name, element_klazz|
23
+ delegate element_name, :to => form_name
24
+ self.element_attributes[element_name] = element_klazz
25
25
  end
26
26
  end
27
27
  end
@@ -1,5 +1,5 @@
1
1
  module AePageObjects
2
- class Collection < HasOne
2
+ class Collection < Element
3
3
  class_attribute :item_class, :instance_writer => false
4
4
  self.item_class = Element
5
5
 
@@ -4,7 +4,6 @@ module AePageObjects
4
4
  extend ActiveSupport::Concern
5
5
 
6
6
  include Dsl::Element
7
- include Dsl::NestedElement
8
7
  include Dsl::Collection
9
8
  include Dsl::FormFor
10
9
 
@@ -1,3 +1,3 @@
1
1
  module AePageObjects
2
- VERSION = '0.0.1.beta.5'.freeze
2
+ VERSION = '0.0.1.beta.6.0.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,15 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ae_page_objects
3
3
  version: !ruby/object:Gem::Version
4
- hash: -1687695904
4
+ hash: -9661606936
5
5
  prerelease: 6
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
9
  - 1
10
10
  - beta
11
- - 5
12
- version: 0.0.1.beta.5
11
+ - 6
12
+ - 0
13
+ - 0
14
+ version: 0.0.1.beta.6.0.0
13
15
  platform: ruby
14
16
  authors:
15
17
  - Donnie Tognazzini
@@ -17,7 +19,7 @@ autorequire:
17
19
  bindir: bin
18
20
  cert_chain: []
19
21
 
20
- date: 2013-01-04 00:00:00 Z
22
+ date: 2013-01-08 00:00:00 Z
21
23
  dependencies:
22
24
  - !ruby/object:Gem::Dependency
23
25
  name: activesupport
@@ -135,7 +137,6 @@ files:
135
137
  - lib/ae_page_objects/core/dsl/collection.rb
136
138
  - lib/ae_page_objects/core/dsl/element.rb
137
139
  - lib/ae_page_objects/core/dsl/form_for.rb
138
- - lib/ae_page_objects/core/dsl/nested_element.rb
139
140
  - lib/ae_page_objects/core/internal_helpers.rb
140
141
  - lib/ae_page_objects/core/rake_router.rb
141
142
  - lib/ae_page_objects/document.rb
@@ -144,7 +145,6 @@ files:
144
145
  - lib/ae_page_objects/elements/checkbox.rb
145
146
  - lib/ae_page_objects/elements/collection.rb
146
147
  - lib/ae_page_objects/elements/form.rb
147
- - lib/ae_page_objects/elements/has_one.rb
148
148
  - lib/ae_page_objects/elements/select.rb
149
149
  - lib/ae_page_objects/node.rb
150
150
  - lib/ae_page_objects/version.rb
@@ -1,24 +0,0 @@
1
- module AePageObjects
2
- module Dsl
3
- module NestedElement
4
- extend ActiveSupport::Concern
5
- include Dsl::Element
6
-
7
- module ClassMethods
8
-
9
- def element(name, options = {}, &block)
10
- raise ArgumentError, ":is option and block not supported together" if options[:is].present? && block_given?
11
-
12
- if block_given?
13
- klass = ::AePageObjects::HasOne.new_subclass(&block)
14
-
15
- options = options.dup
16
- options[:is] = klass
17
- end
18
-
19
- super(name, options)
20
- end
21
- end
22
- end
23
- end
24
- end
@@ -1,11 +0,0 @@
1
- module AePageObjects
2
- class HasOne < Element
3
- def __full_name__
4
- if parent.respond_to?(:__full_name__)
5
- "#{parent.__full_name__}_#{__name__}_attributes"
6
- else
7
- "#{__name__}_attributes"
8
- end
9
- end
10
- end
11
- end