kelp 0.1.7 → 0.1.8
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.
- data/Gemfile.lock +1 -1
- data/History.md +6 -0
- data/README.md +4 -4
- data/Rakefile +2 -2
- data/features/kelp_step_definitions.feature +0 -1
- data/kelp.gemspec +3 -4
- data/lib/kelp/helper.rb +10 -0
- data/lib/kelp/visibility.rb +9 -8
- data/spec/attribute_spec.rb +4 -4
- data/spec/dropdown_spec.rb +10 -10
- data/spec/field_spec.rb +8 -8
- data/spec/visibility_spec.rb +11 -11
- metadata +5 -5
data/Gemfile.lock
CHANGED
data/History.md
CHANGED
data/README.md
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
Kelp
|
2
2
|
====
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
[
|
7
|
-
|
4
|
+
[Kelp](http://github.com/wapcaplet/kelp) is a collection of helpers that makes
|
5
|
+
it easier to write step definitions for [Cucumber](http://cukes.info). The Kelp
|
6
|
+
gem is hosted on [Rubygems](http://rubygems.org/gems/kelp), so you can install
|
7
|
+
it with:
|
8
8
|
|
9
9
|
$ gem install kelp
|
10
10
|
|
data/Rakefile
CHANGED
@@ -31,8 +31,8 @@ end
|
|
31
31
|
desc "Run RSpec and Cucumber tests with coverage analysis"
|
32
32
|
task :all do |t|
|
33
33
|
rm 'coverage.data' if File.exist?('coverage.data')
|
34
|
-
Rake::Task['
|
35
|
-
Rake::Task['
|
34
|
+
Rake::Task['spec'].invoke
|
35
|
+
Rake::Task['cucumber'].invoke
|
36
36
|
end
|
37
37
|
|
38
38
|
task :default => ['all']
|
data/kelp.gemspec
CHANGED
@@ -1,12 +1,11 @@
|
|
1
|
-
|
2
|
-
|
3
1
|
Gem::Specification.new do |s|
|
4
2
|
s.name = "kelp"
|
5
|
-
s.version = "0.1.
|
3
|
+
s.version = "0.1.8"
|
6
4
|
s.summary = "Cucumber helper methods"
|
7
5
|
s.description = <<-EOS
|
8
6
|
Kelp is a collection of helper methods for Cucumber to ease the process of
|
9
|
-
writing step definitions.
|
7
|
+
writing step definitions. It also includes a Rails generator for generic
|
8
|
+
step definitions building upon those helpers.
|
10
9
|
EOS
|
11
10
|
s.authors = ["Eric Pierce"]
|
12
11
|
s.email = "wapcaplet88@gmail.com"
|
data/lib/kelp/helper.rb
CHANGED
@@ -10,5 +10,15 @@ module Kelp
|
|
10
10
|
raise "Could not find field with locator: '#{locator}'"
|
11
11
|
end
|
12
12
|
end
|
13
|
+
|
14
|
+
# Return the appropriate "ExpectationNotMetError" class for the current
|
15
|
+
# version of RSpec
|
16
|
+
def rspec_unexpected
|
17
|
+
if defined?(RSpec)
|
18
|
+
RSpec::Expectations::ExpectationNotMetError
|
19
|
+
else
|
20
|
+
Spec::Expectations::ExpectationNotMetError
|
21
|
+
end
|
22
|
+
end
|
13
23
|
end
|
14
24
|
end
|
data/lib/kelp/visibility.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'kelp/scoping'
|
2
2
|
require 'kelp/xpath'
|
3
3
|
require 'kelp/exceptions'
|
4
|
+
require 'kelp/helper'
|
4
5
|
|
5
6
|
module Kelp
|
6
7
|
# This module defines methods for verifying the visibility (or invisibility)
|
@@ -31,7 +32,7 @@ module Kelp
|
|
31
32
|
texts.each do |text|
|
32
33
|
begin
|
33
34
|
page_should_contain text
|
34
|
-
rescue
|
35
|
+
rescue rspec_unexpected
|
35
36
|
unexpected << text
|
36
37
|
end
|
37
38
|
end
|
@@ -58,7 +59,7 @@ module Kelp
|
|
58
59
|
texts.each do |text|
|
59
60
|
begin
|
60
61
|
page_should_not_contain text
|
61
|
-
rescue
|
62
|
+
rescue rspec_unexpected
|
62
63
|
unexpected << text
|
63
64
|
end
|
64
65
|
end
|
@@ -121,7 +122,7 @@ module Kelp
|
|
121
122
|
assert_contain text
|
122
123
|
end
|
123
124
|
else
|
124
|
-
raise
|
125
|
+
raise NotImplementedError, "Unsupported driver: #{Kelp.driver}"
|
125
126
|
end
|
126
127
|
end
|
127
128
|
|
@@ -145,7 +146,7 @@ module Kelp
|
|
145
146
|
assert_match(regexp, response_body)
|
146
147
|
end
|
147
148
|
else
|
148
|
-
raise
|
149
|
+
raise NotImplementedError, "Unsupported driver: #{Kelp.driver}"
|
149
150
|
end
|
150
151
|
end
|
151
152
|
|
@@ -170,7 +171,7 @@ module Kelp
|
|
170
171
|
assert !hc.matches?(content), hc.negative_failure_message
|
171
172
|
end
|
172
173
|
else
|
173
|
-
raise
|
174
|
+
raise NotImplementedError, "Unsupported driver: #{Kelp.driver}"
|
174
175
|
end
|
175
176
|
end
|
176
177
|
|
@@ -194,7 +195,7 @@ module Kelp
|
|
194
195
|
assert_not_contain(regexp)
|
195
196
|
end
|
196
197
|
else
|
197
|
-
raise
|
198
|
+
raise NotImplementedError, "Unsupported driver: #{Kelp.driver}"
|
198
199
|
end
|
199
200
|
end
|
200
201
|
|
@@ -218,7 +219,7 @@ module Kelp
|
|
218
219
|
if Kelp.driver == :capybara
|
219
220
|
page.should have_xpath(xpath_row_containing(texts))
|
220
221
|
elsif Kelp.driver == :webrat
|
221
|
-
raise
|
222
|
+
raise NotImplementedError, "Not implemented yet"
|
222
223
|
end
|
223
224
|
end
|
224
225
|
end
|
@@ -242,7 +243,7 @@ module Kelp
|
|
242
243
|
if Kelp.driver == :capybara
|
243
244
|
page.should have_no_xpath(xpath_row_containing(texts))
|
244
245
|
elsif Kelp.driver == :webrat
|
245
|
-
raise
|
246
|
+
raise NotImplementedError, "Not implemented yet"
|
246
247
|
end
|
247
248
|
end
|
248
249
|
end
|
data/spec/attribute_spec.rb
CHANGED
@@ -15,13 +15,13 @@ describe Kelp::Attribute, "should_be_disabled" do
|
|
15
15
|
it "element does not exist" do
|
16
16
|
lambda do
|
17
17
|
should_be_disabled "nonexistent"
|
18
|
-
end.should raise_error(
|
18
|
+
end.should raise_error(rspec_unexpected)
|
19
19
|
end
|
20
20
|
|
21
21
|
it "element does not have the disabled attribute" do
|
22
22
|
lambda do
|
23
23
|
should_be_disabled "first_name"
|
24
|
-
end.should raise_error(
|
24
|
+
end.should raise_error(rspec_unexpected)
|
25
25
|
end
|
26
26
|
end
|
27
27
|
end
|
@@ -42,13 +42,13 @@ describe Kelp::Attribute, "should_be_enabled" do
|
|
42
42
|
it "element does not exist" do
|
43
43
|
lambda do
|
44
44
|
should_be_enabled "nonexistent"
|
45
|
-
end.should raise_error(
|
45
|
+
end.should raise_error(rspec_unexpected)
|
46
46
|
end
|
47
47
|
|
48
48
|
it "element has the disabled attribute" do
|
49
49
|
lambda do
|
50
50
|
should_be_enabled "readonly"
|
51
|
-
end.should raise_error(
|
51
|
+
end.should raise_error(rspec_unexpected)
|
52
52
|
end
|
53
53
|
end
|
54
54
|
end
|
data/spec/dropdown_spec.rb
CHANGED
@@ -27,20 +27,20 @@ describe Kelp::Dropdown, "dropdown_should_equal" do
|
|
27
27
|
it "the option does not have the 'selected' attribute" do
|
28
28
|
lambda do
|
29
29
|
dropdown_should_equal "Height", "Tall"
|
30
|
-
end.should raise_error(
|
30
|
+
end.should raise_error(rspec_unexpected)
|
31
31
|
end
|
32
32
|
|
33
33
|
it "the option is not the first one selected by default" do
|
34
34
|
lambda do
|
35
35
|
dropdown_should_equal "Weight", "Medium"
|
36
|
-
end.should raise_error(
|
36
|
+
end.should raise_error(rspec_unexpected)
|
37
37
|
end
|
38
38
|
|
39
39
|
it "the option was not the one chosen programmatically" do
|
40
40
|
select "Tall", :from => "Height"
|
41
41
|
lambda do
|
42
42
|
dropdown_should_equal "Height", "Average"
|
43
|
-
end.should raise_error(
|
43
|
+
end.should raise_error(rspec_unexpected)
|
44
44
|
end
|
45
45
|
end
|
46
46
|
|
@@ -78,7 +78,7 @@ describe Kelp::Dropdown, "dropdown_should_include" do
|
|
78
78
|
it "a single option does not exist in the dropdown" do
|
79
79
|
lambda do
|
80
80
|
dropdown_should_include "Height", "Midget"
|
81
|
-
end.should raise_error(
|
81
|
+
end.should raise_error(rspec_unexpected)
|
82
82
|
end
|
83
83
|
|
84
84
|
it "any of several options do not exist in the dropdown" do
|
@@ -89,7 +89,7 @@ describe Kelp::Dropdown, "dropdown_should_include" do
|
|
89
89
|
"Tall",
|
90
90
|
"Giant",
|
91
91
|
]
|
92
|
-
end.should raise_error(
|
92
|
+
end.should raise_error(rspec_unexpected)
|
93
93
|
end
|
94
94
|
end
|
95
95
|
end
|
@@ -120,7 +120,7 @@ describe Kelp::Dropdown, "dropdown_should_not_include" do
|
|
120
120
|
it "a single option exists in the dropdown" do
|
121
121
|
lambda do
|
122
122
|
dropdown_should_not_include "Height", "Short"
|
123
|
-
end.should raise_error(
|
123
|
+
end.should raise_error(rspec_unexpected)
|
124
124
|
end
|
125
125
|
|
126
126
|
it "any of several options exist in the dropdown" do
|
@@ -131,7 +131,7 @@ describe Kelp::Dropdown, "dropdown_should_not_include" do
|
|
131
131
|
"Behemoth",
|
132
132
|
"Tall",
|
133
133
|
]
|
134
|
-
end.should raise_error(
|
134
|
+
end.should raise_error(rspec_unexpected)
|
135
135
|
end
|
136
136
|
end
|
137
137
|
end
|
@@ -161,20 +161,20 @@ describe Kelp::Dropdown, "dropdown_value_should_equal" do
|
|
161
161
|
it "the option with the 'selected' attribute has a different value" do
|
162
162
|
lambda do
|
163
163
|
dropdown_value_should_equal "Height", "99"
|
164
|
-
end.should raise_error(
|
164
|
+
end.should raise_error(rspec_unexpected)
|
165
165
|
end
|
166
166
|
|
167
167
|
it "the first option selected by default does not have given value" do
|
168
168
|
lambda do
|
169
169
|
dropdown_value_should_equal "Weight", "2"
|
170
|
-
end.should raise_error(
|
170
|
+
end.should raise_error(rspec_unexpected)
|
171
171
|
end
|
172
172
|
|
173
173
|
it "the programmatically chosen option has a different value" do
|
174
174
|
select "Tall", :from => "Height"
|
175
175
|
lambda do
|
176
176
|
dropdown_value_should_equal "Height", "2"
|
177
|
-
end.should raise_error(
|
177
|
+
end.should raise_error(rspec_unexpected)
|
178
178
|
end
|
179
179
|
end
|
180
180
|
end
|
data/spec/field_spec.rb
CHANGED
@@ -71,14 +71,14 @@ describe Kelp::Field, "field_should_contain" do
|
|
71
71
|
it "is empty" do
|
72
72
|
lambda do
|
73
73
|
field_should_contain "first_name", "Brian"
|
74
|
-
end.should raise_error(
|
74
|
+
end.should raise_error(rspec_unexpected)
|
75
75
|
end
|
76
76
|
|
77
77
|
it "has a different value" do
|
78
78
|
fill_in "first_name", :with => "Judith"
|
79
79
|
lambda do
|
80
80
|
field_should_contain "first_name", "Brian"
|
81
|
-
end.should raise_error(
|
81
|
+
end.should raise_error(rspec_unexpected)
|
82
82
|
end
|
83
83
|
end
|
84
84
|
|
@@ -86,14 +86,14 @@ describe Kelp::Field, "field_should_contain" do
|
|
86
86
|
it "is empty" do
|
87
87
|
lambda do
|
88
88
|
field_should_contain "First name", "Brian"
|
89
|
-
end.should raise_error(
|
89
|
+
end.should raise_error(rspec_unexpected)
|
90
90
|
end
|
91
91
|
|
92
92
|
it "has a different value" do
|
93
93
|
fill_in "First name", :with => "Judith"
|
94
94
|
lambda do
|
95
95
|
field_should_contain "First name", "Brian"
|
96
|
-
end.should raise_error(
|
96
|
+
end.should raise_error(rspec_unexpected)
|
97
97
|
end
|
98
98
|
end
|
99
99
|
|
@@ -154,7 +154,7 @@ describe Kelp::Field, "fields_should_contain" do
|
|
154
154
|
it "are empty" do
|
155
155
|
lambda do
|
156
156
|
fields_should_contain "first_name" => "Terry", "last_name" => "Jones"
|
157
|
-
end.should raise_error(
|
157
|
+
end.should raise_error(rspec_unexpected)
|
158
158
|
end
|
159
159
|
|
160
160
|
it "do not all match" do
|
@@ -162,7 +162,7 @@ describe Kelp::Field, "fields_should_contain" do
|
|
162
162
|
fill_in "last_name", :with => "Gilliam"
|
163
163
|
lambda do
|
164
164
|
fields_should_contain "first_name" => "Terry", "last_name" => "Jones"
|
165
|
-
end.should raise_error(
|
165
|
+
end.should raise_error(rspec_unexpected)
|
166
166
|
end
|
167
167
|
end
|
168
168
|
|
@@ -170,7 +170,7 @@ describe Kelp::Field, "fields_should_contain" do
|
|
170
170
|
it "are empty" do
|
171
171
|
lambda do
|
172
172
|
fields_should_contain "First name" => "Terry", "Last name" => "Jones"
|
173
|
-
end.should raise_error(
|
173
|
+
end.should raise_error(rspec_unexpected)
|
174
174
|
end
|
175
175
|
|
176
176
|
it "do not all match" do
|
@@ -178,7 +178,7 @@ describe Kelp::Field, "fields_should_contain" do
|
|
178
178
|
fill_in "Last name", :with => "Gilliam"
|
179
179
|
lambda do
|
180
180
|
fields_should_contain "First name" => "Terry", "Last name" => "Jones"
|
181
|
-
end.should raise_error(
|
181
|
+
end.should raise_error(rspec_unexpected)
|
182
182
|
end
|
183
183
|
end
|
184
184
|
|
data/spec/visibility_spec.rb
CHANGED
@@ -238,19 +238,19 @@ describe Kelp::Visibility, "should_see_in_same_row" do
|
|
238
238
|
it "two strings exist, but are not in the same row" do
|
239
239
|
lambda do
|
240
240
|
should_see_in_same_row ["Eric", "John"]
|
241
|
-
end.should raise_error(
|
241
|
+
end.should raise_error(rspec_unexpected)
|
242
242
|
end
|
243
243
|
|
244
244
|
it "two strings are in the same row, but a third is not" do
|
245
245
|
lambda do
|
246
246
|
should_see_in_same_row ["Eric", "Edit", "Delete"]
|
247
|
-
end.should raise_error(
|
247
|
+
end.should raise_error(rspec_unexpected)
|
248
248
|
end
|
249
249
|
|
250
250
|
it "two strings are in the same row, but outside the given scope" do
|
251
251
|
lambda do
|
252
252
|
should_see_in_same_row ["Eric", "Edit"], :within => "#table_b"
|
253
|
-
end.should raise_error(
|
253
|
+
end.should raise_error(rspec_unexpected)
|
254
254
|
end
|
255
255
|
end
|
256
256
|
end
|
@@ -282,13 +282,13 @@ describe Kelp::Visibility, "should_not_see_in_same_row" do
|
|
282
282
|
it "two strings are in the same row" do
|
283
283
|
lambda do
|
284
284
|
should_not_see_in_same_row ["Eric", "Edit"]
|
285
|
-
end.should raise_error(
|
285
|
+
end.should raise_error(rspec_unexpected)
|
286
286
|
end
|
287
287
|
|
288
288
|
it "two strings are in the same row within a given scope" do
|
289
289
|
lambda do
|
290
290
|
should_not_see_in_same_row ["Eric", "Edit"], :within => "#table_a"
|
291
|
-
end.should raise_error(
|
291
|
+
end.should raise_error(rspec_unexpected)
|
292
292
|
end
|
293
293
|
end
|
294
294
|
end
|
@@ -319,7 +319,7 @@ describe Kelp::Visibility, "page_should_contain" do
|
|
319
319
|
it "does not exist" do
|
320
320
|
lambda do
|
321
321
|
page_should_contain "Wazzup world"
|
322
|
-
end.should raise_error(
|
322
|
+
end.should raise_error(rspec_unexpected)
|
323
323
|
end
|
324
324
|
end
|
325
325
|
|
@@ -327,7 +327,7 @@ describe Kelp::Visibility, "page_should_contain" do
|
|
327
327
|
it "does not match" do
|
328
328
|
lambda do
|
329
329
|
page_should_contain /(Foo|Bar|Baz) world/
|
330
|
-
end.should raise_error(
|
330
|
+
end.should raise_error(rspec_unexpected)
|
331
331
|
end
|
332
332
|
end
|
333
333
|
|
@@ -365,20 +365,20 @@ describe Kelp::Visibility, "page_should_not_contain" do
|
|
365
365
|
it "exists" do
|
366
366
|
lambda do
|
367
367
|
page_should_not_contain "Hello world"
|
368
|
-
end.should raise_error(
|
368
|
+
end.should raise_error(rspec_unexpected)
|
369
369
|
lambda do
|
370
370
|
page_should_not_contain "Goodbye world"
|
371
|
-
end.should raise_error(
|
371
|
+
end.should raise_error(rspec_unexpected)
|
372
372
|
end
|
373
373
|
end
|
374
374
|
context "Regexp" do
|
375
375
|
it "matches" do
|
376
376
|
lambda do
|
377
377
|
page_should_not_contain /(Hello|Goodbye) world/
|
378
|
-
end.should raise_error(
|
378
|
+
end.should raise_error(rspec_unexpected)
|
379
379
|
lambda do
|
380
380
|
page_should_not_contain /\d\d\d-\d\d\d\d/
|
381
|
-
end.should raise_error(
|
381
|
+
end.should raise_error(rspec_unexpected)
|
382
382
|
end
|
383
383
|
end
|
384
384
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kelp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 11
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 8
|
10
|
+
version: 0.1.8
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Eric Pierce
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-04-
|
18
|
+
date: 2011-04-26 00:00:00 -06:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -120,7 +120,7 @@ dependencies:
|
|
120
120
|
version: "0"
|
121
121
|
type: :development
|
122
122
|
version_requirements: *id007
|
123
|
-
description: " Kelp is a collection of helper methods for Cucumber to ease the process of\n writing step definitions.\n"
|
123
|
+
description: " Kelp is a collection of helper methods for Cucumber to ease the process of\n writing step definitions. It also includes a Rails generator for generic\n step definitions building upon those helpers.\n"
|
124
124
|
email: wapcaplet88@gmail.com
|
125
125
|
executables: []
|
126
126
|
|