capybara-extensions 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
data/test/string.rb ADDED
@@ -0,0 +1,201 @@
1
+ TestString = <<-STRING
2
+ <html>
3
+ <head>
4
+ <meta name='title' content='CapybaraExtensions!' />
5
+ </head>
6
+ <h1>Posts by John</h1>
7
+ <table>
8
+ <thead>
9
+ <tr>
10
+ <th>Author</th>
11
+ <th>Title</th>
12
+ <th>Body</th>
13
+ <th colspan=3>Actions</th>
14
+ </tr>
15
+ </thead>
16
+ <tbody>
17
+ <tr class="post" id="post_3">
18
+ <td>John Doe</td>
19
+ <td>The third post title</td>
20
+ <td>Sed id tortor odio. Proin a adipiscing quam. Donec posuere condimentum dolor, mollis consectetur diam consectetur eu. Etiam ipsum augue, imperdiet ac porttitor tristique, hendrerit.</td>
21
+ <td><a href="/posts/3">Show</a></td>
22
+ <td><a href="/posts/3/edit">Edit</a></td>
23
+ <td><a data-confirm="Are you sure?" data-method="delete" href="/posts/3" rel="nofollow">Destroy</a></td>
24
+ </tr>
25
+ </tbody>
26
+ </table>
27
+
28
+ <h1>Posts by Jane</h1>
29
+ <table>
30
+ <thead>
31
+ <tr>
32
+ <th>Author</th>
33
+ <th>Title</th>
34
+ <th>Body</th>
35
+ <th colspan=3>Actions</th>
36
+ </tr>
37
+ </thead>
38
+ <tbody>
39
+ <tr class="post" id="post_1">
40
+ <td>Jane Doe</td>
41
+ <td>The first post title</td>
42
+ <td>Suspendisse id purus quis augue consequat varius ut eget diam. Donec ut lacus vestibulum, porttitor nulla porta, convallis ligula. Nunc sodales venenatis sapien sit amet consequat.</td>
43
+ <td><a href="/posts/1">Show</a></td>
44
+ <td><a href="/posts/1/edit">Edit</a></td>
45
+ <td><a data-confirm="Are you sure?" data-method="delete" href="/posts/1" rel="nofollow">Destroy</a></td>
46
+ </tr>
47
+ <tr class="post" id="post_2">
48
+ <td>Jane Doe</td>
49
+ <td>The second post title</td>
50
+ <td>Donec iaculis ultricies orci id consequat. Etiam varius dignissim tincidunt. Sed in lacinia augue. Proin ullamcorper quam at tincidunt consectetur.</td>
51
+ <td><a href="/posts/2">Show</a></td>
52
+ <td><a href="/posts/2/edit">Edit</a></td>
53
+ <td><a data-confirm="Are you sure?" data-method="delete" href="/posts/2" rel="nofollow">Destroy</a></td>
54
+ </tr>
55
+ </tbody>
56
+ </table>
57
+
58
+
59
+ <ul>
60
+ <li class='post' id='post_3'>foo</li>
61
+ <li class='post' id='post_2'>bar</li>
62
+ <li class='post' id='post_1'>bar</li>
63
+ </ul>
64
+
65
+
66
+ <ul class='posts' id='post_3'>
67
+ John Doe
68
+ </ul>
69
+
70
+ <ul class='posts' id='post_2'>
71
+ Jane Doe
72
+ </ul>
73
+
74
+ <ul class='posts' id='post_1'>
75
+ Jane Doe
76
+ </ul>
77
+
78
+
79
+ <ol class='posts' id='post_3'>
80
+ John Doe
81
+ </ol>
82
+
83
+ <ol class='posts' id='post_2'>
84
+ Jane Doe
85
+ </ol>
86
+
87
+ <ol class='posts' id='post_1'>
88
+ Jane Doe
89
+ </ol>
90
+
91
+
92
+ <p class='post' id='post_3'>
93
+ This is a paragraph with the unique string of John Doe.
94
+ </p>
95
+
96
+ <p class='post' id='post_2'>
97
+ The first paragraph for Jane Doe.
98
+ </p>
99
+
100
+ <p class='post' id='post_1'>
101
+ The second paragraph for Jane Doe.
102
+ </p>
103
+
104
+
105
+ <article class='post' id='post_3'>
106
+ This is an article for John Doe.
107
+ </article>
108
+
109
+ <article class='post' id='post_1'>
110
+ This is an article for Jane Doe.
111
+ </article>
112
+
113
+ <article class='post' id='post_2'>
114
+ This is another article for Jane Doe.
115
+ </article>
116
+
117
+
118
+ <nav class='post' id='post_1'>
119
+ John Doe
120
+ </nav>
121
+
122
+ <nav class='post' id='post_2'>
123
+ Jane Doe
124
+ </nav>
125
+
126
+ <nav class='post' id='post_3'>
127
+ Jane Doe
128
+ </nav>
129
+
130
+
131
+ <section class='post' id='post_3'>
132
+ A section with John Doe.
133
+ </section>
134
+
135
+ <section class='post' id='post_1'>
136
+ A section with Jane Doe.
137
+ </section>
138
+
139
+ <section class='post' id='post_2'>
140
+ Another section with Jane Doe.
141
+ </section>
142
+
143
+
144
+ <header class='post' id='post_1'>
145
+ John Doe
146
+ </header>
147
+
148
+ <header class='post' id='post_2'>
149
+ Jane Doe
150
+ </header>
151
+
152
+ <header class='post' id='post_3'>
153
+ Jane Doe
154
+ </header>
155
+
156
+
157
+ <footer class='post' id='post_1'>
158
+ John Doe
159
+ </footer>
160
+
161
+ <footer class='post' id='post_2'>
162
+ Jane Doe
163
+ </footer>
164
+
165
+ <footer class='post' id='post_3'>
166
+ Jane Doe
167
+ </footer>
168
+
169
+ <aside class='post' id='post_1'>
170
+ John Doe
171
+ </aside>
172
+
173
+ <aside class='post' id='post_2'>
174
+ Jane Doe
175
+ </aside>
176
+
177
+ <aside class='post' id='post_3'>
178
+ Jane Doe
179
+ </aside>
180
+
181
+ <form class='post' id='post_1'>
182
+ John Doe
183
+ <input id='name' value='John Doe'>
184
+ <input id='email' value='john@example.com'>
185
+ </form>
186
+
187
+ <form class='post' id='post_2'>
188
+ Jane Doe
189
+ <input id='name' value='Jane Doe'>
190
+ <input id='email' value='jane@example.com'>
191
+ </form>
192
+
193
+ <form class='post' id='post_3'>
194
+ Jane Doe
195
+ <input id='name' value='Jane Doe'>
196
+ <input id='email' value='jane@example.com'>
197
+ </form>
198
+
199
+ <img src='http://example.com/johndoe' alt='John Doe'/>
200
+ </html>
201
+ STRING
@@ -0,0 +1,26 @@
1
+ require 'byebug'
2
+ require 'capybara-extensions'
3
+ require 'minitest/autorun'
4
+ require 'minitest/reporters'
5
+
6
+ # string to test against
7
+ require 'string'
8
+
9
+ MiniTest::Reporters.use!
10
+
11
+ class MiniTest::Spec
12
+ class << self
13
+ alias :context :describe
14
+ end
15
+ end
16
+
17
+ module MiniTest::Expectations
18
+ infect_an_assertion :assert_received, :must_have_received
19
+ end
20
+
21
+ class Post
22
+ attr_accessor :id
23
+ def initialize(id)
24
+ @id = id
25
+ end
26
+ end
metadata CHANGED
@@ -1,163 +1,195 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: capybara-extensions
3
- version: !ruby/object:Gem::Version
4
- hash: 23
5
- prerelease:
6
- segments:
7
- - 0
8
- - 2
9
- - 0
10
- version: 0.2.0
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.3.0
11
5
  platform: ruby
12
- authors:
13
- - Andy Waite
6
+ authors:
7
+ - Michael Dupuis Jr.
8
+ - Dan McClain
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2012-03-25 00:00:00 Z
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
21
- requirement: &id001 !ruby/object:Gem::Requirement
22
- none: false
23
- requirements:
24
- - - ">="
25
- - !ruby/object:Gem::Version
26
- hash: 3
27
- segments:
28
- - 0
29
- version: "0"
30
- version_requirements: *id001
31
- name: shoulda
12
+ date: 2013-11-04 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: builder
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - '>='
19
+ - !ruby/object:Gem::Version
20
+ version: '0'
21
+ type: :development
32
22
  prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - '>='
26
+ - !ruby/object:Gem::Version
27
+ version: '0'
28
+ - !ruby/object:Gem::Dependency
29
+ name: bundler
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - ~>
33
+ - !ruby/object:Gem::Version
34
+ version: '1.3'
33
35
  type: :development
34
- - !ruby/object:Gem::Dependency
35
- requirement: &id002 !ruby/object:Gem::Requirement
36
- none: false
37
- requirements:
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
38
39
  - - ~>
39
- - !ruby/object:Gem::Version
40
- hash: 23
41
- segments:
42
- - 1
43
- - 0
44
- - 0
45
- version: 1.0.0
46
- version_requirements: *id002
47
- name: bundler
40
+ - !ruby/object:Gem::Version
41
+ version: '1.3'
42
+ - !ruby/object:Gem::Dependency
43
+ name: byebug
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - '>='
47
+ - !ruby/object:Gem::Version
48
+ version: '0'
49
+ type: :development
48
50
  prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - '>='
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
56
+ - !ruby/object:Gem::Dependency
57
+ name: capybara_minitest_spec
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - '>='
61
+ - !ruby/object:Gem::Version
62
+ version: '0'
49
63
  type: :development
50
- - !ruby/object:Gem::Dependency
51
- requirement: &id003 !ruby/object:Gem::Requirement
52
- none: false
53
- requirements:
54
- - - ~>
55
- - !ruby/object:Gem::Version
56
- hash: 7
57
- segments:
58
- - 1
59
- - 6
60
- - 4
61
- version: 1.6.4
62
- version_requirements: *id003
63
- name: jeweler
64
64
  prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ - !ruby/object:Gem::Dependency
71
+ name: minitest
72
+ requirement: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - <
75
+ - !ruby/object:Gem::Version
76
+ version: '5.0'
65
77
  type: :development
66
- - !ruby/object:Gem::Dependency
67
- requirement: &id004 !ruby/object:Gem::Requirement
68
- none: false
69
- requirements:
70
- - - ">="
71
- - !ruby/object:Gem::Version
72
- hash: 3
73
- segments:
74
- - 0
75
- version: "0"
76
- version_requirements: *id004
77
- name: rcov
78
78
  prerelease: false
79
+ version_requirements: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - <
82
+ - !ruby/object:Gem::Version
83
+ version: '5.0'
84
+ - !ruby/object:Gem::Dependency
85
+ name: minitest-reporters
86
+ requirement: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - ~>
89
+ - !ruby/object:Gem::Version
90
+ version: 0.14.21
79
91
  type: :development
80
- - !ruby/object:Gem::Dependency
81
- requirement: &id005 !ruby/object:Gem::Requirement
82
- none: false
83
- requirements:
84
- - - ">="
85
- - !ruby/object:Gem::Version
86
- hash: 3
87
- segments:
88
- - 0
89
- version: "0"
90
- version_requirements: *id005
91
- name: capybara
92
92
  prerelease: false
93
+ version_requirements: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - ~>
96
+ - !ruby/object:Gem::Version
97
+ version: 0.14.21
98
+ - !ruby/object:Gem::Dependency
99
+ name: rake
100
+ requirement: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - '>='
103
+ - !ruby/object:Gem::Version
104
+ version: '0'
105
+ type: :development
106
+ prerelease: false
107
+ version_requirements: !ruby/object:Gem::Requirement
108
+ requirements:
109
+ - - '>='
110
+ - !ruby/object:Gem::Version
111
+ version: '0'
112
+ - !ruby/object:Gem::Dependency
113
+ name: yard
114
+ requirement: !ruby/object:Gem::Requirement
115
+ requirements:
116
+ - - '>='
117
+ - !ruby/object:Gem::Version
118
+ version: '0'
93
119
  type: :development
94
- - !ruby/object:Gem::Dependency
95
- requirement: &id006 !ruby/object:Gem::Requirement
96
- none: false
97
- requirements:
98
- - - ">="
99
- - !ruby/object:Gem::Version
100
- hash: 3
101
- segments:
102
- - 0
103
- version: "0"
104
- version_requirements: *id006
105
- name: capybara
106
120
  prerelease: false
121
+ version_requirements: !ruby/object:Gem::Requirement
122
+ requirements:
123
+ - - '>='
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
126
+ - !ruby/object:Gem::Dependency
127
+ name: capybara
128
+ requirement: !ruby/object:Gem::Requirement
129
+ requirements:
130
+ - - ~>
131
+ - !ruby/object:Gem::Version
132
+ version: 2.1.0
107
133
  type: :runtime
108
- description: Some useful extensions to Capybara
109
- email: andy@andywaite.com
134
+ prerelease: false
135
+ version_requirements: !ruby/object:Gem::Requirement
136
+ requirements:
137
+ - - ~>
138
+ - !ruby/object:Gem::Version
139
+ version: 2.1.0
140
+ description: Complements Capybara with additional finders and matchers.
141
+ email:
142
+ - michael.dupuis@dockyard.com
143
+ - rubygems@danmcclain.net
110
144
  executables: []
111
-
112
145
  extensions: []
113
-
114
- extra_rdoc_files:
115
- - LICENSE.txt
116
- - README.md
117
- files:
118
- - .document
146
+ extra_rdoc_files: []
147
+ files:
148
+ - .gitignore
149
+ - CONTRIBUTING.md
119
150
  - Gemfile
120
- - Gemfile.lock
121
151
  - LICENSE.txt
122
152
  - README.md
123
153
  - Rakefile
124
- - VERSION
125
154
  - capybara-extensions.gemspec
126
155
  - lib/capybara-extensions.rb
127
- - test/helper.rb
128
- - test/test_capybara-extensions.rb
129
- homepage: http://github.com/andyw8/capybara-extensions
130
- licenses:
156
+ - lib/capybara-extensions/finders.rb
157
+ - lib/capybara-extensions/locators.rb
158
+ - lib/capybara-extensions/matchers.rb
159
+ - lib/capybara-extensions/version.rb
160
+ - test/finders_test.rb
161
+ - test/matchers_test.rb
162
+ - test/string.rb
163
+ - test/test_helper.rb
164
+ homepage: https://github.com/dockyard/capybara-extensions
165
+ licenses:
131
166
  - MIT
167
+ metadata: {}
132
168
  post_install_message:
133
169
  rdoc_options: []
134
-
135
- require_paths:
170
+ require_paths:
136
171
  - lib
137
- required_ruby_version: !ruby/object:Gem::Requirement
138
- none: false
139
- requirements:
140
- - - ">="
141
- - !ruby/object:Gem::Version
142
- hash: 3
143
- segments:
144
- - 0
145
- version: "0"
146
- required_rubygems_version: !ruby/object:Gem::Requirement
147
- none: false
148
- requirements:
149
- - - ">="
150
- - !ruby/object:Gem::Version
151
- hash: 3
152
- segments:
153
- - 0
154
- version: "0"
172
+ required_ruby_version: !ruby/object:Gem::Requirement
173
+ requirements:
174
+ - - '>='
175
+ - !ruby/object:Gem::Version
176
+ version: '0'
177
+ required_rubygems_version: !ruby/object:Gem::Requirement
178
+ requirements:
179
+ - - '>='
180
+ - !ruby/object:Gem::Version
181
+ version: '0'
155
182
  requirements: []
156
-
157
183
  rubyforge_project:
158
- rubygems_version: 1.8.10
184
+ rubygems_version: 2.0.3
159
185
  signing_key:
160
- specification_version: 3
161
- summary: Some useful extensions to Capybara
162
- test_files: []
163
-
186
+ specification_version: 4
187
+ summary: Capybara has an intuitive API which mimics the language of an actual user.
188
+ This library extends Capybara's finders and matchers with additional methods for
189
+ interacting with tables, lists, and list items, as well as many HTML5 elements.
190
+ test_files:
191
+ - test/finders_test.rb
192
+ - test/matchers_test.rb
193
+ - test/string.rb
194
+ - test/test_helper.rb
195
+ has_rdoc:
data/.document DELETED
@@ -1,5 +0,0 @@
1
- lib/**/*.rb
2
- bin/*
3
- -
4
- features/**/*.feature
5
- LICENSE.txt
data/Gemfile.lock DELETED
@@ -1,45 +0,0 @@
1
- GEM
2
- remote: http://rubygems.org/
3
- specs:
4
- capybara (1.1.2)
5
- mime-types (>= 1.16)
6
- nokogiri (>= 1.3.3)
7
- rack (>= 1.0.0)
8
- rack-test (>= 0.5.4)
9
- selenium-webdriver (~> 2.0)
10
- xpath (~> 0.1.4)
11
- childprocess (0.3.1)
12
- ffi (~> 1.0.6)
13
- ffi (1.0.11)
14
- git (1.2.5)
15
- jeweler (1.6.4)
16
- bundler (~> 1.0)
17
- git (>= 1.2.5)
18
- rake
19
- mime-types (1.17.2)
20
- multi_json (1.1.0)
21
- nokogiri (1.5.2)
22
- rack (1.4.1)
23
- rack-test (0.6.1)
24
- rack (>= 1.0)
25
- rake (0.9.2.2)
26
- rcov (0.9.11)
27
- rubyzip (0.9.6.1)
28
- selenium-webdriver (2.20.0)
29
- childprocess (>= 0.2.5)
30
- ffi (~> 1.0)
31
- multi_json (~> 1.0)
32
- rubyzip
33
- shoulda (2.11.3)
34
- xpath (0.1.4)
35
- nokogiri (~> 1.3)
36
-
37
- PLATFORMS
38
- ruby
39
-
40
- DEPENDENCIES
41
- bundler (~> 1.0.0)
42
- capybara
43
- jeweler (~> 1.6.4)
44
- rcov
45
- shoulda
data/VERSION DELETED
@@ -1 +0,0 @@
1
- 0.2.0
data/test/helper.rb DELETED
@@ -1,18 +0,0 @@
1
- require 'rubygems'
2
- require 'bundler'
3
- begin
4
- Bundler.setup(:default, :development)
5
- rescue Bundler::BundlerError => e
6
- $stderr.puts e.message
7
- $stderr.puts "Run `bundle install` to install missing gems"
8
- exit e.status_code
9
- end
10
- require 'test/unit'
11
- require 'shoulda'
12
-
13
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
14
- $LOAD_PATH.unshift(File.dirname(__FILE__))
15
- require 'capybara-extensions'
16
-
17
- class Test::Unit::TestCase
18
- end
@@ -1,13 +0,0 @@
1
- require 'helper'
2
-
3
- class TestCapybaraExtensions < Test::Unit::TestCase
4
- should "find a node's parent" do
5
- html = <<-EOM
6
- <div id="parent">a<div id="child">b</div>
7
- EOM
8
-
9
- doc = Capybara.string(html)
10
- assert_equal doc.find('#child').parent[:id], 'parent'
11
-
12
- end
13
- end