page-right 0.0.2 → 0.1
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/lib/page-right.rb +37 -6
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6a7bd3c0e7622e59a4a69ae075636202e91df2f1
|
4
|
+
data.tar.gz: f3502df20a4e5f69d5420125419919953bd9be14
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 048df55cb987e1a605052edc692558a5961341246c9c8c7b78df46a7fd050207d3feef05b266d8b9e92aaa42377391d760451534484a4cd94d67fde2e2174228
|
7
|
+
data.tar.gz: 4bd54a9bf42e2e5359c54c270ebe9c0a8e80b3516567a61cae139d8fb5f5d93da2e40a7d6fe4f01e969c0be8060d7b32be17a65e8bfd2b42a8dc7012af408278
|
data/lib/page-right.rb
CHANGED
@@ -1,21 +1,52 @@
|
|
1
1
|
class ActiveSupport::TestCase
|
2
2
|
|
3
|
-
|
3
|
+
# Check that the text 'content' is on the page, set flag to check that it isn't
|
4
|
+
def text_in_page(content, flag=true)
|
4
5
|
if flag
|
5
|
-
assert page.has_content?("#{content}"), "#{content}
|
6
|
+
assert page.has_content?("#{content}"), "Error: #{content} not found page !"
|
6
7
|
else
|
7
|
-
assert !page.has_content?("#{content}"), "#{content}
|
8
|
+
assert !page.has_content?("#{content}"), "Error: #{content} found in page !"
|
8
9
|
end
|
9
10
|
end
|
10
11
|
|
11
|
-
|
12
|
+
# Check that the text 'content' is within a particular css section, set flag to check that it isn't
|
13
|
+
def text_in_section(section, content, flag=true)
|
12
14
|
within("#{section}") do
|
13
15
|
if flag
|
14
|
-
assert page.has_content?("#{content}"), "#{content}
|
16
|
+
assert page.has_content?("#{content}"), "Error: #{content} not found in #{section} !"
|
15
17
|
else
|
16
|
-
assert !page.has_content?("#{content}"), "#{content}
|
18
|
+
assert !page.has_content?("#{content}"), "Error: #{content} found in #{section} !"
|
17
19
|
end
|
18
20
|
end
|
19
21
|
end
|
20
22
|
|
23
|
+
# Check that a css element is on the page, set flag to check that it isn't
|
24
|
+
def css_in_page(css, flag=true)
|
25
|
+
if flag
|
26
|
+
assert page.has_css?("#{css}"), "Error: #{css} not found on page !"
|
27
|
+
else
|
28
|
+
assert !page.has_css?("#{css}"), "Error: #{css} found on page !"
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
# Check that a css element is nested within another css element, set flag to check that it isn't
|
33
|
+
def css_in_section(css1, css2, flag=true)
|
34
|
+
within("#{css1}") do
|
35
|
+
if flag
|
36
|
+
assert page.has_css?("#{css2}"), "Error: #{css2} not found in #{css1} !"
|
37
|
+
else
|
38
|
+
assert !page.has_css?("#{css2}"), "Error: #{css2} found in #{css1} !"
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
# Check that 'count' number of 'image's is in a 'section' of css, set flag to check that it/they isn't/arn't
|
44
|
+
def image_in_section(section, image, count, flag=true)
|
45
|
+
if flag
|
46
|
+
assert page.has_selector?(:css,"#{section} img[src$='/assets/#{image}']", count: count), "Error: #{count} #{image}(s) not found in #{section} !"
|
47
|
+
else
|
48
|
+
assert !page.has_selector?(:css,"#{section} img[src$='/assets/#{image}']", count: count), "Error: #{count} #{image}(s) found in #{section} !"
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
21
52
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: page-right
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: '0.1'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dave Collier
|
@@ -10,8 +10,8 @@ bindir: bin
|
|
10
10
|
cert_chain: []
|
11
11
|
date: 2014-08-17 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
|
-
description: A simple gem that
|
14
|
-
|
13
|
+
description: A simple gem that provides wrapper/helper methods ontop of capybara to
|
14
|
+
test the contents of your page. Currently in development!
|
15
15
|
email: lardelbow@gmail.com
|
16
16
|
executables: []
|
17
17
|
extensions: []
|
@@ -41,5 +41,5 @@ rubyforge_project:
|
|
41
41
|
rubygems_version: 2.2.2
|
42
42
|
signing_key:
|
43
43
|
specification_version: 4
|
44
|
-
summary: A simple gem that helps you with testing
|
44
|
+
summary: A simple gem that helps you with testing the contents of a rendered web page
|
45
45
|
test_files: []
|