capybara-feature_helpers 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +9 -0
- data/README.md +2 -0
- data/capybara-feature_helpers.gemspec +5 -2
- data/lib/capybara/feature_helpers.rb +1 -0
- data/lib/capybara/feature_helpers/should_see_element.rb +13 -0
- data/spec/features/should_see_element_spec.rb +56 -0
- data/spec/features/should_see_text_spec.rb +24 -18
- data/spec/spec_helper.rb +4 -0
- data/spec/support/drivers.rb +5 -0
- data/spec/support/test_app.rb +2 -1
- metadata +52 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dbe23ee13750a6d126fb8741d9eb18589a08b327
|
4
|
+
data.tar.gz: 3e104bb9c9d36916f712dd5662a8b29a94252777
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2dd077019bfd966b51e7f33a675e354d7eb4751f0c9ce15e738da48963c69d0934f64fb28d572985bd7b4d970f862d30e00a2fab1951ca3980dac6ebde58c7a1
|
7
|
+
data.tar.gz: 6c4df6294ef3183594faf821ade0ce7705d9be33a3b0dc0c709c1c2e4e3def6a92a41b58eb980f2279bc8f2334e08fd0b9224adac6cb2e276f55e54885596b6e
|
data/.travis.yml
ADDED
data/README.md
CHANGED
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = "capybara-feature_helpers"
|
7
|
-
spec.version = "0.0.
|
7
|
+
spec.version = "0.0.2"
|
8
8
|
spec.authors = ["Andriy Yanko"]
|
9
9
|
spec.email = ["andriy.yanko@railsware.com"]
|
10
10
|
spec.summary = %q{Railsware capybara feature helpers}
|
@@ -16,8 +16,11 @@ Gem::Specification.new do |spec|
|
|
16
16
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
17
17
|
spec.require_paths = ["lib"]
|
18
18
|
|
19
|
-
spec.add_development_dependency "bundler", "~> 1.
|
19
|
+
spec.add_development_dependency "bundler", "~> 1.6"
|
20
20
|
spec.add_development_dependency "rake", "~> 10.0"
|
21
21
|
spec.add_development_dependency "rspec", "~> 3.0.0"
|
22
22
|
spec.add_development_dependency "capybara", "~> 2.4.0"
|
23
|
+
spec.add_development_dependency "selenium-webdriver", "~> 2.43.0"
|
24
|
+
spec.add_development_dependency "capybara-webkit", "~> 1.3.0"
|
25
|
+
spec.add_development_dependency "poltergeist", "~> 1.5.0"
|
23
26
|
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module Capybara
|
2
|
+
module FeatureHelpers
|
3
|
+
|
4
|
+
def should_see_element(selector, options = {})
|
5
|
+
expect(page).to have_selector(selector, options)
|
6
|
+
end
|
7
|
+
|
8
|
+
def should_not_see_element(selector, options = {})
|
9
|
+
expect(page).not_to have_selector(selector, options.merge(visible: true))
|
10
|
+
end
|
11
|
+
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'should_see_element', type: :feature do
|
4
|
+
|
5
|
+
before(:all) do
|
6
|
+
TestApp.style = <<-STYLE
|
7
|
+
.wrapper1 { display: block; }
|
8
|
+
.wrapper2 { display: none; }
|
9
|
+
STYLE
|
10
|
+
|
11
|
+
TestApp.body = <<-BODY
|
12
|
+
<h1 class="title">Hello World</h1>
|
13
|
+
|
14
|
+
<div class="container">
|
15
|
+
<div>Content</div>
|
16
|
+
</div>
|
17
|
+
|
18
|
+
<div class="wrapper1">
|
19
|
+
<div>data1</div>
|
20
|
+
</div>
|
21
|
+
|
22
|
+
<div class="wrapper2">
|
23
|
+
<div>data2</div>
|
24
|
+
</div>
|
25
|
+
BODY
|
26
|
+
end
|
27
|
+
|
28
|
+
Drivers::TEXT.each do |driver|
|
29
|
+
context "#{driver}", driver: driver do
|
30
|
+
it 'should see' do
|
31
|
+
should_see_element '.container'
|
32
|
+
end
|
33
|
+
|
34
|
+
it 'should not see' do
|
35
|
+
should_not_see_element '.container2'
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
Drivers::JS.each do |driver|
|
41
|
+
context "#{driver}", driver: driver do
|
42
|
+
it 'should see element when display is block' do
|
43
|
+
should_see_element '.wrapper1'
|
44
|
+
end
|
45
|
+
|
46
|
+
it 'should not see element when display is none' do
|
47
|
+
should_not_see_element '.wrapper2'
|
48
|
+
end
|
49
|
+
|
50
|
+
it 'should see element when display is none and visible false given' do
|
51
|
+
should_see_element '.wrapper2', visible: false
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
@@ -2,28 +2,34 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe 'should_see_text', type: :feature do
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
<div>
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
it 'should see' do
|
14
|
-
should_see_text 'Hello World'
|
5
|
+
before(:all) do
|
6
|
+
TestApp.body = <<-BODY
|
7
|
+
<h1 class="title">Hello World</h1>
|
8
|
+
|
9
|
+
<div class="container">
|
10
|
+
<div>Content</div>
|
11
|
+
</div>
|
12
|
+
BODY
|
15
13
|
end
|
16
14
|
|
17
|
-
|
18
|
-
|
19
|
-
|
15
|
+
Drivers::ALL.each do |driver|
|
16
|
+
context driver, driver: driver do
|
17
|
+
it 'should see' do
|
18
|
+
should_see_text 'Hello World'
|
19
|
+
end
|
20
20
|
|
21
|
-
|
22
|
-
|
23
|
-
|
21
|
+
it 'should not see' do
|
22
|
+
should_not_see_text 'Goodbye World'
|
23
|
+
end
|
24
|
+
|
25
|
+
it 'should see with css selector' do
|
26
|
+
should_see_text 'Hello World', '.title'
|
27
|
+
end
|
24
28
|
|
25
|
-
|
26
|
-
|
29
|
+
it 'should not see with css selector' do
|
30
|
+
should_not_see_text 'Goodbye World', '.container'
|
31
|
+
end
|
32
|
+
end
|
27
33
|
end
|
28
34
|
|
29
35
|
end
|
data/spec/spec_helper.rb
CHANGED
data/spec/support/test_app.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
class TestApp
|
2
2
|
class << self
|
3
|
+
attr_accessor :style
|
3
4
|
attr_accessor :body
|
4
5
|
|
5
6
|
def call(env)
|
@@ -10,7 +11,7 @@ class TestApp
|
|
10
11
|
|
11
12
|
def build_body
|
12
13
|
[
|
13
|
-
"<html><body>#{body}</body></html>"
|
14
|
+
"<html><style>#{style}</style><body>#{body}</body></html>"
|
14
15
|
]
|
15
16
|
end
|
16
17
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capybara-feature_helpers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andriy Yanko
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-10-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '1.
|
19
|
+
version: '1.6'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '1.
|
26
|
+
version: '1.6'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -66,6 +66,48 @@ dependencies:
|
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: 2.4.0
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: selenium-webdriver
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 2.43.0
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 2.43.0
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: capybara-webkit
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 1.3.0
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 1.3.0
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: poltergeist
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: 1.5.0
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: 1.5.0
|
69
111
|
description:
|
70
112
|
email:
|
71
113
|
- andriy.yanko@railsware.com
|
@@ -74,6 +116,7 @@ extensions: []
|
|
74
116
|
extra_rdoc_files: []
|
75
117
|
files:
|
76
118
|
- ".gitignore"
|
119
|
+
- ".travis.yml"
|
77
120
|
- Gemfile
|
78
121
|
- LICENSE.txt
|
79
122
|
- README.md
|
@@ -81,10 +124,13 @@ files:
|
|
81
124
|
- capybara-feature_helpers.gemspec
|
82
125
|
- lib/capybara/feature_helpers.rb
|
83
126
|
- lib/capybara/feature_helpers/should_see.rb
|
127
|
+
- lib/capybara/feature_helpers/should_see_element.rb
|
84
128
|
- lib/capybara/feature_helpers/should_see_text.rb
|
85
129
|
- lib/capybara/feature_helpers/within_maybe.rb
|
130
|
+
- spec/features/should_see_element_spec.rb
|
86
131
|
- spec/features/should_see_text_spec.rb
|
87
132
|
- spec/spec_helper.rb
|
133
|
+
- spec/support/drivers.rb
|
88
134
|
- spec/support/test_app.rb
|
89
135
|
homepage: https://github.com/railsware/capybara-feature_helpers
|
90
136
|
licenses:
|
@@ -111,6 +157,8 @@ signing_key:
|
|
111
157
|
specification_version: 4
|
112
158
|
summary: Railsware capybara feature helpers
|
113
159
|
test_files:
|
160
|
+
- spec/features/should_see_element_spec.rb
|
114
161
|
- spec/features/should_see_text_spec.rb
|
115
162
|
- spec/spec_helper.rb
|
163
|
+
- spec/support/drivers.rb
|
116
164
|
- spec/support/test_app.rb
|