aslakhellesoy-cucumber 0.3.11.200907091518 → 0.3.90
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +19 -11
- data/Manifest.txt +1 -0
- data/examples/i18n/ko/features/addition.feature +5 -5
- data/examples/i18n/ko/features/step_definitons/calculator_steps.rb +1 -1
- data/examples/tickets/features/table_diffing.feature +13 -0
- data/features/cucumber_cli_diff_disabled.feature +2 -1
- data/features/html_formatter/a.html +2 -1
- data/features/table_diffing.feature +45 -0
- data/features/unicode_table.feature +35 -0
- data/lib/cucumber/version.rb +2 -2
- data/lib/cucumber/webrat/table_locator.rb +66 -0
- data/rails_generators/cucumber/templates/env.rb +1 -1
- data/rails_generators/cucumber/templates/webrat_steps.rb +17 -0
- data/spec/cucumber/ast/table_spec.rb +1 -0
- metadata +8 -4
data/History.txt
CHANGED
@@ -1,9 +1,10 @@
|
|
1
|
-
== 0.3.
|
1
|
+
== 0.3.90 2009-07-22
|
2
2
|
|
3
3
|
The Hot summer release
|
4
4
|
|
5
5
|
This is a hot summer in Norway, and Cucumbers are growing in abundance. To celebrate this we give you
|
6
|
-
a new release with
|
6
|
+
a new release with lots of new features and bugfixes. This is also one of the last releases in the 0.3 series
|
7
|
+
(hence the 0.3.90 number), so 0.4 (or maybe 1.0!) will be coming up soon. The highlights of this release are:
|
7
8
|
|
8
9
|
=== Egality
|
9
10
|
|
@@ -20,12 +21,12 @@ or default to English if no --language option was specified. A nice side effect
|
|
20
21
|
have features in several languages side by side and run them in the same cucumber. (Not recommended unless
|
21
22
|
you want to take polyglot programming to an extreme level).
|
22
23
|
|
23
|
-
=== Table diffing
|
24
|
+
=== Table diffing (experimental)
|
24
25
|
|
25
26
|
When you pass a table as an argument to your Then steps you often want to compare that table
|
26
27
|
to some actual values. In previous releases you had to iterate over the table's values and manually
|
27
28
|
compare each row using cell.should equal('foo') or assert_equal('foo', cell). If a discrepancy was found
|
28
|
-
you'd get an error
|
29
|
+
you'd get an error, but it was hard to see how the entire expected data set was different from the actual one.
|
29
30
|
|
30
31
|
With this release you have a much more powerful way to compare expected tables with actual data. An
|
31
32
|
Ast::Table object now has a new #diff!(table) method that you can invoke in your step definitions
|
@@ -33,11 +34,16 @@ that take table arguments. If the table you pass in is different from the expect
|
|
33
34
|
plain text step), Cucumber will print the difference for each of the row or column and fail your step.
|
34
35
|
|
35
36
|
The Table#diff! method expects an Array of Array, Array of Hash (similar to what you'd get from table#hashes)
|
36
|
-
or simply another Ast::Table object.
|
37
|
+
or simply another Ast::Table object. Here is a simple example:
|
37
38
|
|
38
|
-
|
39
|
+
Then /^I should see the following cukes:$/ do |expected_cukes_table|
|
40
|
+
actual_table = ... # For example [['Latin', 'English'], ['Cucumis sativus', 'Cucumber'], ['Cucumis anguria', 'Burr Gherkin']]
|
41
|
+
expected_cukes_table.diff!(actual_table)
|
42
|
+
end
|
43
|
+
|
44
|
+
As an extra bonus we provide Webrat users with a new #table_at(selector) method that you can use to transform
|
39
45
|
an HTML table into an Array of Array, so that you can easily compare the contents of your HTML table to
|
40
|
-
expected data passed to a step:
|
46
|
+
expected data passed to a step. Here is an example:
|
41
47
|
|
42
48
|
Then /^I should see the following cukes:$/ do |expected_cukes_table|
|
43
49
|
expected_cukes_table.diff!(table_at('#cuke_table').to_a)
|
@@ -49,7 +55,7 @@ database):
|
|
49
55
|
|
50
56
|
# This requires that you use the column names in the header of the plain text expected table
|
51
57
|
Then /^I should have the following cukes in the database:$/ do |expected_cukes_table|
|
52
|
-
expected_cukes_table.diff!(Cuke.find(:all).map(&attributes)
|
58
|
+
expected_cukes_table.diff!(Cuke.find(:all).map(&attributes))
|
53
59
|
end
|
54
60
|
|
55
61
|
=== Environment variables
|
@@ -62,12 +68,13 @@ like you can with Rake). Example:
|
|
62
68
|
You can now pick up ENV['FOO'] in ruby (for example in env.rb) and take actions according to the value,
|
63
69
|
for example enabling your super hack that validates all HTTP responses for XHTML validity.
|
64
70
|
|
65
|
-
This release also has several bugfixes related to --format and Before/
|
71
|
+
This release also has several bugfixes related to --format and Before/After hooks.
|
66
72
|
|
67
73
|
=== Bugfixes
|
74
|
+
* Fix some misspellings which affect test fail for Korean example (#373 Dongju Kim)
|
68
75
|
* Make it possible to write non-localized step definitions (#377 Aslak Hellesøy)
|
69
76
|
* Table cells containing unicode are rendered incorrectly (#386 Stefan Kanev)
|
70
|
-
* Before and After hooks run after everything is finished
|
77
|
+
* Before and After hooks run after everything is finished when there are 2+ --format options (#371 Aslak Hellesøy)
|
71
78
|
* When using --out and two --format the first is not delivered inline with execution of features (#361 Aslak Hellesøy)
|
72
79
|
* Profile Formatter broken (#370 Aslak Hellesøy)
|
73
80
|
* Default profile usage with --drb flag degrades gracefully with no server. (#367 Ben Mabey)
|
@@ -78,6 +85,7 @@ This release also has several bugfixes related to --format and Before/Adter hook
|
|
78
85
|
* Fixed bug with rake task raising errors with feature files with spaces (#380 Joseph Wilk)
|
79
86
|
|
80
87
|
=== New Features
|
88
|
+
* I should see should support regexes (#382 John Ferlito)
|
81
89
|
* Access to scenario outline name from After hook scenario parameter (#342 Aslak Hellesøy)
|
82
90
|
* Allow multiple --tags switches to be passed
|
83
91
|
* Load step definitions from vendored gems and plugins (#388 Mike Burns)
|
@@ -87,7 +95,7 @@ This release also has several bugfixes related to --format and Before/Adter hook
|
|
87
95
|
* Display failing scenarios at the end of pretty format to make it easier for people to play them back (#360 Ryan Bigg)
|
88
96
|
|
89
97
|
=== Changed Features
|
90
|
-
*
|
98
|
+
* When using --tags, positive tags are &&'ed while negative tags are ||'ed (John Wilger)
|
91
99
|
* The data returned from Table#hashes and similar methods are frozen. Dup if you need to modify. (Aslak Hellesøy)
|
92
100
|
* Visitor.visit_table_cell_value(value, col_width, status) is now visitor.visit_table_cell_value(value, status)
|
93
101
|
|
data/Manifest.txt
CHANGED
@@ -270,6 +270,7 @@ features/step_definitions/extra_steps.rb
|
|
270
270
|
features/steps_formatter.feature
|
271
271
|
features/support/env.rb
|
272
272
|
features/table_diffing.feature
|
273
|
+
features/unicode_table.feature
|
273
274
|
features/usage.feature
|
274
275
|
features/work_in_progress.feature
|
275
276
|
gem_tasks/deployment.rake
|
@@ -4,11 +4,11 @@
|
|
4
4
|
수학을 잘 못하는 사람으로써
|
5
5
|
두숫자의 합을 알고 싶다
|
6
6
|
|
7
|
-
|
8
|
-
조건 계산기에
|
9
|
-
그리고 계산기에
|
10
|
-
만일 내가
|
11
|
-
그러면 화면에 출력된 결과는
|
7
|
+
시나리오 개요: 두 숫자를 더하기
|
8
|
+
조건 계산기에 <입력1>을 입력했음
|
9
|
+
그리고 계산기에 <입력2>을 입력했음
|
10
|
+
만일 내가 <버튼>를 누르면
|
11
|
+
그러면 화면에 출력된 결과는 <결과>이다
|
12
12
|
|
13
13
|
예:
|
14
14
|
| 입력1 | 입력2 | 버튼 | 결과 |
|
@@ -0,0 +1,13 @@
|
|
1
|
+
@intentional_failure
|
2
|
+
Feature: Tables
|
3
|
+
Scenario: Extra row with table
|
4
|
+
Then the table should be different with table:
|
5
|
+
| a | b |
|
6
|
+
| one | two |
|
7
|
+
| three | four |
|
8
|
+
|
9
|
+
Scenario: Extra row and missing column with table
|
10
|
+
Then the table should be different with table:
|
11
|
+
| a | e | b |
|
12
|
+
| one | Q | two |
|
13
|
+
| three | R | four |
|
@@ -151,7 +151,8 @@ features/call_undefined_step_from_step_def.feature:4:in `Given a step definition
|
|
151
151
|
./features/step_definitions/sample_steps.rb:20:in `/^a step definition that calls an undefined step$/'
|
152
152
|
features/call_undefined_step_from_step_def.feature:7:in `Given call step "a step definition that calls an undefined step"'</pre></li></ol></div></div><div class="feature"><h2><span class="val">Feature: Failing expectation</span></h2><p class="narrative"></p><div class="scenario"><h3><span class="keyword">Scenario:</span> <span class="val">Failing expectation</span></h3><ol><li class="step failed" id="features_failing_expectation_feature_4"><div><span class="keyword">Given</span> <span class="step val">failing expectation</span></div><pre class="failed">expected: "that",
|
153
153
|
got: "this" (using ==)
|
154
|
-
|
154
|
+
|
155
|
+
Diff:
|
155
156
|
@@ -1,2 +1,2 @@
|
156
157
|
-that
|
157
158
|
+this
|
@@ -0,0 +1,45 @@
|
|
1
|
+
Feature: Table diffing
|
2
|
+
In order to more easily compare data in tables
|
3
|
+
step definition writers should be able to diff
|
4
|
+
a table with expected data and see the diff inline
|
5
|
+
|
6
|
+
Scenario: Extra row
|
7
|
+
Given a standard Cucumber project directory structure
|
8
|
+
And a file named "features/tables.feature" with:
|
9
|
+
"""
|
10
|
+
Feature: Tables
|
11
|
+
Scenario: Extra row
|
12
|
+
Then the table should be:
|
13
|
+
| x | y |
|
14
|
+
| a | b |
|
15
|
+
"""
|
16
|
+
And a file named "features/step_definitions/table_steps.rb" with:
|
17
|
+
"""
|
18
|
+
Then /the table should be:/ do |expected|
|
19
|
+
expected.diff!(table(%{
|
20
|
+
| x | y |
|
21
|
+
| a | c |
|
22
|
+
}))
|
23
|
+
end
|
24
|
+
"""
|
25
|
+
When I run cucumber -i features/tables.feature
|
26
|
+
Then it should fail with
|
27
|
+
"""
|
28
|
+
Feature: Tables
|
29
|
+
|
30
|
+
Scenario: Extra row # features/tables.feature:2
|
31
|
+
Then the table should be: # features/step_definitions/table_steps.rb:1
|
32
|
+
| x | y |
|
33
|
+
| a | b |
|
34
|
+
| a | c |
|
35
|
+
Tables were not identical (RuntimeError)
|
36
|
+
./features/step_definitions/table_steps.rb:2:in `/the table should be:/'
|
37
|
+
features/tables.feature:3:in `Then the table should be:'
|
38
|
+
|
39
|
+
Failing Scenarios:
|
40
|
+
cucumber features/tables.feature:2 # Scenario: Extra row
|
41
|
+
|
42
|
+
1 scenario (1 failed)
|
43
|
+
1 step (1 failed)
|
44
|
+
|
45
|
+
"""
|
@@ -0,0 +1,35 @@
|
|
1
|
+
Feature: Unicode in tables
|
2
|
+
In order to please the whole world,
|
3
|
+
unicode characters in tables should be
|
4
|
+
properly aligned
|
5
|
+
|
6
|
+
Scenario: All sorts of weird stuff
|
7
|
+
Given a standard Cucumber project directory structure
|
8
|
+
And a file named "features/unicode.feature" with:
|
9
|
+
"""
|
10
|
+
Feature: Featuring unicode
|
11
|
+
|
12
|
+
Scenario: So what, whatever
|
13
|
+
Given passing
|
14
|
+
| Brüno | abc |
|
15
|
+
| Bruno | æøå |
|
16
|
+
"""
|
17
|
+
And a file named "features/env.rb" with:
|
18
|
+
"""
|
19
|
+
$KCODE='u'
|
20
|
+
"""
|
21
|
+
When I run cucumber -q --dry-run features/unicode.feature
|
22
|
+
Then it should pass with
|
23
|
+
"""
|
24
|
+
Feature: Featuring unicode
|
25
|
+
|
26
|
+
Scenario: So what, whatever
|
27
|
+
Given passing
|
28
|
+
| Brüno | abc |
|
29
|
+
| Bruno | æøå |
|
30
|
+
|
31
|
+
1 scenario (1 undefined)
|
32
|
+
1 step (1 undefined)
|
33
|
+
|
34
|
+
"""
|
35
|
+
|
data/lib/cucumber/version.rb
CHANGED
@@ -2,8 +2,8 @@ module Cucumber #:nodoc:
|
|
2
2
|
class VERSION #:nodoc:
|
3
3
|
MAJOR = 0
|
4
4
|
MINOR = 3
|
5
|
-
TINY =
|
6
|
-
PATCH =
|
5
|
+
TINY = 90
|
6
|
+
PATCH = nil # Set to nil for official release
|
7
7
|
|
8
8
|
STRING = [MAJOR, MINOR, TINY, PATCH].compact.join('.')
|
9
9
|
end
|
@@ -0,0 +1,66 @@
|
|
1
|
+
module Webrat
|
2
|
+
class Table < Element
|
3
|
+
def self.xpath_search
|
4
|
+
".//table"
|
5
|
+
end
|
6
|
+
|
7
|
+
# Converts this Table element into a 2-dimensional array of String where each cell
|
8
|
+
# represents the inner_html of the <td> and <th> elements. The number of columns is
|
9
|
+
# determined by the number of cells in the first row.
|
10
|
+
def to_a
|
11
|
+
col_count = nil
|
12
|
+
Webrat::XML.css_search(@element, 'tr').map do |row|
|
13
|
+
cols = Webrat::XML.css_search(row, 'th,td')
|
14
|
+
col_count ||= cols.length
|
15
|
+
cols[0...col_count].map do |col|
|
16
|
+
col.inner_html
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
module Locators
|
23
|
+
class TableLocator < Locator
|
24
|
+
def locate
|
25
|
+
Table.load(@session, table_element)
|
26
|
+
end
|
27
|
+
|
28
|
+
def table_element
|
29
|
+
table_elements.detect do |table_element|
|
30
|
+
matches_id?(table_element) ||
|
31
|
+
matches_css_selector?(table_element)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def matches_id?(table_element)
|
36
|
+
Webrat::XML.attribute(table_element, "id") == @value.to_s
|
37
|
+
end
|
38
|
+
|
39
|
+
def matches_css_selector?(table_element)
|
40
|
+
Webrat::XML.css_at(@dom, @value)
|
41
|
+
end
|
42
|
+
|
43
|
+
def table_elements
|
44
|
+
Webrat::XML.xpath_search(@dom, *Table.xpath_search)
|
45
|
+
end
|
46
|
+
|
47
|
+
def error_message
|
48
|
+
"Could not find table matching '#{@value}'"
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
# Returns a Table element located by +id_or_selector+, which can
|
53
|
+
# be a DOM id or a CSS selector.
|
54
|
+
def table_at(id_or_selector)
|
55
|
+
TableLocator.new(@session, dom, id_or_selector).locate!
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
module Methods
|
60
|
+
delegate_to_session :table_at
|
61
|
+
end
|
62
|
+
|
63
|
+
class Session
|
64
|
+
def_delegators :current_scope, :table_at
|
65
|
+
end
|
66
|
+
end
|
@@ -15,6 +15,7 @@ Cucumber::Rails.use_transactional_fixtures
|
|
15
15
|
Cucumber::Rails.bypass_rescue
|
16
16
|
|
17
17
|
require 'webrat'
|
18
|
+
require 'cucumber/webrat/table_locator' # Lets you do table.diff!(table_at('#my_table').to_a)
|
18
19
|
|
19
20
|
Webrat.configure do |config|
|
20
21
|
config.mode = :rails
|
@@ -23,5 +24,4 @@ end
|
|
23
24
|
|
24
25
|
require 'cucumber/rails/rspec'
|
25
26
|
require 'webrat/core/matchers'
|
26
|
-
require 'cucumber/webrat/table_locator' # Lets you do table.diff!(table_at('#my_table').to_a)
|
27
27
|
<% end -%>
|
@@ -98,6 +98,15 @@ Then /^I should see "([^\"]*)"$/ do |text|
|
|
98
98
|
<% end -%>
|
99
99
|
end
|
100
100
|
|
101
|
+
Then /^I should see \/([^\/]*)\/$/ do |regexp|
|
102
|
+
regexp = Regexp.new(regexp)
|
103
|
+
<% if framework == :rspec -%>
|
104
|
+
response.should contain(regexp)
|
105
|
+
<% else -%>
|
106
|
+
assert_contain regexp
|
107
|
+
<% end -%>
|
108
|
+
end
|
109
|
+
|
101
110
|
Then /^I should not see "([^\"]*)"$/ do |text|
|
102
111
|
<% if framework == :rspec -%>
|
103
112
|
response.should_not contain(text)
|
@@ -106,6 +115,14 @@ Then /^I should not see "([^\"]*)"$/ do |text|
|
|
106
115
|
<% end -%>
|
107
116
|
end
|
108
117
|
|
118
|
+
Then /^I should not see \/([^\/]*)\/$/ do |regexp|
|
119
|
+
<% if framework == :rspec -%>
|
120
|
+
response.should_not contain(text)
|
121
|
+
<% else -%>
|
122
|
+
assert_not_contain text
|
123
|
+
<% end -%>
|
124
|
+
end
|
125
|
+
|
109
126
|
Then /^the "([^\"]*)" field should contain "([^\"]*)"$/ do |field, value|
|
110
127
|
<% if framework == :rspec -%>
|
111
128
|
field_labeled(field).value.should =~ /#{value}/
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aslakhellesoy-cucumber
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.90
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- "Aslak Helles\xC3\xB8y"
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-07-
|
12
|
+
date: 2009-07-22 00:00:00 -07:00
|
13
13
|
default_executable: cucumber
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -306,6 +306,7 @@ files:
|
|
306
306
|
- examples/tickets/features/step_definitons/248_steps.rb
|
307
307
|
- examples/tickets/features/step_definitons/scenario_outline_steps.rb
|
308
308
|
- examples/tickets/features/step_definitons/tickets_steps.rb
|
309
|
+
- examples/tickets/features/table_diffing.feature
|
309
310
|
- examples/tickets/features/tickets.feature
|
310
311
|
- examples/watir/README.textile
|
311
312
|
- examples/watir/Rakefile
|
@@ -335,6 +336,8 @@ files:
|
|
335
336
|
- features/step_definitions/extra_steps.rb
|
336
337
|
- features/steps_formatter.feature
|
337
338
|
- features/support/env.rb
|
339
|
+
- features/table_diffing.feature
|
340
|
+
- features/unicode_table.feature
|
338
341
|
- features/usage.feature
|
339
342
|
- features/work_in_progress.feature
|
340
343
|
- gem_tasks/deployment.rake
|
@@ -416,6 +419,7 @@ files:
|
|
416
419
|
- lib/cucumber/step_match.rb
|
417
420
|
- lib/cucumber/step_mother.rb
|
418
421
|
- lib/cucumber/version.rb
|
422
|
+
- lib/cucumber/webrat/table_locator.rb
|
419
423
|
- lib/cucumber/world.rb
|
420
424
|
- rails_generators/cucumber/USAGE
|
421
425
|
- rails_generators/cucumber/cucumber_generator.rb
|
@@ -475,7 +479,7 @@ files:
|
|
475
479
|
- spec/cucumber/world/pending_spec.rb
|
476
480
|
- spec/spec.opts
|
477
481
|
- spec/spec_helper.rb
|
478
|
-
has_rdoc:
|
482
|
+
has_rdoc: false
|
479
483
|
homepage: http://cukes.info
|
480
484
|
post_install_message:
|
481
485
|
rdoc_options:
|
@@ -500,7 +504,7 @@ requirements: []
|
|
500
504
|
rubyforge_project: rspec
|
501
505
|
rubygems_version: 1.2.0
|
502
506
|
signing_key:
|
503
|
-
specification_version:
|
507
|
+
specification_version: 3
|
504
508
|
summary: Executable Feature scenarios
|
505
509
|
test_files: []
|
506
510
|
|