pageify 0.0.3 → 0.1.0

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: 3d638ca8dab5755b931a46002ce2535c6ae96b9c
4
- data.tar.gz: cca0fbf4d6f4c0cfc3583f53a282e8dece0f0981
3
+ metadata.gz: 04c826e3f638dcf675f720de0ca8ec814d1a51a3
4
+ data.tar.gz: e749db72bae8985eb21026aa29768645f0c093e0
5
5
  SHA512:
6
- metadata.gz: 42409d30027c54e1d54a9e654199ed192e98c191e8242349dd7202e9f4d3d008d91fa81dca15339ae8ff751236c8d962c6453bb740ebdd7e17339969411ac745
7
- data.tar.gz: 5ee0596077ddc29b4274316ce693aed0f0466a4f4fb13128a19bc9f8968cd9909e547c126fbd9c4ed67e1078e62df3172205da76eaec207b90814e9f3086ff90
6
+ metadata.gz: 3772d459e9de5dc24c9c7c5693aceae7e5d53347b3609ffae2ac7282ce0e24f30d4ec78253a2383ef8bc5755d8b604622356b6816456866946b3da5a8387ff9d
7
+ data.tar.gz: e18d086537adb9d955f95b46373a5d9eac76800bb3f0ee7bd639967726fbc42b65ff6af7a94d68fcb3dda22bb831b191924e868ca47c67e4cbdc817178b89302
data/lib/pageify.rb CHANGED
@@ -1,7 +1,5 @@
1
1
  module Pageify
2
- require "pageify/page"
3
2
  require "pageify/string"
4
- require "pageify/page"
5
3
  require "pageify/element"
6
4
 
7
5
  def pageify(base_dir)
@@ -14,19 +12,20 @@ module Pageify
14
12
  end
15
13
  end
16
14
 
17
- def createPage(name)
18
- page = Page.new(name)
19
- define_method(name) do
15
+ def createElement(name,selector)
16
+ element = Element.new(name,selector,nil)
17
+ define_method("_#{name}") do
20
18
  $selector = ""
21
- page
19
+ element
22
20
  end
23
- page
21
+ element
24
22
  end
25
23
 
26
24
  def to_page_objects(file)
27
25
  rawArray = IO.read(file).split("\n").map{|x| x.rstrip}
28
26
  rawArray -= [""]
29
- page = createPage(rawArray.shift.name)
27
+ parentElement = rawArray.shift
28
+ page = createElement(parentElement.name,parentElement.selector)
30
29
  parent = [page]
31
30
  until rawArray.empty? do
32
31
  thisElement = rawArray.first
@@ -1,11 +1,23 @@
1
- require_relative "base_element"
1
+ class Element
2
+ attr_accessor :name,:parent,:selector
2
3
 
3
- class Element < BaseElement
4
- attr_accessor :parent
4
+ def createChild (name,selector)
5
+ child = Element.new(name,selector,self)
6
+ define_singleton_method(name) do |*arguments|
7
+ $selector += selector % arguments
8
+ child
9
+ end
10
+ return child
11
+ end
12
+
13
+ def p
14
+ $selector.gsub("\"","").strip
15
+ end
5
16
 
6
17
  def initialize (name,selector,parent)
7
18
  @name = name
8
19
  @selector = selector
9
20
  @parent = parent
10
21
  end
22
+
11
23
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pageify
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Deepak
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-25 00:00:00.000000000 Z
11
+ date: 2014-04-27 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Simplify page object definition for UI tests
14
14
  email: anandhadeepak@gmail.com
@@ -16,8 +16,6 @@ executables: []
16
16
  extensions: []
17
17
  extra_rdoc_files: []
18
18
  files:
19
- - lib/pageify/page.rb
20
- - lib/pageify/base_element.rb
21
19
  - lib/pageify/element.rb
22
20
  - lib/pageify/string.rb
23
21
  - lib/pageify.rb
@@ -44,5 +42,5 @@ rubyforge_project:
44
42
  rubygems_version: 2.0.3
45
43
  signing_key:
46
44
  specification_version: 4
47
- summary: Simplify page object definition for UI tests
45
+ summary: removed pages and ablity to add arguments
48
46
  test_files: []
@@ -1,17 +0,0 @@
1
- $selector
2
- class BaseElement
3
- attr_accessor :name,:parent
4
- def createChild (name,selector)
5
- child = Element.new(name,selector,self)
6
- define_singleton_method(name) do
7
- $selector += selector
8
- child
9
- end
10
- return child
11
- end
12
-
13
- def build
14
- $selector.gsub("\"","")
15
- end
16
- end
17
-
data/lib/pageify/page.rb DELETED
@@ -1,9 +0,0 @@
1
- require_relative "base_element"
2
-
3
- class Page < BaseElement
4
- def initialize(name)
5
- @name = name
6
- $selector = ""
7
- end
8
-
9
- end