kelp 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. data/.gitignore +5 -0
  2. data/Gemfile +12 -0
  3. data/Gemfile.lock +91 -0
  4. data/MIT-LICENSE +22 -0
  5. data/README.md +16 -0
  6. data/Rakefile +16 -0
  7. data/docs/Makefile +130 -0
  8. data/docs/_static/custom.css +9 -0
  9. data/docs/conf.py +217 -0
  10. data/docs/development.rst +27 -0
  11. data/docs/future.rst +9 -0
  12. data/docs/index.rst +33 -0
  13. data/docs/make.bat +155 -0
  14. data/docs/testing.rst +15 -0
  15. data/docs/usage.rst +85 -0
  16. data/kelp.gemspec +25 -0
  17. data/lib/kelp.rb +1 -0
  18. data/lib/kelp/capybara.rb +2 -0
  19. data/lib/kelp/capybara/capybara_steps.rb +225 -0
  20. data/lib/kelp/capybara/form_helper.rb +131 -0
  21. data/lib/kelp/capybara/web_helper.rb +148 -0
  22. data/spec/capybara/click_link_in_row_spec.rb +24 -0
  23. data/spec/capybara/dropdown_spec.rb +112 -0
  24. data/spec/capybara/field_should_be_empty_spec.rb +44 -0
  25. data/spec/capybara/field_should_contain_spec.rb +143 -0
  26. data/spec/capybara/fill_in_fields_spec.rb +67 -0
  27. data/spec/capybara/follow_spec.rb +35 -0
  28. data/spec/capybara/page_should_have_spec.rb +48 -0
  29. data/spec/capybara/page_should_not_have_spec.rb +53 -0
  30. data/spec/capybara/press_spec.rb +33 -0
  31. data/spec/capybara/should_be_disabled_spec.rb +28 -0
  32. data/spec/capybara/should_be_enabled_spec.rb +29 -0
  33. data/spec/capybara/should_not_see_spec.rb +97 -0
  34. data/spec/capybara/should_see_in_same_row_spec.rb +41 -0
  35. data/spec/capybara/should_see_spec.rb +80 -0
  36. data/spec/capybara/spec_helper.rb +22 -0
  37. data/spec/test_app/test_app.rb +18 -0
  38. data/spec/test_app/views/about.erb +9 -0
  39. data/spec/test_app/views/edit1.erb +9 -0
  40. data/spec/test_app/views/edit2.erb +9 -0
  41. data/spec/test_app/views/edit3.erb +9 -0
  42. data/spec/test_app/views/form.erb +38 -0
  43. data/spec/test_app/views/home.erb +46 -0
  44. data/spec/test_app/views/thanks.erb +10 -0
  45. metadata +183 -0
@@ -0,0 +1,97 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
+
3
+ describe WebHelper, "#should_not_see" do
4
+ before(:each) do
5
+ visit('/home')
6
+ end
7
+
8
+ context "passes when" do
9
+ context "String" do
10
+ it "does not exist" do
11
+ should_not_see "Goodbye cruel world"
12
+ end
13
+
14
+ it "none of several strings exist" do
15
+ should_not_see [
16
+ "Hello nurse",
17
+ "Goodbye cruel world"
18
+ ]
19
+ end
20
+
21
+ it "exists but is not within the scope" do
22
+ should_not_see "Goodbye world", :within => "#greeting"
23
+ end
24
+ end
25
+
26
+ context "Regexp" do
27
+ it "does not match" do
28
+ should_not_see /(Yo|Wazzup) world/
29
+ end
30
+
31
+ it "none of several regexps match" do
32
+ should_not_see [
33
+ /(Yo|Wazzup) world/,
34
+ /(Ciao|Later) world/
35
+ ]
36
+ end
37
+
38
+ it "matches but is not within the scope" do
39
+ should_not_see /Goodbye world/, :within => "#greeting"
40
+ end
41
+ end
42
+ end
43
+
44
+
45
+ context "fails when" do
46
+ context "String" do
47
+ it "exists" do
48
+ lambda do
49
+ should_not_see "Hello world"
50
+ end.should raise_error
51
+ end
52
+
53
+ it "any of several exist" do
54
+ lambda do
55
+ should_not_see [
56
+ "Hello nurse",
57
+ "Goodbye cruel world",
58
+ "Goodbye world"
59
+ ]
60
+ end.should raise_error
61
+ end
62
+
63
+ it "exists within the scope" do
64
+ lambda do
65
+ should_not_see "Hello world", :within => "#greeting"
66
+ end.should raise_error
67
+ end
68
+ end
69
+
70
+ context "Regexp" do
71
+ it "matches" do
72
+ lambda do
73
+ should_not_see /(Hello|Goodbye) world/
74
+ end.should raise_error
75
+ end
76
+
77
+ it "any of several regexps match" do
78
+ lambda do
79
+ should_not_see [
80
+ /(Yo|Wazzup) world/,
81
+ /(Ciao|Later) world/,
82
+ /(Hello|Goodbye) world/
83
+ ]
84
+ end.should raise_error
85
+ end
86
+
87
+ it "matches within the scope" do
88
+ lambda do
89
+ should_not_see /(Hello|Goodbye) world/, :within => "#greeting"
90
+ end.should raise_error
91
+ end
92
+ end
93
+
94
+ end
95
+ end
96
+
97
+
@@ -0,0 +1,41 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
+
3
+ describe WebHelper, "#should_see_in_same_row" do
4
+ before(:each) do
5
+ visit('/home')
6
+ end
7
+
8
+ context "passes when" do
9
+ it "two strings are in the same row" do
10
+ should_see_in_same_row ["Eric", "Edit"]
11
+ should_see_in_same_row ["John", "Edit"]
12
+ should_see_in_same_row ["Terry", "Edit"]
13
+ end
14
+
15
+ it "three strings are in the same row" do
16
+ should_see_in_same_row ["Eric", "555-4444", "Edit"]
17
+ should_see_in_same_row ["John", "666-5555", "Edit"]
18
+ should_see_in_same_row ["Terry", "777-6666", "Edit"]
19
+ end
20
+ end
21
+ end
22
+
23
+ describe WebHelper, "#should_see_in_same_row" do
24
+ before(:each) do
25
+ visit('/home')
26
+ end
27
+
28
+ context "passes when" do
29
+ it "two strings are not in the same row" do
30
+ should_not_see_in_same_row ["Eric", "Delete"]
31
+ should_not_see_in_same_row ["John", "Delete"]
32
+ should_not_see_in_same_row ["Terry", "Delete"]
33
+ end
34
+
35
+ it "any two of three strings are not in the same row" do
36
+ should_not_see_in_same_row ["Eric", "555-4444", "Delete"]
37
+ should_not_see_in_same_row ["John", "666-5555", "Delete"]
38
+ should_not_see_in_same_row ["Terry", "777-6666", "Delete"]
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,80 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
+
3
+ describe WebHelper, "#should_see" do
4
+ before(:each) do
5
+ visit('/home')
6
+ end
7
+
8
+ context "passes when" do
9
+ context "String" do
10
+ it "exists" do
11
+ should_see "Hello world"
12
+ should_see "Goodbye world"
13
+ end
14
+
15
+ it "multiple exist" do
16
+ should_see [
17
+ "Hello world",
18
+ "Goodbye world"
19
+ ]
20
+ end
21
+
22
+ it "is within the scope" do
23
+ should_see "Hello world", :within => "#greeting"
24
+ end
25
+ end
26
+
27
+ context "Regexp" do
28
+ it "matches" do
29
+ should_see /(Hello|Goodbye) world/
30
+ end
31
+
32
+ it "matches within the scope" do
33
+ should_see /(Hello|Goodbye) world/, :within => "#greeting"
34
+ should_see /(Hello|Goodbye) world/, :within => "#farewell"
35
+ end
36
+ end
37
+ end
38
+
39
+ context "fails when" do
40
+ context "String" do
41
+ it "does not exist" do
42
+ lambda do
43
+ should_see "Goodbye cruel world"
44
+ end.should raise_error
45
+ end
46
+
47
+ it "any of several do not exist" do
48
+ lambda do
49
+ should_see [
50
+ "Hello world",
51
+ "Goodbye world",
52
+ "Hello, nurse!"
53
+ ]
54
+ end.should raise_error
55
+ end
56
+
57
+ it "is not within the scope" do
58
+ lambda do
59
+ should_see "Goodbye world", :within => "#greeting"
60
+ end.should raise_error
61
+ end
62
+ end
63
+
64
+ context "Regexp" do
65
+ it "does not match" do
66
+ lambda do
67
+ should_see /(Yo|Wazzup) world/
68
+ end.should raise_error
69
+ end
70
+
71
+ it "matches but is not within the scope" do
72
+ lambda do
73
+ should_see /Goodbye world/, :within => "#greeting"
74
+ end.should raise_error
75
+ end
76
+ end
77
+ end
78
+
79
+ end
80
+
@@ -0,0 +1,22 @@
1
+ require 'rspec'
2
+ require 'capybara'
3
+ require 'capybara/dsl'
4
+ require File.expand_path(File.dirname(__FILE__) + '/../test_app/test_app')
5
+ require File.expand_path(File.dirname(__FILE__) + '/../../lib/kelp/capybara/web_helper')
6
+ require File.expand_path(File.dirname(__FILE__) + '/../../lib/kelp/capybara/form_helper')
7
+
8
+ RSpec.configure do |config|
9
+ config.include Capybara
10
+ config.include WebHelper
11
+ config.include FormHelper
12
+ config.after do
13
+ Capybara.reset_sessions!
14
+ Capybara.use_default_driver
15
+ end
16
+ config.before do
17
+ Capybara.default_driver = :rack_test
18
+ Capybara.default_selector = :css
19
+ Capybara.app = TestApp
20
+ end
21
+ end
22
+
@@ -0,0 +1,18 @@
1
+ require 'rubygems'
2
+ require 'sinatra/base'
3
+ require 'rack'
4
+ require 'yaml'
5
+ require 'erb'
6
+
7
+ class TestApp < Sinatra::Base
8
+ set :root, File.dirname(__FILE__)
9
+ set :static, true
10
+
11
+ get '/:view' do |view|
12
+ erb view.to_sym
13
+ end
14
+ end
15
+
16
+ if __FILE__ == $0
17
+ Rack::Handler::Mongrel.run TestApp, :Port => 8070
18
+ end
@@ -0,0 +1,9 @@
1
+ <html>
2
+ <head><title>About</title></head>
3
+ <body>
4
+ <h1>About Us</h1>
5
+ <p>We're a small company with an even smaller webpage</p>
6
+ </body>
7
+ </html>
8
+
9
+
@@ -0,0 +1,9 @@
1
+ <html>
2
+ <head><title>Edit 1</title></head>
3
+ <body>
4
+ <h1>Edit 1</h1>
5
+ <p>You are editing record 1</p>
6
+ </body>
7
+ </html>
8
+
9
+
@@ -0,0 +1,9 @@
1
+ <html>
2
+ <head><title>Edit 2</title></head>
3
+ <body>
4
+ <h1>Edit 2</h1>
5
+ <p>You are editing record 2</p>
6
+ </body>
7
+ </html>
8
+
9
+
@@ -0,0 +1,9 @@
1
+ <html>
2
+ <head><title>Edit 3</title></head>
3
+ <body>
4
+ <h1>Edit 3</h1>
5
+ <p>You are editing record 3</p>
6
+ </body>
7
+ </html>
8
+
9
+
@@ -0,0 +1,38 @@
1
+ <html>
2
+ <head><title>Form</title></head>
3
+ <body>
4
+ <h1>Form Test</h1>
5
+
6
+ <div id="person_form">
7
+ <form action="/thanks" method="get">
8
+ <p>
9
+ <label for="first_name">First name</label>
10
+ <input id="first_name" type="text" />
11
+ </p>
12
+ <p>
13
+ <label for="last_name">Last name</label>
14
+ <input id="last_name" type="text" />
15
+ </p>
16
+ <p>
17
+ <label for="height">Height</label>
18
+ <select id="height">
19
+ <option value="1">Short</option>
20
+ <option value="2" selected="selected">Average</option>
21
+ <option value="3" >Tall</option>
22
+ </select>
23
+ </p>
24
+ <p><input type="submit" value="Submit" /></p>
25
+ </form>
26
+ </div>
27
+
28
+ <div id="other_form">
29
+ <form action="/thanks" method="get">
30
+ <p><input id="readonly" type="text" disabled="disabled" /></p>
31
+ <p><input type="submit" value="Submit" disabled="disabled" /></p>
32
+ </form>
33
+ </div>
34
+
35
+ </body>
36
+ </html>
37
+
38
+
@@ -0,0 +1,46 @@
1
+ <html>
2
+ <head><title>Homepage</title></head>
3
+ <body>
4
+ <h1>Homepage</h1>
5
+
6
+ <div id="greeting">
7
+ <p>Hello world</p>
8
+ </div>
9
+
10
+ <ul>
11
+ <li>First</li>
12
+ <li>Second</li>
13
+ <li>Third</li>
14
+ </ul>
15
+
16
+ <div id="links">
17
+ <a href="/about">About Us</a>
18
+ </div>
19
+
20
+ <div id="fields">
21
+ <form action="/thanks" method="get">
22
+ <input type="text" name="message" />
23
+ <input type="submit" value="Submit" />
24
+ </form>
25
+ </div>
26
+
27
+ <div id="tables">
28
+ <table>
29
+ <thead>
30
+ <tr> <th>Name</th> <th>Phone</th> <th>Action</th> </tr>
31
+ </thead>
32
+ <tbody>
33
+ <tr> <td>Eric</td> <td>555-4444</td> <td><a href="/edit1">Edit</a></td> </tr>
34
+ <tr> <td>John</td> <td>666-5555</td> <td><a href="/edit2">Edit</a></td> </tr>
35
+ <tr> <td>Terry</td> <td>777-6666</td> <td><a href="/edit3">Edit</a></td> </tr>
36
+ </tbody>
37
+ </table>
38
+ </div>
39
+
40
+ <div id="farewell">
41
+ <p>Goodbye world</p>
42
+ </div>
43
+
44
+ </body>
45
+ </html>
46
+
@@ -0,0 +1,10 @@
1
+ <html>
2
+ <head><title>Thanks</title></head>
3
+ <body>
4
+ <h1>Thank You</h1>
5
+ <p>We appreciate your feedback</p>
6
+ </body>
7
+ </html>
8
+
9
+
10
+
metadata ADDED
@@ -0,0 +1,183 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: kelp
3
+ version: !ruby/object:Gem::Version
4
+ hash: 25
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 1
9
+ - 1
10
+ version: 0.1.1
11
+ platform: ruby
12
+ authors:
13
+ - Eric Pierce
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2010-12-13 00:00:00 -07:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: capybara
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ hash: 15
30
+ segments:
31
+ - 0
32
+ - 4
33
+ - 0
34
+ version: 0.4.0
35
+ type: :runtime
36
+ version_requirements: *id001
37
+ - !ruby/object:Gem::Dependency
38
+ name: sinatra
39
+ prerelease: false
40
+ requirement: &id002 !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ hash: 3
46
+ segments:
47
+ - 0
48
+ version: "0"
49
+ type: :development
50
+ version_requirements: *id002
51
+ - !ruby/object:Gem::Dependency
52
+ name: rspec
53
+ prerelease: false
54
+ requirement: &id003 !ruby/object:Gem::Requirement
55
+ none: false
56
+ requirements:
57
+ - - ">="
58
+ - !ruby/object:Gem::Version
59
+ hash: 7
60
+ segments:
61
+ - 2
62
+ - 2
63
+ - 0
64
+ version: 2.2.0
65
+ type: :development
66
+ version_requirements: *id003
67
+ - !ruby/object:Gem::Dependency
68
+ name: rspec-rails
69
+ prerelease: false
70
+ requirement: &id004 !ruby/object:Gem::Requirement
71
+ none: false
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ hash: 3
76
+ segments:
77
+ - 0
78
+ version: "0"
79
+ type: :development
80
+ version_requirements: *id004
81
+ - !ruby/object:Gem::Dependency
82
+ name: rcov
83
+ prerelease: false
84
+ requirement: &id005 !ruby/object:Gem::Requirement
85
+ none: false
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ hash: 3
90
+ segments:
91
+ - 0
92
+ version: "0"
93
+ type: :development
94
+ version_requirements: *id005
95
+ description: " Kelp is a collection of helper methods for Cucumber to ease the process of\n writing step definitions.\n"
96
+ email: wapcaplet88@gmail.com
97
+ executables: []
98
+
99
+ extensions: []
100
+
101
+ extra_rdoc_files: []
102
+
103
+ files:
104
+ - .gitignore
105
+ - Gemfile
106
+ - Gemfile.lock
107
+ - MIT-LICENSE
108
+ - README.md
109
+ - Rakefile
110
+ - docs/Makefile
111
+ - docs/_static/custom.css
112
+ - docs/conf.py
113
+ - docs/development.rst
114
+ - docs/future.rst
115
+ - docs/index.rst
116
+ - docs/make.bat
117
+ - docs/testing.rst
118
+ - docs/usage.rst
119
+ - kelp.gemspec
120
+ - lib/kelp.rb
121
+ - lib/kelp/capybara.rb
122
+ - lib/kelp/capybara/capybara_steps.rb
123
+ - lib/kelp/capybara/form_helper.rb
124
+ - lib/kelp/capybara/web_helper.rb
125
+ - spec/capybara/click_link_in_row_spec.rb
126
+ - spec/capybara/dropdown_spec.rb
127
+ - spec/capybara/field_should_be_empty_spec.rb
128
+ - spec/capybara/field_should_contain_spec.rb
129
+ - spec/capybara/fill_in_fields_spec.rb
130
+ - spec/capybara/follow_spec.rb
131
+ - spec/capybara/page_should_have_spec.rb
132
+ - spec/capybara/page_should_not_have_spec.rb
133
+ - spec/capybara/press_spec.rb
134
+ - spec/capybara/should_be_disabled_spec.rb
135
+ - spec/capybara/should_be_enabled_spec.rb
136
+ - spec/capybara/should_not_see_spec.rb
137
+ - spec/capybara/should_see_in_same_row_spec.rb
138
+ - spec/capybara/should_see_spec.rb
139
+ - spec/capybara/spec_helper.rb
140
+ - spec/test_app/test_app.rb
141
+ - spec/test_app/views/about.erb
142
+ - spec/test_app/views/edit1.erb
143
+ - spec/test_app/views/edit2.erb
144
+ - spec/test_app/views/edit3.erb
145
+ - spec/test_app/views/form.erb
146
+ - spec/test_app/views/home.erb
147
+ - spec/test_app/views/thanks.erb
148
+ has_rdoc: true
149
+ homepage: http://github.com/wapcaplet/kelp
150
+ licenses: []
151
+
152
+ post_install_message:
153
+ rdoc_options: []
154
+
155
+ require_paths:
156
+ - lib
157
+ required_ruby_version: !ruby/object:Gem::Requirement
158
+ none: false
159
+ requirements:
160
+ - - ">="
161
+ - !ruby/object:Gem::Version
162
+ hash: 3
163
+ segments:
164
+ - 0
165
+ version: "0"
166
+ required_rubygems_version: !ruby/object:Gem::Requirement
167
+ none: false
168
+ requirements:
169
+ - - ">="
170
+ - !ruby/object:Gem::Version
171
+ hash: 3
172
+ segments:
173
+ - 0
174
+ version: "0"
175
+ requirements: []
176
+
177
+ rubyforge_project:
178
+ rubygems_version: 1.3.7
179
+ signing_key:
180
+ specification_version: 3
181
+ summary: Cucumber helper methods
182
+ test_files: []
183
+