pageify 0.3.2 → 0.3.3
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.
- checksums.yaml +4 -4
- data/README.md +15 -1
- data/lib/pageify.rb +6 -2
- data/spec/pages/sample_page.yml +1 -1
- data/spec/sample_spec.rb +5 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c36cbba1f6fec1b60f291876b782a9a586af4d8a
|
4
|
+
data.tar.gz: ae12646597c131cd992fd8ee911781e6e51814f5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ac9b4bd0fb44a2f7d0ead4e3ee581708e4cac47c23135ab997d68f3fb80b8dde131419eeafe4d4f3c39691372bdc714178f29289049b331f0f0dfeb4e7ca0ce3
|
7
|
+
data.tar.gz: 12abdad577e12f7711fdcccbfde4df1860e77a8087fcc638db01e21c7329f890321c2958d0d479aefc00e40bf5a4327c5084f387801637a7ba4fa110947c9997
|
data/README.md
CHANGED
@@ -86,9 +86,23 @@ fill_in home_page.login.user_name.p, :with=> "hi"
|
|
86
86
|
click_on home_page.login.submit.p
|
87
87
|
```
|
88
88
|
|
89
|
-
|
89
|
+
##Splitting Long Page Definitions
|
90
|
+
Sometimes, your page definition may get quite long. In other cases, you may also have the exact same HTML component (say a product listing) that can be repeated in multiple places (e.g. list, search, etc). In these cases, you can use sections to split your page into multiple files that can be reused.
|
90
91
|
|
92
|
+
The syntax for this is as follows:
|
91
93
|
|
94
|
+
```yaml
|
95
|
+
# sections/_product.yml
|
96
|
+
product: '.product'
|
97
|
+
name: '.name'
|
98
|
+
price: '.price'
|
92
99
|
|
100
|
+
# product_list.yml
|
101
|
+
product_list: '.product_list'
|
102
|
+
:section/product
|
93
103
|
|
104
|
+
# search_results.yml
|
105
|
+
search_results: '.search_results'
|
106
|
+
:section/product
|
94
107
|
|
108
|
+
```
|
data/lib/pageify.rb
CHANGED
@@ -12,8 +12,12 @@ module Pageify
|
|
12
12
|
|
13
13
|
def createElement(raw_row)
|
14
14
|
element = PageObject.create(raw_row)
|
15
|
-
define_method(element.name) do
|
16
|
-
|
15
|
+
define_method(element.name) do |*arguments|
|
16
|
+
unless arguments.eql? []
|
17
|
+
$selector = (element.selector % arguments).strip_quotes.strip
|
18
|
+
else
|
19
|
+
$selector = (element.selector % '').strip_quotes.strip
|
20
|
+
end
|
17
21
|
element
|
18
22
|
end
|
19
23
|
element
|
data/spec/pages/sample_page.yml
CHANGED
data/spec/sample_spec.rb
CHANGED
@@ -12,7 +12,11 @@ describe Pageify do
|
|
12
12
|
@page.root.p.should == ".root"
|
13
13
|
end
|
14
14
|
|
15
|
-
it "should
|
15
|
+
it "should heck for root params" do
|
16
|
+
@page.root("#id").simple.p.should == ".root #id .simple"
|
17
|
+
end
|
18
|
+
|
19
|
+
it "should have simple page" do
|
16
20
|
@page.root.simple.p.should == ".root .simple"
|
17
21
|
end
|
18
22
|
|