pageify 0.2.1 → 0.3.1

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: 18eeae82100f700e3f08d519bc11a42ade282585
4
- data.tar.gz: 386caa08d3518b489493605ab2b26b7753ea5ebe
3
+ metadata.gz: 70014ada021ad89caf24800509b30d93d2b9eb15
4
+ data.tar.gz: c3ab2804c9063d421266144d3904412d7d21e00d
5
5
  SHA512:
6
- metadata.gz: ae23a44f394b8d37fb7f4f0aa63c5fd533acc5938fa356bd34c73a7ca8de0e19c94f045e413458870e70f325bb0cf22478dd73ec7e492018d77ce6e72be2ca53
7
- data.tar.gz: 5a7e3b701b86f9c6a09218d9f1a31ca8770d963fa6981d9b5544d2f08735ae1832be4e509a5cab576cc4973e28eb1801db31c1aeb9d0e59b43f3105b211ea229
6
+ metadata.gz: a84726b1143b1b46d440e9913213e497d6d44bcd98432dc15c9c869e629f297b67047701e62b3b306197615eaaee9fa8bd9c2cd70c86ce47bd0f92b1b524acd3
7
+ data.tar.gz: 30fc8a7ae4a2580c3ad28f8a4907ffd5a3d4750726b7cee18c1f3d3c05ee6c8f110cc06447f2d01039cdf93bb22bffcdad666f57acd54e4e9f28aca0a506edca
@@ -5,7 +5,7 @@ module Pageify
5
5
  def pageify(base_dir)
6
6
  base_dir.chomp! '/'
7
7
  all_pages = []
8
- Dir["#{base_dir}/**/*.yml"].each do |file|
8
+ (Dir["#{base_dir}/**/*.yml"]-Dir["#{base_dir}/**/_*.yml"]).each do |file|
9
9
  to_page_objects file
10
10
  end
11
11
  end
@@ -19,9 +19,32 @@ module Pageify
19
19
  element
20
20
  end
21
21
 
22
- def to_page_objects(file)
23
- rawArray = IO.read(file).split("\n").map{|x| x.rstrip}
22
+ def replace_sections (parent_array,file)
23
+ processed_parent = []
24
+ parent_array.each do |row|
25
+ if row.lstrip.start_with?":"
26
+ section_file = "#{File.dirname (file)}/#{row.split(':')[1]}.yml"
27
+ section_file = "#{File.dirname(section_file)}/_#{File.basename(section_file)}"
28
+ section_array = get_procesed(section_file)
29
+ section_array.each_with_index do |value,index|
30
+ section_array[index] = " " * row.lspace + value
31
+ end
32
+ processed_parent = processed_parent + section_array
33
+ else
34
+ processed_parent = processed_parent + [row]
35
+ end
36
+ end
37
+ processed_parent
38
+ end
39
+
40
+ def get_procesed (file)
41
+ rawArray= IO.read(file).split("\n").map{|x| x.rstrip}
24
42
  rawArray -= [""]
43
+ rawArray = replace_sections(rawArray,file)
44
+ end
45
+
46
+ def to_page_objects(file)
47
+ rawArray = get_procesed(file)
25
48
  parentElement = rawArray.shift
26
49
  page = createElement(parentElement)
27
50
  parent = [page]
@@ -9,3 +9,4 @@ root: ".root"
9
9
  nth: "&:nth-of-type(%d)"
10
10
  nth_variant: "&.nth_variant"
11
11
  nth_nested: ".nth_nested"
12
+ :section/details
@@ -0,0 +1,4 @@
1
+ details: ".first_section"
2
+ name: ".name[name=%s]"
3
+ :initial
4
+ letter: "#let"
@@ -0,0 +1 @@
1
+ initial: ".initial"
@@ -45,4 +45,12 @@ describe Pageify do
45
45
  it "& should add to previous selector" do
46
46
  @page.root.complex.nth(1).nth_variant.nth_nested.p.should == ".root .complex:nth-of-type(1).nth_variant .nth_nested"
47
47
  end
48
+
49
+ it "should access sections mentioned" do
50
+ @page.root.complex.nth(1).details.name("seera").initial.letter.p.should == ".root .complex:nth-of-type(1) .first_section .name[name=seera] .initial #let"
51
+ end
52
+
53
+ it "should not scan sections as page objects" do
54
+ end
55
+
48
56
  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.2.1
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Deepak
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-23 00:00:00.000000000 Z
11
+ date: 2014-06-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -38,6 +38,20 @@ dependencies:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: pry
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
41
55
  description: Simplify page object definition for UI tests
42
56
  email:
43
57
  executables: []
@@ -50,6 +64,8 @@ files:
50
64
  - lib/pageify/page_object.rb
51
65
  - lib/pageify/string.rb
52
66
  - spec/pages/sample_page.yml
67
+ - spec/pages/section/_details.yml
68
+ - spec/pages/section/_initial.yml
53
69
  - spec/sample_spec.rb
54
70
  - spec/spec_helper.rb
55
71
  homepage: https://github.com/paramadeep/pageify
@@ -78,5 +94,7 @@ specification_version: 4
78
94
  summary: Simplify page object definition for UI tests
79
95
  test_files:
80
96
  - spec/pages/sample_page.yml
97
+ - spec/pages/section/_details.yml
98
+ - spec/pages/section/_initial.yml
81
99
  - spec/spec_helper.rb
82
100
  - spec/sample_spec.rb