aslakhellesoy-cucumber 0.1.99.22 → 0.1.99.23
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/History.txt +5 -1
- data/Manifest.txt +7 -1
- data/examples/i18n/ar/features/addition.feature +10 -11
- data/examples/i18n/ar/features/step_definitons/calculator_steps.rb +0 -4
- data/examples/i18n/et/features/liitmine.feature +2 -3
- data/examples/i18n/et/features/step_definitions/kalkulaator_steps.rb +3 -3
- data/examples/i18n/et/lib/kalkulaator.rb +5 -1
- data/examples/i18n/ru/Rakefile +6 -0
- data/examples/i18n/ru/features/addition.feature +10 -0
- data/examples/i18n/ru/features/consecutive_calculations.feature +16 -0
- data/examples/i18n/ru/features/division.feature +15 -0
- data/examples/i18n/ru/features/step_definitons/calculator_steps.rb +19 -0
- data/examples/i18n/ru/features/support/env.rb +6 -0
- data/examples/i18n/ru/features/support/world.rb +7 -0
- data/examples/i18n/ru/lib/calculator.rb +24 -0
- data/examples/self_test/features/failing_expectation.feature +4 -0
- data/examples/sinatra/features/step_definitions/add_steps.rb +1 -1
- data/examples/sinatra/features/support/env.rb +4 -4
- data/features/cucumber_cli.feature +18 -0
- data/features/cucumber_cli_diff_disabled.feature +45 -0
- data/lib/cucumber/ast/table.rb +64 -11
- data/lib/cucumber/cli/main.rb +1 -1
- data/lib/cucumber/languages.yml +10 -2
- data/lib/cucumber/rake/task.rb +3 -3
- data/lib/cucumber/version.rb +1 -1
- data/spec/cucumber/ast/table_spec.rb +35 -4
- data/spec/cucumber/cli/main_spec.rb +1 -1
- data/spec/cucumber/formatter/color_io_spec.rb +26 -0
- metadata +13 -2
- data/examples/selenium/features/step_definitons/stories_steps.rb +0 -40
data/History.txt
CHANGED
@@ -79,6 +79,8 @@ pure Ruby users have been enjoying for a while.
|
|
79
79
|
** Full jar and simple jar
|
80
80
|
|
81
81
|
== Bugfixes
|
82
|
+
* --strict always exits with status 1 (#230 Tim Cuthbertson)
|
83
|
+
* Fix error with nil values in tables raising an exception (#227 Joseph Wilk)
|
82
84
|
* Add support for using << in formatters to ensure the html formatter works (#210 Joseph Wilk)
|
83
85
|
* Explicitly require env.rb files first to avoid potential load order problems. (#213, Ben Mabey, Randy Harmon)
|
84
86
|
* Depend on polyglot version (0.2.4) to avoid masking require errors. (Aslak Hellesøy).
|
@@ -94,9 +96,11 @@ pure Ruby users have been enjoying for a while.
|
|
94
96
|
* Pending steps in > steps called from steps (#65 Aslak Hellesøy)
|
95
97
|
|
96
98
|
=== New features
|
99
|
+
* Added Table#transpose to to allow use of vertically aligned table keys (Torbjørn Vatn, Aslak Hellesøy)
|
100
|
+
* Added Table#map_headers to to allow use of more readable headers (Rob Holland)
|
97
101
|
* New -S/--step-definitions option. Useful (among other things) for tools that implement automcompletion. (#208 Aslak Hellesøy).
|
98
102
|
* The cucumber.rake file defines a dummy :features task if Cucumber is not installed (#225 Josh Nichols)
|
99
|
-
* Added map_column to AST tables to ease casting of cell values into relevant types (#223 Rob Holland)
|
103
|
+
* Added map_column! to AST tables to ease casting of cell values into relevant types (#223 Rob Holland)
|
100
104
|
Given /^an expense report for (.*) with the following posts:$/ do |date, posts_table|
|
101
105
|
posts_table.map_column!('amount') { |a| a.to_i }
|
102
106
|
posts_table.hashes.each do |post|
|
data/Manifest.txt
CHANGED
@@ -40,6 +40,7 @@ examples/i18n/es/features/adicion.feature
|
|
40
40
|
examples/i18n/es/features/step_definitons/calculador_steps.rb
|
41
41
|
examples/i18n/es/lib/calculador.rb
|
42
42
|
examples/i18n/et/Rakefile
|
43
|
+
examples/i18n/et/features/jagamine.feature
|
43
44
|
examples/i18n/et/features/liitmine.feature
|
44
45
|
examples/i18n/et/features/step_definitions/kalkulaator_steps.rb
|
45
46
|
examples/i18n/et/lib/kalkulaator.rb
|
@@ -128,7 +129,12 @@ examples/jbehave/src/main/java/cukes/jbehave/examples/trader/persistence/TraderP
|
|
128
129
|
examples/jbehave/src/main/java/cukes/jbehave/examples/trader/scenarios/TraderSteps.java
|
129
130
|
examples/selenium/Rakefile
|
130
131
|
examples/selenium/features/search.feature
|
131
|
-
examples/selenium/features/step_definitons/
|
132
|
+
examples/selenium/features/step_definitons/search_steps.rb
|
133
|
+
examples/selenium/features/support/env.rb
|
134
|
+
examples/selenium_webrat/Rakefile
|
135
|
+
examples/selenium_webrat/features/search.feature
|
136
|
+
examples/selenium_webrat/features/step_definitons/search_steps.rb
|
137
|
+
examples/selenium_webrat/features/support/env.rb
|
132
138
|
examples/self_test/README.textile
|
133
139
|
examples/self_test/Rakefile
|
134
140
|
examples/self_test/features/background/failing_background.feature
|
@@ -3,15 +3,14 @@
|
|
3
3
|
كشخص غبي في الرياضيات
|
4
4
|
اريد معرفة ناتج جمع عددين
|
5
5
|
|
6
|
-
|
7
|
-
بفرض كتابة
|
8
|
-
و كتابة
|
9
|
-
متى يتم الضغط على
|
10
|
-
اذاً يظهر
|
11
|
-
و الناتج يجب ان يكون Fixnum
|
6
|
+
سيناريو مخطط: جمع عددين
|
7
|
+
بفرض كتابة <input_1> في الآلة الحاسبة
|
8
|
+
و كتابة <input_2> في الآلة الحاسبة
|
9
|
+
متى يتم الضغط على <button>
|
10
|
+
اذاً يظهر <output> على الشاشة
|
12
11
|
|
13
|
-
|
14
|
-
| input_1 | input_2 | button | output |
|
15
|
-
| 20 | 30 | جمع | 50 |
|
16
|
-
| 2 | 5 | جمع | 7 |
|
17
|
-
| 0 | 40 | جمع | 40 |
|
12
|
+
امثلة:
|
13
|
+
| input_1 | input_2 | button | output |
|
14
|
+
| 20 | 30 | جمع | 50 |
|
15
|
+
| 2 | 5 | جمع | 7 |
|
16
|
+
| 0 | 40 | جمع | 40 |
|
@@ -3,14 +3,13 @@ Omadus: Liitmine
|
|
3
3
|
Olles matemaatika-puupea
|
4
4
|
Tahan et mulle öeldaks kahe numbri summa
|
5
5
|
|
6
|
-
|
7
|
-
Scenario Outline: Liida kaks numbrit
|
6
|
+
Raamstsenaarium: Liida kaks numbrit
|
8
7
|
Eeldades et olen sisestanud kalkulaatorisse numbri <input_1>
|
9
8
|
Ja olen sisestanud kalkulaatorisse numbri <input_2>
|
10
9
|
Kui ma vajutan <button>
|
11
10
|
Siis vastuseks peab ekraanil kuvatama <output>
|
12
11
|
|
13
|
-
|
12
|
+
Juhtumid:
|
14
13
|
| input_1 | input_2 | button | output |
|
15
14
|
| 20 | 30 | liida | 50 |
|
16
15
|
| 2 | 5 | liida | 7 |
|
@@ -15,10 +15,10 @@ Given /olen sisestanud kalkulaatorisse numbri (\d+)/ do |n|
|
|
15
15
|
@calc.push n.to_i
|
16
16
|
end
|
17
17
|
|
18
|
-
When /ma vajutan (
|
18
|
+
When /ma vajutan (\w+)/ do |op|
|
19
19
|
@result = @calc.send op
|
20
20
|
end
|
21
21
|
|
22
|
-
Then /vastuseks peab ekraanil kuvatama (
|
23
|
-
@result.should == result.
|
22
|
+
Then /vastuseks peab ekraanil kuvatama (.*)/ do |result|
|
23
|
+
@result.should == result.to_f
|
24
24
|
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
Функционал: Сложение чисел
|
2
|
+
Чтобы не складывать в уме
|
3
|
+
Все, у кого с этим туго
|
4
|
+
Хотят автоматическое сложение целых чисел
|
5
|
+
|
6
|
+
Сценарий: Сложение двух целых чисел
|
7
|
+
Допустим я ввожу число 50
|
8
|
+
И затем ввожу число 70
|
9
|
+
Если я нажимаю "+"
|
10
|
+
То результатом должно быть число 120
|
@@ -0,0 +1,16 @@
|
|
1
|
+
Функционал: Последовательные вычисления
|
2
|
+
Чтобы вычислять сложные выражения
|
3
|
+
Пользователи хотят проводить вычисления над результатом предыдущей операций
|
4
|
+
|
5
|
+
Предыстория:
|
6
|
+
Допустим я сложил 3 и 5
|
7
|
+
|
8
|
+
Сценарий: сложение с результатом последней операций
|
9
|
+
Если я ввожу число 4
|
10
|
+
И нажимаю "+"
|
11
|
+
То результатом должно быть число 12
|
12
|
+
|
13
|
+
Сценарий: деление результата последней операции
|
14
|
+
Если я ввожу число 2
|
15
|
+
И нажимаю "/"
|
16
|
+
То результатом должно быть число 4
|
@@ -0,0 +1,15 @@
|
|
1
|
+
Функционал: Деление чисел
|
2
|
+
Поскольку деление сложный процесс и люди часто допускают ошибки
|
3
|
+
Нужно дать им возможность делить на калькуляторе
|
4
|
+
|
5
|
+
Структура сценария: Целочисленное деление
|
6
|
+
Допустим я ввожу число <делимое>
|
7
|
+
И затем ввожу число <делитель>
|
8
|
+
Если я нажимаю "/"
|
9
|
+
То результатом должно быть число <частное>
|
10
|
+
|
11
|
+
Значения:
|
12
|
+
| делимое | делитель | частное |
|
13
|
+
| 100 | 2 | 50 |
|
14
|
+
| 28 | 7 | 4 |
|
15
|
+
| 0 | 5 | 0 |
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
Допустим /ввожу число (\d+)/ do |число|
|
4
|
+
calc.push число.to_i
|
5
|
+
end
|
6
|
+
|
7
|
+
Если /нажимаю "(.*)"/ do |операция|
|
8
|
+
calc.send операция
|
9
|
+
end
|
10
|
+
|
11
|
+
То /результатом должно быть число (\d+)/ do |результат|
|
12
|
+
calc.result.should == результат.to_f
|
13
|
+
end
|
14
|
+
|
15
|
+
Допустим /я сложил (\d+) и (\d+)/ do |слагаемое1, слагаемое2|
|
16
|
+
Допустим %{я ввожу число #{слагаемое1}}
|
17
|
+
Допустим %{затем ввожу число #{слагаемое2}}
|
18
|
+
Допустим %{я нажимаю "+"}
|
19
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
class Calculator
|
4
|
+
def initialize
|
5
|
+
@stack = []
|
6
|
+
end
|
7
|
+
|
8
|
+
def push(arg)
|
9
|
+
@stack.push arg
|
10
|
+
end
|
11
|
+
|
12
|
+
def result
|
13
|
+
@stack.last
|
14
|
+
end
|
15
|
+
|
16
|
+
def +
|
17
|
+
@stack.push @stack.pop + @stack.pop
|
18
|
+
end
|
19
|
+
|
20
|
+
def /
|
21
|
+
divisor, dividend = [@stack.pop, @stack.pop] # Hm, @stack.pop(2) doesn't work
|
22
|
+
@stack.push dividend / divisor
|
23
|
+
end
|
24
|
+
end
|
@@ -13,8 +13,8 @@ Webrat.configure do |config|
|
|
13
13
|
end
|
14
14
|
|
15
15
|
World do
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
16
|
+
session = Webrat::SinatraSession.new
|
17
|
+
session.extend(Webrat::Matchers)
|
18
|
+
session.extend(Webrat::HaveTagMatcher)
|
19
|
+
session
|
20
20
|
end
|
@@ -36,6 +36,24 @@ Feature: Cucumber command line
|
|
36
36
|
|
37
37
|
"""
|
38
38
|
|
39
|
+
Scenario: Succeed with --strict
|
40
|
+
When I run cucumber -q features/sample.feature:9 --strict
|
41
|
+
Then it should pass with
|
42
|
+
"""
|
43
|
+
@one
|
44
|
+
Feature: Sample
|
45
|
+
|
46
|
+
@three
|
47
|
+
Scenario: Passing
|
48
|
+
Given passing
|
49
|
+
| a | b |
|
50
|
+
| c | d |
|
51
|
+
|
52
|
+
1 scenario
|
53
|
+
1 passed step
|
54
|
+
|
55
|
+
"""
|
56
|
+
|
39
57
|
Scenario: Specify 2 line numbers where one is a tag
|
40
58
|
When I run cucumber -q features/sample.feature:5:14
|
41
59
|
Then it should fail with
|
@@ -0,0 +1,45 @@
|
|
1
|
+
Feature: Cucumber command line
|
2
|
+
In order to write better software
|
3
|
+
Developers should be able to execute requirements as tests
|
4
|
+
|
5
|
+
Scenario: Run single failing scenario with default diff enabled
|
6
|
+
When I run cucumber -q features/failing_expectation.feature
|
7
|
+
Then it should fail with
|
8
|
+
"""
|
9
|
+
Feature: Failing expectation
|
10
|
+
|
11
|
+
Scenario: Failing expectation
|
12
|
+
Given failing expectation
|
13
|
+
expected: "that",
|
14
|
+
got: "this" (using ==)
|
15
|
+
Diff:
|
16
|
+
@@ -1,2 +1,2 @@
|
17
|
+
-that
|
18
|
+
+this
|
19
|
+
(Spec::Expectations::ExpectationNotMetError)
|
20
|
+
./features/step_definitions/sample_steps.rb:63:in `/^failing expectation$/'
|
21
|
+
features/failing_expectation.feature:4:in `Given failing expectation'
|
22
|
+
|
23
|
+
1 scenario
|
24
|
+
1 failed step
|
25
|
+
|
26
|
+
"""
|
27
|
+
|
28
|
+
Scenario: Run single failing scenario with diff output disabled
|
29
|
+
When I run cucumber -q --no-diff features/failing_expectation.feature
|
30
|
+
Then it should fail with
|
31
|
+
"""
|
32
|
+
Feature: Failing expectation
|
33
|
+
|
34
|
+
Scenario: Failing expectation
|
35
|
+
Given failing expectation
|
36
|
+
expected: "that",
|
37
|
+
got: "this" (using ==) (Spec::Expectations::ExpectationNotMetError)
|
38
|
+
./features/step_definitions/sample_steps.rb:63:in `/^failing expectation$/'
|
39
|
+
features/failing_expectation.feature:4:in `Given failing expectation'
|
40
|
+
|
41
|
+
1 scenario
|
42
|
+
1 failed step
|
43
|
+
|
44
|
+
"""
|
45
|
+
|
data/lib/cucumber/ast/table.rb
CHANGED
@@ -8,26 +8,37 @@ module Cucumber
|
|
8
8
|
# This gets parsed into a Table holding the values <tt>[['a', 'b'], ['c', 'd']]</tt>
|
9
9
|
#
|
10
10
|
class Table
|
11
|
+
NULL_CONVERSIONS = Hash.new(lambda{ |cell_value| cell_value }).freeze
|
12
|
+
|
11
13
|
attr_accessor :file
|
12
14
|
|
13
|
-
def initialize(raw)
|
15
|
+
def initialize(raw, conversions = NULL_CONVERSIONS.dup)
|
14
16
|
# Verify that it's square
|
15
17
|
raw.transpose
|
16
18
|
@raw = raw
|
17
19
|
@cells_class = Cells
|
18
20
|
@cell_class = Cell
|
19
|
-
@conversion_procs =
|
21
|
+
@conversion_procs = conversions
|
20
22
|
end
|
21
23
|
|
22
|
-
|
23
|
-
|
24
|
+
# Creates a copy of this table, inheriting the column mappings.
|
25
|
+
def dup
|
26
|
+
self.class.new(@raw.dup, @conversion_procs.dup)
|
24
27
|
end
|
25
28
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
29
|
+
# Returns a new, transposed table. Example:
|
30
|
+
#
|
31
|
+
# | a | 7 | 4 |
|
32
|
+
# | b | 9 | 2 |
|
33
|
+
#
|
34
|
+
# Gets converted into the following:
|
35
|
+
#
|
36
|
+
# | a | b |
|
37
|
+
# | 7 | 9 |
|
38
|
+
# | 4 | 2 |
|
39
|
+
#
|
40
|
+
def transpose
|
41
|
+
self.class.new(@raw.transpose, @conversion_procs.dup)
|
31
42
|
end
|
32
43
|
|
33
44
|
# Converts this table into an Array of Hash where the keys of each
|
@@ -73,15 +84,45 @@ module Cucumber
|
|
73
84
|
cells_rows.each(&proc)
|
74
85
|
end
|
75
86
|
|
87
|
+
def at_lines?(lines)
|
88
|
+
cells_rows.detect { |row| row.at_lines?(lines) }
|
89
|
+
end
|
90
|
+
|
91
|
+
def accept(visitor, status)
|
92
|
+
cells_rows.each do |row|
|
93
|
+
visitor.visit_table_row(row, status)
|
94
|
+
end
|
95
|
+
nil
|
96
|
+
end
|
97
|
+
|
76
98
|
# For testing only
|
77
99
|
def to_sexp #:nodoc:
|
78
100
|
[:table, *cells_rows.map{|row| row.to_sexp}]
|
79
101
|
end
|
80
102
|
|
103
|
+
# Returns a new Table where the headers are redefined. This makes it
|
104
|
+
# possible to use prettier header names in the features. Example:
|
105
|
+
#
|
106
|
+
# | Phone Number | Address |
|
107
|
+
# | 123456 | xyz |
|
108
|
+
# | 345678 | abc |
|
109
|
+
#
|
110
|
+
# A StepDefinition receiving this table can then map the columns:
|
111
|
+
#
|
112
|
+
# mapped_table = table.map_columns('Phone Number' => :phone, 'Address' => :address)
|
113
|
+
# hashes = mapped_table.hashes
|
114
|
+
# # => [{:phone => '123456', :address => 'xyz'}, {:phone => '345678', :address => 'abc'}]
|
115
|
+
#
|
116
|
+
def map_headers(mappings)
|
117
|
+
table = self.dup
|
118
|
+
table.map_headers!(mappings)
|
119
|
+
table
|
120
|
+
end
|
121
|
+
|
81
122
|
# Change how #hashes converts column values. The +column_name+ argument identifies the column
|
82
123
|
# and +conversion_proc+ performs the conversion for each cell in that column. If +strict+ is
|
83
124
|
# true, an error will be raised if the column named +column_name+ is not found. If +strict+
|
84
|
-
# is false, no error will be raised.
|
125
|
+
# is false, no error will be raised.
|
85
126
|
def map_column!(column_name, strict=true, &conversion_proc)
|
86
127
|
verify_column(column_name) if strict
|
87
128
|
@conversion_procs[column_name] = conversion_proc
|
@@ -111,7 +152,7 @@ module Cucumber
|
|
111
152
|
row.map do |cell|
|
112
153
|
cell_with_replaced_args = cell
|
113
154
|
arguments.each do |name, value|
|
114
|
-
cell_with_replaced_args = value ? cell_with_replaced_args.gsub(name, value) : nil
|
155
|
+
cell_with_replaced_args = value && !cell.nil? ? cell_with_replaced_args.gsub(name, value) : nil
|
115
156
|
end
|
116
157
|
cell_with_replaced_args
|
117
158
|
end
|
@@ -124,6 +165,18 @@ module Cucumber
|
|
124
165
|
cells_rows.detect{|row| row.at_lines?(lines)}
|
125
166
|
end
|
126
167
|
|
168
|
+
protected
|
169
|
+
|
170
|
+
def map_headers!(mappings)
|
171
|
+
headers = @raw[0]
|
172
|
+
mappings.each_pair do |pre, post|
|
173
|
+
headers[headers.index(pre)] = post
|
174
|
+
if @conversion_procs.has_key?(pre)
|
175
|
+
@conversion_procs[post] = @conversion_procs.delete(pre)
|
176
|
+
end
|
177
|
+
end
|
178
|
+
end
|
179
|
+
|
127
180
|
private
|
128
181
|
|
129
182
|
def col_width(col)
|
data/lib/cucumber/cli/main.rb
CHANGED
@@ -46,7 +46,7 @@ module Cucumber
|
|
46
46
|
visitor = configuration.build_formatter_broadcaster(step_mother)
|
47
47
|
visitor.visit_features(features)
|
48
48
|
|
49
|
-
failure = features.steps[:failed].any? || (configuration.strict? && features.steps[:undefined].
|
49
|
+
failure = features.steps[:failed].any? || (configuration.strict? && features.steps[:undefined].any?)
|
50
50
|
Kernel.exit(failure ? 1 : 0)
|
51
51
|
end
|
52
52
|
|
data/lib/cucumber/languages.yml
CHANGED
@@ -31,10 +31,13 @@
|
|
31
31
|
native: العربية
|
32
32
|
encoding: UTF-8
|
33
33
|
feature: خاصية
|
34
|
+
background: الخلفية
|
34
35
|
scenario: سيناريو
|
36
|
+
scenario_outline: سيناريو مخطط
|
37
|
+
examples: امثلة
|
35
38
|
given: بفرض
|
36
|
-
when:
|
37
|
-
then:
|
39
|
+
when: متى|عندما
|
40
|
+
then: اذاً|ثم
|
38
41
|
and: و
|
39
42
|
but: لكن
|
40
43
|
"cy":
|
@@ -110,6 +113,7 @@
|
|
110
113
|
native: Texan
|
111
114
|
encoding: UTF-8
|
112
115
|
feature: Feature
|
116
|
+
background: Background
|
113
117
|
scenario: Scenario
|
114
118
|
scenario_outline: Scenario Outline
|
115
119
|
examples: Examples
|
@@ -137,7 +141,10 @@
|
|
137
141
|
native: eesti keel
|
138
142
|
encoding: UTF-8
|
139
143
|
feature: Omadus
|
144
|
+
background: Taust
|
140
145
|
scenario: Stsenaarium
|
146
|
+
scenario_outline: Raamstsenaarium
|
147
|
+
examples: Juhtumid
|
141
148
|
given: Eeldades
|
142
149
|
when: Kui
|
143
150
|
then: Siis
|
@@ -148,6 +155,7 @@
|
|
148
155
|
native: suomi
|
149
156
|
encoding: UTF-8
|
150
157
|
feature: Ominaisuus
|
158
|
+
background: Tausta
|
151
159
|
scenario: Tapaus
|
152
160
|
scenario_outline: Tapausaihio
|
153
161
|
examples: Tapaukset
|
data/lib/cucumber/rake/task.rb
CHANGED
@@ -28,14 +28,14 @@ module Cucumber
|
|
28
28
|
class Task
|
29
29
|
LIB = File.expand_path(File.dirname(__FILE__) + '/../..') # :nodoc:
|
30
30
|
|
31
|
-
# Directories to add to the
|
31
|
+
# Directories to add to the Ruby $LOAD_PATH
|
32
32
|
attr_accessor :libs
|
33
33
|
# Name of the cucumber binary to use for running features. Defaults to Cucumber::BINARY
|
34
34
|
attr_accessor :binary
|
35
|
-
# Array of paths to specific
|
35
|
+
# Array of paths to specific step definition files to use
|
36
36
|
attr_accessor :step_list
|
37
37
|
# File pattern for finding step definitions. Defaults to
|
38
|
-
# 'features/**/*.rb'.
|
38
|
+
# 'features/**/*.rb'.
|
39
39
|
attr_accessor :step_pattern
|
40
40
|
# Array of paths to specific features to run.
|
41
41
|
attr_accessor :feature_list
|
data/lib/cucumber/version.rb
CHANGED
@@ -9,9 +9,6 @@ module Cucumber
|
|
9
9
|
%w{one four seven},
|
10
10
|
%w{4444 55555 666666}
|
11
11
|
])
|
12
|
-
@table.extend(Module.new{
|
13
|
-
attr_reader :raw
|
14
|
-
})
|
15
12
|
def @table.cells_rows; super; end
|
16
13
|
def @table.columns; super; end
|
17
14
|
end
|
@@ -60,6 +57,30 @@ module Cucumber
|
|
60
57
|
}.should raise_error('The column named "two" does not exist')
|
61
58
|
end
|
62
59
|
|
60
|
+
describe ".transpose" do
|
61
|
+
before(:each) do
|
62
|
+
@table = Table.new([
|
63
|
+
%w{one 1111},
|
64
|
+
%w{two 22222}
|
65
|
+
])
|
66
|
+
end
|
67
|
+
|
68
|
+
it "should be convertible in to an array where each row is a hash" do
|
69
|
+
@table.transpose.hashes[0].should == {'one' => '1111', 'two' => '22222'}
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
it "should allow renaming columns" do
|
74
|
+
table2 = @table.map_headers('one' => :three)
|
75
|
+
table2.hashes.first[:three].should == '4444'
|
76
|
+
end
|
77
|
+
|
78
|
+
it "should copy column mappings when mapping headers" do
|
79
|
+
@table.map_column!('one') { |v| v.to_i }
|
80
|
+
table2 = @table.map_headers('one' => 'three')
|
81
|
+
table2.hashes.first['three'].should == 4444
|
82
|
+
end
|
83
|
+
|
63
84
|
describe "replacing arguments" do
|
64
85
|
|
65
86
|
before(:each) do
|
@@ -83,11 +104,21 @@ module Cucumber
|
|
83
104
|
end
|
84
105
|
|
85
106
|
it "should not change the original table" do
|
86
|
-
|
107
|
+
@table.arguments_replaced({'<book>' => 'Unbearable lightness of being'})
|
87
108
|
|
88
109
|
@table.hashes[0]['book'].should_not == 'Unbearable lightness of being'
|
89
110
|
end
|
90
111
|
|
112
|
+
it "should not raise an error when there are nil values in the table" do
|
113
|
+
table = Table.new([
|
114
|
+
['book'],
|
115
|
+
[nil]
|
116
|
+
])
|
117
|
+
lambda{
|
118
|
+
table.arguments_replaced({'<book>' => 'The great sheep chase'})
|
119
|
+
}.should_not raise_error
|
120
|
+
end
|
121
|
+
|
91
122
|
end
|
92
123
|
|
93
124
|
it "should convert to sexp" do
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../../spec_helper'
|
2
|
+
|
3
|
+
module Cucumber
|
4
|
+
module Formatter
|
5
|
+
describe ColorIO do
|
6
|
+
describe "<<" do
|
7
|
+
it "should convert to a print using kernel" do
|
8
|
+
color_io = ColorIO.new
|
9
|
+
|
10
|
+
Kernel.should_receive(:print).with("monkeys")
|
11
|
+
|
12
|
+
color_io << "monkeys"
|
13
|
+
end
|
14
|
+
|
15
|
+
it "should allow chained <<" do
|
16
|
+
color_io = ColorIO.new
|
17
|
+
|
18
|
+
Kernel.should_receive(:print).with("monkeys")
|
19
|
+
Kernel.should_receive(:print).with(" are tasty")
|
20
|
+
|
21
|
+
color_io << "monkeys" << " are tasty"
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
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.1.99.
|
4
|
+
version: 0.1.99.23
|
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-03-
|
12
|
+
date: 2009-03-13 00:00:00 -07:00
|
13
13
|
default_executable: cucumber
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -176,6 +176,14 @@ files:
|
|
176
176
|
- examples/i18n/ro/features/step_definitons/calculator_steps.rb
|
177
177
|
- examples/i18n/ro/features/suma.feature
|
178
178
|
- examples/i18n/ro/lib/calculator.rb
|
179
|
+
- examples/i18n/ru/Rakefile
|
180
|
+
- examples/i18n/ru/features/addition.feature
|
181
|
+
- examples/i18n/ru/features/consecutive_calculations.feature
|
182
|
+
- examples/i18n/ru/features/division.feature
|
183
|
+
- examples/i18n/ru/features/step_definitons/calculator_steps.rb
|
184
|
+
- examples/i18n/ru/features/support/env.rb
|
185
|
+
- examples/i18n/ru/features/support/world.rb
|
186
|
+
- examples/i18n/ru/lib/calculator.rb
|
179
187
|
- examples/i18n/se/Rakefile
|
180
188
|
- examples/i18n/se/features/step_definitons/kalkulator_steps.rb
|
181
189
|
- examples/i18n/se/features/summering.feature
|
@@ -218,6 +226,7 @@ files:
|
|
218
226
|
- examples/self_test/features/background/scenario_outline_failing_background.feature
|
219
227
|
- examples/self_test/features/background/scenario_outline_passing_background.feature
|
220
228
|
- examples/self_test/features/call_undefined_step_from_step_def.feature
|
229
|
+
- examples/self_test/features/failing_expectation.feature
|
221
230
|
- examples/self_test/features/lots_of_undefined.feature
|
222
231
|
- examples/self_test/features/outline_sample.feature
|
223
232
|
- examples/self_test/features/sample.feature
|
@@ -254,6 +263,7 @@ files:
|
|
254
263
|
- examples/watir/features/support/env.rb
|
255
264
|
- features/background.feature
|
256
265
|
- features/cucumber_cli.feature
|
266
|
+
- features/cucumber_cli_diff_disabled.feature
|
257
267
|
- features/cucumber_cli_outlines.feature
|
258
268
|
- features/custom_formatter.feature
|
259
269
|
- features/report_called_undefined_steps.feature
|
@@ -356,6 +366,7 @@ files:
|
|
356
366
|
- spec/cucumber/core_ext/proc_spec.rb
|
357
367
|
- spec/cucumber/core_ext/string_spec.rb
|
358
368
|
- spec/cucumber/formatter/ansicolor_spec.rb
|
369
|
+
- spec/cucumber/formatter/color_io_spec.rb
|
359
370
|
- spec/cucumber/formatter/html/cucumber.css
|
360
371
|
- spec/cucumber/formatter/html/cucumber.js
|
361
372
|
- spec/cucumber/formatter/html/index.html
|
@@ -1,40 +0,0 @@
|
|
1
|
-
require 'spec/expectations'
|
2
|
-
require 'selenium'
|
3
|
-
|
4
|
-
class GoogleSearch
|
5
|
-
def initialize(browser)
|
6
|
-
@browser = browser
|
7
|
-
end
|
8
|
-
|
9
|
-
def goto
|
10
|
-
@browser.open 'http://www.google.com/'
|
11
|
-
end
|
12
|
-
|
13
|
-
def search(text)
|
14
|
-
@browser.type('q',text)
|
15
|
-
@browser.click 'btnG'
|
16
|
-
@browser.wait_for_page_to_load
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
Before do
|
21
|
-
@browser = Selenium::SeleniumDriver.new("localhost", 4444, "*chrome", "http://localhost", 15000)
|
22
|
-
@browser.start
|
23
|
-
end
|
24
|
-
|
25
|
-
After do
|
26
|
-
@browser.stop
|
27
|
-
end
|
28
|
-
|
29
|
-
Given 'I am on the Google search page' do
|
30
|
-
@page = GoogleSearch.new(@browser)
|
31
|
-
@page.goto
|
32
|
-
end
|
33
|
-
|
34
|
-
When /I search for "(.*)"/ do |query|
|
35
|
-
@page.search(query)
|
36
|
-
end
|
37
|
-
|
38
|
-
Then /I should see a link to (.*)/ do |expected_url|
|
39
|
-
@browser.is_element_present("css=a[href='#{expected_url}']").should be_true
|
40
|
-
end
|