page_right 0.5.2 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +19 -19
- data/lib/page_right/css_helper.rb +2 -2
- data/lib/page_right/image_helper.rb +1 -1
- data/lib/page_right/text_helper.rb +2 -2
- data/lib/page_right/version.rb +1 -1
- metadata +2 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fa2491fdecb1c9f9620067104d5ac3868f886fb9
|
4
|
+
data.tar.gz: 1c11bf72faae64b1bf08951c1b02b42637a48790
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8d81e2672ec0ea6da909ab306df8c0a002d04c22a23c805e7d34859e5cc4d030321cf8ffe81971bd8b1a195eccf32d3e4d21b7e997465cc4e5bfda4cce6e1d29
|
7
|
+
data.tar.gz: 9cb068a28987f5d8efb69b0caae0fa50332878ca27fbf18b4b80c26cc34fec2584aa2952ef6347f325d39ecdbf4f6dfc9ff00191c0cd53e23fa45a2b5fce09b2
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
## PageRight Gem - Checks the content of your rendered web pages. `Currently under development !!`
|
2
2
|
|
3
|
-
Version 0.
|
3
|
+
Version 0.6.0 23rd January 2015
|
4
4
|
|
5
5
|
A very simple gem that contains a few helper/wrapper methods utilising Capybara to aid testing the contents of a rendered web page when writing integration tests.
|
6
6
|
|
@@ -18,97 +18,97 @@ gem 'page_right'
|
|
18
18
|
|
19
19
|
### Method Descriptions:
|
20
20
|
|
21
|
-
####
|
21
|
+
#### is_text_in_page?(content, flag=true)
|
22
22
|
|
23
23
|
This method will search the whole page for the `content` provided and check that it is in the page. If `flag=false` is set, then the method will check that `content` is not on the page.
|
24
24
|
|
25
25
|
Examples:
|
26
26
|
|
27
27
|
```ruby
|
28
|
-
|
28
|
+
is_text_in_page?('This text')
|
29
29
|
```
|
30
30
|
|
31
31
|
Checks `This text` is in the page.
|
32
32
|
|
33
33
|
```ruby
|
34
|
-
|
34
|
+
is_text_in_page?('Your text here', false)
|
35
35
|
```
|
36
36
|
|
37
|
-
Check `
|
37
|
+
Check `Your text here` is NOT in the page.
|
38
38
|
|
39
|
-
####
|
39
|
+
#### is_text_in_section?(section, content, flag=true)
|
40
40
|
|
41
41
|
This method will check that the `content` is displayed within a particular css selector `section` (div, or other named html element). If `flag=false` is set, then the method will check that the `content` is not within the css selector `section`.
|
42
42
|
|
43
43
|
Examples:
|
44
44
|
|
45
45
|
```ruby
|
46
|
-
|
46
|
+
is_text_in_section?('.named-class' 'This text')
|
47
47
|
```
|
48
48
|
|
49
49
|
Check `This text` is within a class called `named-class`.
|
50
50
|
|
51
51
|
```ruby
|
52
|
-
|
52
|
+
is_text_in_section?('#named-id', 'Your text here', false)
|
53
53
|
```
|
54
54
|
|
55
|
-
Check `
|
55
|
+
Check `Your text here` is not within any id called `named-id`
|
56
56
|
|
57
|
-
####
|
57
|
+
#### is_css_in_page?(css, flag=true))
|
58
58
|
|
59
59
|
This method will check that the class or id supplied is displayed somewhere on the page. If `flag=false` is set, then the method will check that the class or id supplied is not displayed anywhere on the page.
|
60
60
|
|
61
61
|
Examples:
|
62
62
|
|
63
63
|
```ruby
|
64
|
-
|
64
|
+
is_css_in_page?('#my-css')
|
65
65
|
```
|
66
66
|
|
67
67
|
Check that a css selector with id `my-css` is in the page.
|
68
68
|
|
69
69
|
```ruby
|
70
|
-
|
70
|
+
is_css_in_page?('.my-css', false)
|
71
71
|
```
|
72
72
|
Check that an css selector with a class `my-css`is NOT in the page.
|
73
73
|
|
74
|
-
####
|
74
|
+
#### is_css_in_section?(css1, css2, flag=true)
|
75
75
|
|
76
76
|
This method will check that the `css2` selector is nested within a another `css1` selector. If `flag=false` is set, then the method will check that the `css2` selector is not within the `css1` selector. This method is good if you want to check for nested css selectors as if often the case.
|
77
77
|
|
78
78
|
Examples:
|
79
79
|
|
80
80
|
```ruby
|
81
|
-
|
81
|
+
is_css_in_section?('.my-css1', '#my-css2')
|
82
82
|
```
|
83
83
|
|
84
84
|
Check the id `my-css2`is nested in class `my-css1`.
|
85
85
|
|
86
86
|
```ruby
|
87
|
-
|
87
|
+
is_css_in_section?('#my-css1', '.my-css2', false)
|
88
88
|
```
|
89
89
|
|
90
90
|
Check the class `my-css2` is NOT nested within the id `my-css1`.
|
91
91
|
|
92
|
-
###
|
92
|
+
### is_image_in_section?(section, image, count, flag=true)
|
93
93
|
|
94
94
|
This method will check that the number of `image(s)` in the `section` is equal to `count`. If `flag=false` is set, then the method will check the number of `image(s)` in the `section` is not equal to `count`. If you just want to check that a particular `image` is in a particluar css selector `section` then pass in value of 1 for the `count` argument.
|
95
95
|
|
96
96
|
Examples:
|
97
97
|
|
98
98
|
```ruby
|
99
|
-
|
99
|
+
is_image_in_section?('.my-css', 'my-image.jpg', 1)
|
100
100
|
```
|
101
101
|
|
102
102
|
Check there is exactly one `my-image.jpg` image within a class `my-css`.
|
103
103
|
|
104
104
|
```ruby
|
105
|
-
|
105
|
+
is_image_in_section?('#my-css', 'my-image.jpg', 1, false)
|
106
106
|
```
|
107
107
|
|
108
108
|
Check there is NOT a `my-image.jpg` image within an id `my-css`.
|
109
109
|
|
110
110
|
```ruby
|
111
|
-
|
111
|
+
is_image_in_section?('#my-css', 'my-image.jpg', 3, false)
|
112
112
|
```
|
113
113
|
|
114
114
|
Check there are 3 `my-image.jpg` image's within an id `my-css`.
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module PageRight
|
2
2
|
module CssHelper
|
3
3
|
# Check that a css element is on the page, set flag to check that it isn't
|
4
|
-
def
|
4
|
+
def is_css_in_page?(css, flag=true)
|
5
5
|
if flag
|
6
6
|
assert page.has_css?("#{css}"), "Error: #{css} not found on page !"
|
7
7
|
else
|
@@ -10,7 +10,7 @@ module PageRight
|
|
10
10
|
end
|
11
11
|
|
12
12
|
# Check that a css element is nested within another css element, set flag to check that it isn't
|
13
|
-
def
|
13
|
+
def is_css_in_section?(css1, css2, flag=true)
|
14
14
|
within("#{css1}") do
|
15
15
|
if flag
|
16
16
|
assert page.has_css?("#{css2}"), "Error: #{css2} not found in #{css1} !"
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module PageRight
|
2
2
|
module ImageHelper
|
3
3
|
# Check that 'count' number of 'image's is in a 'section' of css, set flag to check that it/they isn't/arn't
|
4
|
-
def
|
4
|
+
def is_image_in_section?(section, image, count, flag=true)
|
5
5
|
if flag
|
6
6
|
assert page.has_selector?(:css,"#{section} img[src$='/assets/#{image}']", count: count), "Error: #{count} #{image}(s) not found in #{section} !"
|
7
7
|
else
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module PageRight
|
2
2
|
module TextHelper
|
3
3
|
# Check that the text 'content' is on the page, set flag to check that it isn't
|
4
|
-
def
|
4
|
+
def is_text_in_page?(content, flag=true)
|
5
5
|
if flag
|
6
6
|
assert page.has_content?("#{content}"), "Error: #{content} not found page !"
|
7
7
|
else
|
@@ -10,7 +10,7 @@ module PageRight
|
|
10
10
|
end
|
11
11
|
|
12
12
|
# Check that the text 'content' is within a particular css section, set flag to check that it isn't
|
13
|
-
def
|
13
|
+
def is_text_in_section?(section, content, flag=true)
|
14
14
|
within("#{section}") do
|
15
15
|
if flag
|
16
16
|
assert page.has_content?("#{content}"), "Error: #{content} not found in #{section} !"
|
data/lib/page_right/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: page_right
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dave Collier
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-01-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: capybara
|
@@ -136,4 +136,3 @@ signing_key:
|
|
136
136
|
specification_version: 4
|
137
137
|
summary: A simple gem that helps you with testing the contents of a rendered web page
|
138
138
|
test_files: []
|
139
|
-
has_rdoc:
|