ae_page_objects 0.1.2.dt2 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -33,7 +33,6 @@ module AePageObjects
33
33
  autoload :Visitable, 'ae_page_objects/concerns/visitable'
34
34
  end
35
35
 
36
- autoload :Window, 'ae_page_objects/window'
37
36
  autoload :Node, 'ae_page_objects/node'
38
37
  autoload :Document, 'ae_page_objects/document'
39
38
  autoload :Element, 'ae_page_objects/element'
@@ -7,7 +7,7 @@ module AePageObjects
7
7
  extend ActiveSupport::Concern
8
8
 
9
9
  def stale?
10
- !!@stale
10
+ @stale
11
11
  end
12
12
 
13
13
  def node
@@ -3,8 +3,9 @@ module AePageObjects
3
3
  include AePageObjects::Singleton
4
4
 
5
5
  class << self
6
+ private :new
7
+
6
8
  attr_accessor :called_from
7
- protected :called_from=
8
9
 
9
10
  delegate :initialize!, :to => :instance
10
11
  delegate :config, :to => :instance
@@ -2,12 +2,6 @@ module AePageObjects
2
2
  module Singleton
3
3
  extend ActiveSupport::Concern
4
4
 
5
- included do
6
- class << self
7
- private :new
8
- end
9
- end
10
-
11
5
  module ClassMethods
12
6
  def instance
13
7
  @instance ||= new
@@ -1,15 +1,6 @@
1
1
  module AePageObjects
2
2
  class Document < Node
3
3
  include Concerns::Visitable
4
-
5
- attr_reader :window
6
-
7
- def initialize
8
- super(Capybara.current_session)
9
-
10
- @window = Window.current
11
- @window.current_document = self
12
- end
13
4
 
14
5
  def document
15
6
  self
@@ -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.presence.try(:join, '_')
41
+ [ parent.__full_name__, __name__ ].compact.join('_')
42
42
  else
43
43
  __name__
44
44
  end
@@ -7,7 +7,7 @@ module AePageObjects
7
7
  include Dsl::Collection
8
8
  include Dsl::FormFor
9
9
 
10
- def initialize(capybara_node)
10
+ def initialize(capybara_node = Capybara.current_session)
11
11
  @node = capybara_node
12
12
  end
13
13
 
@@ -1,3 +1,3 @@
1
1
  module AePageObjects
2
- VERSION = '0.1.2.dt2'.freeze
2
+ VERSION = '0.1.2'.freeze
3
3
  end
metadata CHANGED
@@ -1,15 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ae_page_objects
3
3
  version: !ruby/object:Gem::Version
4
- hash: 115207405
5
- prerelease: 6
4
+ hash: 31
5
+ prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
9
  - 2
10
- - dt
11
- - 2
12
- version: 0.1.2.dt2
10
+ version: 0.1.2
13
11
  platform: ruby
14
12
  authors:
15
13
  - Donnie Tognazzini
@@ -147,7 +145,6 @@ files:
147
145
  - lib/ae_page_objects/elements/select.rb
148
146
  - lib/ae_page_objects/node.rb
149
147
  - lib/ae_page_objects/version.rb
150
- - lib/ae_page_objects/window.rb
151
148
  homepage: http://github.com/appfolio/ae_page_objects
152
149
  licenses:
153
150
  - MIT
@@ -1,51 +0,0 @@
1
- module AePageObjects
2
- class Window
3
- class << self
4
- def all
5
- @all ||= {}
6
- end
7
-
8
- def current
9
- current_handle = Capybara.current_session.driver.browser.window_handle
10
-
11
- window = all.keys.find do |window|
12
- window.handle == current_handle
13
- end
14
-
15
- unless window
16
- window = new(current_handle)
17
- all[window] = window
18
- end
19
-
20
- window
21
- end
22
- end
23
-
24
- attr_reader :current_document, :handle
25
-
26
- def initialize(handle)
27
- @handle = handle
28
- @current_document = nil
29
-
30
- self.class.all[self] = self
31
- end
32
-
33
- def current_document=(document)
34
- @current_document.send(:stale!) if @current_document
35
- @current_document = document
36
- end
37
-
38
- def switch_to
39
- Capybara.current_session.driver.browser.switch_to.window(handle)
40
- current_document
41
- end
42
-
43
- def close
44
- self.current_document = nil
45
-
46
- Capybara.current_session.execute_script("window.close();")
47
-
48
- self.class.all.delete(self)
49
- end
50
- end
51
- end