cucumber 2.0.0.rc.3 → 2.0.0.rc.4
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.
- checksums.yaml +4 -4
- data/History.md +13 -0
- data/cucumber.gemspec +2 -2
- data/features/docs/cli/run_specific_scenarios.feature +17 -0
- data/features/docs/defining_steps/snippets.feature +15 -0
- data/features/docs/extending_cucumber/custom_filter.feature +29 -0
- data/lib/cucumber/ast/facade.rb +1 -1
- data/lib/cucumber/cli/configuration.rb +2 -3
- data/lib/cucumber/cli/options.rb +1 -1
- data/lib/cucumber/file_specs.rb +2 -0
- data/lib/cucumber/filters/activate_steps.rb +0 -1
- data/lib/cucumber/formatter/console.rb +34 -17
- data/lib/cucumber/formatter/html.rb +13 -1
- data/lib/cucumber/formatter/legacy_api/adapter.rb +1 -1
- data/lib/cucumber/formatter/legacy_api/ast.rb +2 -5
- data/lib/cucumber/formatter/pretty.rb +10 -0
- data/lib/cucumber/formatter/progress.rb +10 -0
- data/lib/cucumber/multiline_argument/data_table.rb +1 -0
- data/lib/cucumber/platform.rb +1 -1
- data/lib/cucumber/rb_support/rb_transform.rb +3 -1
- data/lib/cucumber/runtime.rb +3 -0
- data/spec/cucumber/file_specs_spec.rb +11 -0
- data/spec/cucumber/formatter/html_spec.rb +55 -0
- data/spec/cucumber/formatter/pretty_spec.rb +107 -0
- data/spec/cucumber/rb_support/rb_transform_spec.rb +20 -0
- metadata +9 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3110fb4364ae31f8a5da94139d812effa7acd9bf
|
4
|
+
data.tar.gz: 0fb0d7f3a973bb50ee76195c9380730e03cb3382
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 661376d7cf4efabbdc1e08183be15c758ce97083821267fbfd164c3a5e5a490ccd74c7a964e62ef1770d0b74d69ae1ca9375d1bcab2b3df33b0d92eb4cc73949
|
7
|
+
data.tar.gz: fd834e7e4c21bbedf1f5b1981ecdc6bdd4775a5c6e5facbbe122c6c47961370738e69068b58c015346adb311c2b920d773b096c34a5cfb643a16d1b68fbccf6c
|
data/History.md
CHANGED
@@ -1,4 +1,17 @@
|
|
1
1
|
## [In Git](https://github.com/cucumber/cucumber/compare/v2.0.0.rc.3...master)
|
2
|
+
|
3
|
+
### Features
|
4
|
+
|
5
|
+
* [Add custom filters from Ruby configuration code](https://github.com/cucumber/cucumber/blob/master/features/docs/extending_cucumber/custom_filter.feature) (@mattwynne)
|
6
|
+
|
7
|
+
### Bugfixes
|
8
|
+
|
9
|
+
* Fix missing `require Forwardable` (@tooky)
|
10
|
+
* Fix snippet suggestions ([765](https://github.com/cucumber/cucumber/pull/765) @richarda), also with i18n languages (@brasmusson)
|
11
|
+
* Fix transformation of regex with lookahead/lookbehind ([796](https://github.com/cucumber/cucumber/pull/796) @bolshakov)
|
12
|
+
* Sort scenarios by location ([789](https://github.com/cucumber/cucumber/issues/789) @mattwynne)
|
13
|
+
* Remove keyword from name property of test case object yielded to hooks ([768](https://github.com/cucumber/cucumber/issues/768) @richarda, @akostadinov)
|
14
|
+
|
2
15
|
## [v2.0.0.rc.3](https://github.com/cucumber/cucumber/compare/v2.0.0.rc.2...v2.0.0.rc.3)
|
3
16
|
|
4
17
|
### Bugfixes
|
data/cucumber.gemspec
CHANGED
@@ -14,12 +14,12 @@ Gem::Specification.new do |s|
|
|
14
14
|
s.platform = Gem::Platform::RUBY
|
15
15
|
s.required_ruby_version = ">= 1.9.3"
|
16
16
|
|
17
|
-
s.add_dependency 'cucumber-core', '~> 1.
|
17
|
+
s.add_dependency 'cucumber-core', '~> 1.1.0'
|
18
18
|
s.add_dependency 'builder', '>= 2.1.2'
|
19
19
|
s.add_dependency 'diff-lcs', '>= 1.1.3'
|
20
20
|
s.add_dependency 'gherkin', '~> 2.12'
|
21
21
|
s.add_dependency 'multi_json', '>= 1.7.5', '< 2.0'
|
22
|
-
s.add_dependency 'multi_test', '>= 0.1.
|
22
|
+
s.add_dependency 'multi_test', '>= 0.1.2'
|
23
23
|
|
24
24
|
s.add_development_dependency 'aruba', '~> 0.6.1'
|
25
25
|
s.add_development_dependency 'json', '~> 1.7'
|
@@ -111,3 +111,20 @@ Feature: Run specific scenarios
|
|
111
111
|
1 scenario (1 passed)
|
112
112
|
1 step (1 passed)
|
113
113
|
"""
|
114
|
+
|
115
|
+
Scenario: Specify order of scenarios
|
116
|
+
Given a file named "features/test.feature" with:
|
117
|
+
"""
|
118
|
+
Feature:
|
119
|
+
Scenario:
|
120
|
+
Given this step passes
|
121
|
+
|
122
|
+
Scenario:
|
123
|
+
Given this step fails
|
124
|
+
"""
|
125
|
+
When I run `cucumber features/test.feature:5 features/test.feature:3 -f progress`
|
126
|
+
Then it should fail with:
|
127
|
+
"""
|
128
|
+
F.
|
129
|
+
"""
|
130
|
+
|
@@ -13,6 +13,9 @@ Feature: Snippets
|
|
13
13
|
\"\"\"
|
14
14
|
example with <html> entities
|
15
15
|
\"\"\"
|
16
|
+
When a simple when step
|
17
|
+
And another when step
|
18
|
+
Then a simple then step
|
16
19
|
"""
|
17
20
|
When I run `cucumber features/undefined_steps.feature -s`
|
18
21
|
Then the output should contain:
|
@@ -20,6 +23,18 @@ Feature: Snippets
|
|
20
23
|
Given(/^a pystring$/) do |string|
|
21
24
|
pending # Write code here that turns the phrase above into concrete actions
|
22
25
|
end
|
26
|
+
|
27
|
+
When(/^a simple when step$/) do
|
28
|
+
pending # Write code here that turns the phrase above into concrete actions
|
29
|
+
end
|
30
|
+
|
31
|
+
When(/^another when step$/) do
|
32
|
+
pending # Write code here that turns the phrase above into concrete actions
|
33
|
+
end
|
34
|
+
|
35
|
+
Then(/^a simple then step$/) do
|
36
|
+
pending # Write code here that turns the phrase above into concrete actions
|
37
|
+
end
|
23
38
|
"""
|
24
39
|
|
25
40
|
Scenario: Snippet for undefined step with a step table
|
@@ -0,0 +1,29 @@
|
|
1
|
+
Feature: Custom filter
|
2
|
+
|
3
|
+
Scenario: Add a custom filter via AfterConfiguration hook
|
4
|
+
Given a file named "features/test.feature" with:
|
5
|
+
"""
|
6
|
+
Feature:
|
7
|
+
Scenario:
|
8
|
+
Given my special step
|
9
|
+
"""
|
10
|
+
And a file named "features/support/my_filter.rb" with:
|
11
|
+
"""
|
12
|
+
require 'cucumber/core/filter'
|
13
|
+
|
14
|
+
MakeAnythingPass = Cucumber::Core::Filter.new do
|
15
|
+
def test_case(test_case)
|
16
|
+
activated_steps = test_case.test_steps.map do |test_step|
|
17
|
+
test_step.with_action { }
|
18
|
+
end
|
19
|
+
test_case.with_steps(activated_steps).describe_to receiver
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
AfterConfiguration do |config|
|
24
|
+
config.filters << MakeAnythingPass.new
|
25
|
+
end
|
26
|
+
"""
|
27
|
+
When I run `cucumber --strict`
|
28
|
+
Then it should pass
|
29
|
+
|
data/lib/cucumber/ast/facade.rb
CHANGED
@@ -147,7 +147,6 @@ module Cucumber
|
|
147
147
|
@options[:name_regexps]
|
148
148
|
end
|
149
149
|
|
150
|
-
# todo: remove as unused
|
151
150
|
def filters
|
152
151
|
@options.filters
|
153
152
|
end
|
@@ -179,7 +178,8 @@ module Cucumber
|
|
179
178
|
end
|
180
179
|
end
|
181
180
|
|
182
|
-
|
181
|
+
private
|
182
|
+
|
183
183
|
def with_default_features_path(paths)
|
184
184
|
return ['features'] if paths.empty?
|
185
185
|
paths
|
@@ -191,7 +191,6 @@ module Cucumber
|
|
191
191
|
end
|
192
192
|
end
|
193
193
|
|
194
|
-
|
195
194
|
def set_environment_variables
|
196
195
|
@options[:env_vars].each do |var, value|
|
197
196
|
ENV[var] = value
|
data/lib/cucumber/cli/options.rb
CHANGED
data/lib/cucumber/file_specs.rb
CHANGED
@@ -132,18 +132,24 @@ module Cucumber
|
|
132
132
|
s.gsub(/.{1,#{max}}(?:\s|\Z)/){($& + 5.chr).gsub(/\n\005/,"\n").gsub(/\005/,"\n")}.rstrip
|
133
133
|
end
|
134
134
|
|
135
|
+
def collect_snippet_data(test_step, result)
|
136
|
+
# collect snippet data for undefined steps
|
137
|
+
unless hook?(test_step)
|
138
|
+
keyword = test_step.source.last.actual_keyword(@previous_step_keyword)
|
139
|
+
@previous_step_keyword = keyword
|
140
|
+
if result.undefined?
|
141
|
+
@snippets_input << Console::SnippetData.new(keyword, test_step.source.last)
|
142
|
+
end
|
143
|
+
end
|
144
|
+
end
|
145
|
+
|
135
146
|
def print_snippets(options)
|
136
147
|
return unless options[:snippets]
|
137
|
-
|
138
|
-
return if undefined.empty?
|
148
|
+
return if runtime.steps(:undefined).empty?
|
139
149
|
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
# TODO: This probably won't work for nested steps :( See above for old code.
|
144
|
-
step_name = step.name
|
145
|
-
@runtime.snippet_text(step.actual_keyword, step_name, step.multiline_arg)
|
146
|
-
end.compact.uniq
|
150
|
+
snippets = @snippets_input.map do |data|
|
151
|
+
@runtime.snippet_text(data.actual_keyword, data.step.name, data.step.multiline_arg)
|
152
|
+
end.uniq
|
147
153
|
|
148
154
|
text = "\nYou can implement step definitions for undefined steps with these snippets:\n\n"
|
149
155
|
text += snippets.join("\n\n")
|
@@ -215,16 +221,27 @@ module Cucumber
|
|
215
221
|
@io.puts "Using the #{profiles_sentence} profile#{'s' if profiles.size> 1}..."
|
216
222
|
end
|
217
223
|
|
218
|
-
|
224
|
+
private
|
219
225
|
|
220
|
-
|
226
|
+
FORMATS = Hash.new{ |hash, format| hash[format] = method(format).to_proc }
|
221
227
|
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
+
def format_for(*keys)
|
229
|
+
key = keys.join('_').to_sym
|
230
|
+
fmt = FORMATS[key]
|
231
|
+
raise "No format for #{key.inspect}: #{FORMATS.inspect}" if fmt.nil?
|
232
|
+
fmt
|
233
|
+
end
|
234
|
+
|
235
|
+
def hook?(test_step)
|
236
|
+
not test_step.source.last.respond_to?(:actual_keyword)
|
237
|
+
end
|
238
|
+
|
239
|
+
class SnippetData
|
240
|
+
attr_reader :actual_keyword, :step
|
241
|
+
def initialize(actual_keyword, step)
|
242
|
+
@actual_keyword, @step = actual_keyword, step
|
243
|
+
end
|
244
|
+
end
|
228
245
|
|
229
246
|
end
|
230
247
|
end
|
@@ -33,6 +33,7 @@ module Cucumber
|
|
33
33
|
@img_id = 0
|
34
34
|
@text_id = 0
|
35
35
|
@inside_outline = false
|
36
|
+
@previous_step_keyword = nil
|
36
37
|
end
|
37
38
|
|
38
39
|
def embed(src, mime_type, label)
|
@@ -160,6 +161,10 @@ module Cucumber
|
|
160
161
|
end
|
161
162
|
end
|
162
163
|
|
164
|
+
def before_test_case(test_case)
|
165
|
+
@previous_step_keyword = nil
|
166
|
+
end
|
167
|
+
|
163
168
|
def before_background(background)
|
164
169
|
@in_background = true
|
165
170
|
@builder << '<div class="background">'
|
@@ -279,8 +284,11 @@ module Cucumber
|
|
279
284
|
def after_step_result(keyword, step_match, multiline_arg, status, exception, source_indent, background, file_colon_line)
|
280
285
|
return if @hide_this_step
|
281
286
|
# print snippet for undefined steps
|
287
|
+
unless outline_step?(@step)
|
288
|
+
keyword = @step.actual_keyword(@previous_step_keyword)
|
289
|
+
@previous_step_keyword = keyword
|
290
|
+
end
|
282
291
|
if status == :undefined
|
283
|
-
keyword = @step.actual_keyword if @step.respond_to?(:actual_keyword)
|
284
292
|
@builder.pre do |pre|
|
285
293
|
# TODO: snippet text should be an event sent to the formatter so we don't
|
286
294
|
# have this couping to the runtime.
|
@@ -608,6 +616,10 @@ module Cucumber
|
|
608
616
|
Builder::XmlMarkup.new(:target => io, :indent => 0)
|
609
617
|
end
|
610
618
|
|
619
|
+
def outline_step?(step)
|
620
|
+
not @step.step.respond_to?(:actual_keyword)
|
621
|
+
end
|
622
|
+
|
611
623
|
class SnippetExtractor #:nodoc:
|
612
624
|
class NullConverter; def convert(code, pre); code; end; end #:nodoc:
|
613
625
|
begin; require 'syntax/convertors/html'; @@converter = Syntax::Convertors::HTML.for_syntax "ruby"; rescue LoadError => e; @@converter = NullConverter.new; end
|
@@ -54,7 +54,7 @@ module Cucumber
|
|
54
54
|
end
|
55
55
|
|
56
56
|
def record_test_case_result(test_case, result)
|
57
|
-
scenario = LegacyResultBuilder.new(result).scenario(test_case.name, test_case.location)
|
57
|
+
scenario = LegacyResultBuilder.new(result).scenario("#{test_case.keyword}: #{test_case.name}", test_case.location)
|
58
58
|
results.scenario_visited(scenario)
|
59
59
|
end
|
60
60
|
|
@@ -138,11 +138,8 @@ module Cucumber
|
|
138
138
|
|
139
139
|
end
|
140
140
|
|
141
|
-
def actual_keyword
|
142
|
-
|
143
|
-
# `actual_keyword` translates 'And', 'But', etc. to 'Given', 'When',
|
144
|
-
# 'Then' as appropriate
|
145
|
-
"Given"
|
141
|
+
def actual_keyword(previous_step_keyword = nil)
|
142
|
+
step.actual_keyword(previous_step_keyword)
|
146
143
|
end
|
147
144
|
|
148
145
|
def file_colon_line
|
@@ -26,6 +26,8 @@ module Cucumber
|
|
26
26
|
@indent = 0
|
27
27
|
@prefixes = options[:prefixes] || {}
|
28
28
|
@delayed_messages = []
|
29
|
+
@previous_step_keyword = nil
|
30
|
+
@snippets_input = []
|
29
31
|
end
|
30
32
|
|
31
33
|
def before_features(features)
|
@@ -209,6 +211,14 @@ module Cucumber
|
|
209
211
|
@io.flush
|
210
212
|
end
|
211
213
|
|
214
|
+
def before_test_case(test_case)
|
215
|
+
@previous_step_keyword = nil
|
216
|
+
end
|
217
|
+
|
218
|
+
def after_test_step(test_step, result)
|
219
|
+
collect_snippet_data(test_step, result)
|
220
|
+
end
|
221
|
+
|
212
222
|
private
|
213
223
|
|
214
224
|
def print_feature_element_name(keyword, name, file_colon_line, source_indent)
|
@@ -11,6 +11,8 @@ module Cucumber
|
|
11
11
|
|
12
12
|
def initialize(runtime, path_or_io, options)
|
13
13
|
@runtime, @io, @options = runtime, ensure_io(path_or_io, "progress"), options
|
14
|
+
@previous_step_keyword = nil
|
15
|
+
@snippets_input = []
|
14
16
|
end
|
15
17
|
|
16
18
|
def before_features(features)
|
@@ -64,6 +66,14 @@ module Cucumber
|
|
64
66
|
@exception_raised = true
|
65
67
|
end
|
66
68
|
|
69
|
+
def before_test_case(test_case)
|
70
|
+
@previous_step_keyword = nil
|
71
|
+
end
|
72
|
+
|
73
|
+
def after_test_step(test_step, result)
|
74
|
+
collect_snippet_data(test_step, result)
|
75
|
+
end
|
76
|
+
|
67
77
|
private
|
68
78
|
|
69
79
|
def print_summary(features)
|
data/lib/cucumber/platform.rb
CHANGED
@@ -4,7 +4,7 @@ require 'rbconfig'
|
|
4
4
|
|
5
5
|
module Cucumber
|
6
6
|
unless defined?(Cucumber::VERSION)
|
7
|
-
VERSION = '2.0.0.rc.
|
7
|
+
VERSION = '2.0.0.rc.4'
|
8
8
|
BINARY = File.expand_path(File.dirname(__FILE__) + '/../../bin/cucumber')
|
9
9
|
LIBDIR = File.expand_path(File.dirname(__FILE__) + '/../../lib')
|
10
10
|
JRUBY = defined?(JRUBY_VERSION)
|
data/lib/cucumber/runtime.rb
CHANGED
@@ -219,6 +219,9 @@ module Cucumber
|
|
219
219
|
filters << Cucumber::Core::Test::LocationsFilter.new(filespecs.locations)
|
220
220
|
filters << Filters::Quit.new
|
221
221
|
filters << Filters::ActivateSteps.new(@support_code)
|
222
|
+
@configuration.filters.each do |filter|
|
223
|
+
filters << filter
|
224
|
+
end
|
222
225
|
unless configuration.dry_run?
|
223
226
|
filters << Filters::ApplyAfterStepHooks.new(@support_code)
|
224
227
|
filters << Filters::ApplyBeforeHooks.new(@support_code)
|
@@ -45,5 +45,16 @@ module Cucumber
|
|
45
45
|
]
|
46
46
|
end
|
47
47
|
end
|
48
|
+
|
49
|
+
context "when the same file is referenced more than once" do
|
50
|
+
let(:file_specs) { FileSpecs.new(["features/foo.feature:10", "features/foo.feature:1"]) }
|
51
|
+
|
52
|
+
it "returns locations in the order specified" do
|
53
|
+
expect(locations).to eq [
|
54
|
+
Cucumber::Core::Ast::Location.new("features/foo.feature", 10),
|
55
|
+
Cucumber::Core::Ast::Location.new("features/foo.feature", 1),
|
56
|
+
]
|
57
|
+
end
|
58
|
+
end
|
48
59
|
end
|
49
60
|
end
|
@@ -343,6 +343,34 @@ module Cucumber
|
|
343
343
|
it { expect(@doc.css('pre').map { |pre| /^(Given|And)/.match(pre.text)[1] }).to eq ["Given", "Given"] }
|
344
344
|
end
|
345
345
|
|
346
|
+
describe "with an undefined When step then an undefined And step" do
|
347
|
+
define_feature(<<-FEATURE)
|
348
|
+
Feature:
|
349
|
+
Scenario:
|
350
|
+
Given some undefined step
|
351
|
+
When a different undefined step
|
352
|
+
And another undefined step
|
353
|
+
FEATURE
|
354
|
+
|
355
|
+
it { expect(@doc.css('pre').map { |pre| /^(Given|When|And)/.match(pre.text)[1] }).to eq ["Given", "When", "When"] }
|
356
|
+
end
|
357
|
+
|
358
|
+
describe "with an passing Then step and an undefined And step" do
|
359
|
+
define_feature <<-FEATURE
|
360
|
+
Feature:
|
361
|
+
Scenario:
|
362
|
+
Given this step passes
|
363
|
+
Then this step passes
|
364
|
+
And this step is undefined
|
365
|
+
FEATURE
|
366
|
+
|
367
|
+
define_steps do
|
368
|
+
Given(/^this step passes$/) {}
|
369
|
+
end
|
370
|
+
|
371
|
+
it { expect(@doc.css('pre').map { |pre| /^(Given|Then)/.match(pre.text)[1] }).to eq ["Then"] }
|
372
|
+
end
|
373
|
+
|
346
374
|
describe "with a output from hooks" do
|
347
375
|
describe "in a scenario" do
|
348
376
|
define_feature <<-FEATURE
|
@@ -399,6 +427,33 @@ module Cucumber
|
|
399
427
|
end
|
400
428
|
end
|
401
429
|
end
|
430
|
+
context "in --expand mode" do
|
431
|
+
let(:runtime) { Runtime.new({:expand => true})}
|
432
|
+
before(:each) do
|
433
|
+
@out = StringIO.new
|
434
|
+
@formatter = Html.new(runtime, @out, {})
|
435
|
+
run_defined_feature
|
436
|
+
@doc = Nokogiri.HTML(@out.string)
|
437
|
+
end
|
438
|
+
describe "with undefined * steps in a Scenario Outline" do
|
439
|
+
define_feature <<-FEATURE
|
440
|
+
Feature:
|
441
|
+
Scenario Outline:
|
442
|
+
* this step is <status>
|
443
|
+
Then this step passes
|
444
|
+
Examples:
|
445
|
+
| status |
|
446
|
+
| undefined |
|
447
|
+
| undefined |
|
448
|
+
FEATURE
|
449
|
+
|
450
|
+
define_steps do
|
451
|
+
Given(/^this step passes$/) {}
|
452
|
+
end
|
453
|
+
|
454
|
+
it { expect(@doc.css('pre').map { |pre| /^(Given|Then|When)/.match(pre.text)[1] }).to eq ["Given", "Given"] }
|
455
|
+
end
|
456
|
+
end
|
402
457
|
end
|
403
458
|
end
|
404
459
|
end
|
@@ -698,6 +698,113 @@ OUTPUT
|
|
698
698
|
end
|
699
699
|
end
|
700
700
|
end
|
701
|
+
|
702
|
+
context "snippets contain relevant keyword replacements" do
|
703
|
+
|
704
|
+
before(:each) do
|
705
|
+
Cucumber::Term::ANSIColor.coloring = false
|
706
|
+
@out = StringIO.new
|
707
|
+
@formatter = Pretty.new(runtime, @out, {snippets: true})
|
708
|
+
run_defined_feature
|
709
|
+
end
|
710
|
+
|
711
|
+
describe "With a scenario that has undefined steps" do
|
712
|
+
define_feature <<-FEATURE
|
713
|
+
Feature: Banana party
|
714
|
+
|
715
|
+
Scenario: many monkeys eat many things
|
716
|
+
Given there are bananas and apples
|
717
|
+
And other monkeys are around
|
718
|
+
When one monkey eats a banana
|
719
|
+
And the other monkeys eat all the apples
|
720
|
+
Then bananas remain
|
721
|
+
But there are no apples left
|
722
|
+
FEATURE
|
723
|
+
|
724
|
+
it "containes snippets with 'And' or 'But' replaced by previous step name" do
|
725
|
+
expect(@out.string).to include("Given(/^there are bananas and apples$/)")
|
726
|
+
expect(@out.string).to include("Given(/^other monkeys are around$/)")
|
727
|
+
expect(@out.string).to include("When(/^one monkey eats a banana$/)")
|
728
|
+
expect(@out.string).to include("When(/^the other monkeys eat all the apples$/)")
|
729
|
+
expect(@out.string).to include("Then(/^bananas remain$/)")
|
730
|
+
expect(@out.string).to include("Then(/^there are no apples left$/)")
|
731
|
+
end
|
732
|
+
end
|
733
|
+
|
734
|
+
describe "With a scenario that uses * and 'But'" do
|
735
|
+
define_feature <<-FEATURE
|
736
|
+
Feature: Banana party
|
737
|
+
|
738
|
+
Scenario: many monkeys eat many things
|
739
|
+
* there are bananas and apples
|
740
|
+
* other monkeys are around
|
741
|
+
When one monkey eats a banana
|
742
|
+
* the other monkeys eat all the apples
|
743
|
+
Then bananas remain
|
744
|
+
* there are no apples left
|
745
|
+
FEATURE
|
746
|
+
it "replaces the first step with 'Given'" do
|
747
|
+
expect(@out.string).to include("Given(/^there are bananas and apples$/)")
|
748
|
+
end
|
749
|
+
it "uses actual keywords as the 'previous' keyword for future replacements" do
|
750
|
+
expect(@out.string).to include("Given(/^other monkeys are around$/)")
|
751
|
+
expect(@out.string).to include("When(/^the other monkeys eat all the apples$/)")
|
752
|
+
expect(@out.string).to include("Then(/^there are no apples left$/)")
|
753
|
+
end
|
754
|
+
end
|
755
|
+
|
756
|
+
describe "With a scenario where the only undefined step uses 'And'" do
|
757
|
+
define_feature <<-FEATURE
|
758
|
+
Feature:
|
759
|
+
|
760
|
+
Scenario:
|
761
|
+
Given this step passes
|
762
|
+
Then this step passes
|
763
|
+
And this step is undefined
|
764
|
+
FEATURE
|
765
|
+
define_steps do
|
766
|
+
Given(/^this step passes$/) {}
|
767
|
+
end
|
768
|
+
it "uses actual keyword of the previous passing step for the undefined step" do
|
769
|
+
expect(@out.string).to include("Then(/^this step is undefined$/)")
|
770
|
+
end
|
771
|
+
end
|
772
|
+
|
773
|
+
describe "With scenarios where the first step is undefined and uses '*'" do
|
774
|
+
define_feature <<-FEATURE
|
775
|
+
Feature:
|
776
|
+
|
777
|
+
Scenario:
|
778
|
+
* this step is undefined
|
779
|
+
Then this step passes
|
780
|
+
|
781
|
+
Scenario:
|
782
|
+
* this step is also undefined
|
783
|
+
Then this step passes
|
784
|
+
FEATURE
|
785
|
+
define_steps do
|
786
|
+
Given(/^this step passes$/) {}
|
787
|
+
end
|
788
|
+
it "uses 'Given' as actual keyword the step in each scenario" do
|
789
|
+
expect(@out.string).to include("Given(/^this step is undefined$/)")
|
790
|
+
expect(@out.string).to include("Given(/^this step is also undefined$/)")
|
791
|
+
end
|
792
|
+
end
|
793
|
+
|
794
|
+
describe "with a scenario in en-lol" do
|
795
|
+
define_feature <<-FEATURE
|
796
|
+
# language: en-lol
|
797
|
+
OH HAI: STUFFING
|
798
|
+
|
799
|
+
MISHUN: CUCUMBR
|
800
|
+
I CAN HAZ IN TEH BEGINNIN CUCUMBRZ
|
801
|
+
AN I EAT CUCUMBRZ
|
802
|
+
FEATURE
|
803
|
+
it "uses actual keyword of the previous passing step for the undefined step" do
|
804
|
+
expect(@out.string).to include("ICANHAZ(/^I EAT CUCUMBRZ$/)")
|
805
|
+
end
|
806
|
+
end
|
807
|
+
end
|
701
808
|
end
|
702
809
|
end
|
703
810
|
end
|
@@ -9,6 +9,26 @@ module Cucumber
|
|
9
9
|
end
|
10
10
|
|
11
11
|
describe "#to_s" do
|
12
|
+
it "does not touch positive lookahead captures" do
|
13
|
+
expect(transform(/^xy(?=z)/).to_s).to eq "xy(?=z)"
|
14
|
+
end
|
15
|
+
|
16
|
+
it "does not touch negative lookahead captures" do
|
17
|
+
expect(transform(/^xy(?!z)/).to_s).to eq "xy(?!z)"
|
18
|
+
end
|
19
|
+
|
20
|
+
it "does not touch positive lookbehind captures" do
|
21
|
+
expect(transform(/^xy(?<=z)/).to_s).to eq "xy(?<=z)"
|
22
|
+
end
|
23
|
+
|
24
|
+
it "does not touch negative lookbehind captures" do
|
25
|
+
expect(transform(/^xy(?<!z)/).to_s).to eq "xy(?<!z)"
|
26
|
+
end
|
27
|
+
|
28
|
+
it "converts named captures" do
|
29
|
+
expect(transform(/^(?<str>xyz)/).to_s).to eq "(?:<str>xyz)"
|
30
|
+
end
|
31
|
+
|
12
32
|
it "converts captures groups to non-capture groups" do
|
13
33
|
expect(transform(/(a|b)bc/).to_s).to eq "(?:a|b)bc"
|
14
34
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cucumber
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.0.rc.
|
4
|
+
version: 2.0.0.rc.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aslak Hellesøy
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-02-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cucumber-core
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 1.
|
19
|
+
version: 1.1.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 1.
|
26
|
+
version: 1.1.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: builder
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -92,14 +92,14 @@ dependencies:
|
|
92
92
|
requirements:
|
93
93
|
- - ">="
|
94
94
|
- !ruby/object:Gem::Version
|
95
|
-
version: 0.1.
|
95
|
+
version: 0.1.2
|
96
96
|
type: :runtime
|
97
97
|
prerelease: false
|
98
98
|
version_requirements: !ruby/object:Gem::Requirement
|
99
99
|
requirements:
|
100
100
|
- - ">="
|
101
101
|
- !ruby/object:Gem::Version
|
102
|
-
version: 0.1.
|
102
|
+
version: 0.1.2
|
103
103
|
- !ruby/object:Gem::Dependency
|
104
104
|
name: aruba
|
105
105
|
requirement: !ruby/object:Gem::Requirement
|
@@ -581,6 +581,7 @@ files:
|
|
581
581
|
- features/docs/exception_in_after_hook.feature
|
582
582
|
- features/docs/exception_in_after_step_hook.feature
|
583
583
|
- features/docs/exception_in_before_hook.feature
|
584
|
+
- features/docs/extending_cucumber/custom_filter.feature
|
584
585
|
- features/docs/extending_cucumber/custom_formatter.feature
|
585
586
|
- features/docs/formatters/debug_formatter.feature
|
586
587
|
- features/docs/formatters/formatter_step_file_colon_line.feature
|
@@ -818,7 +819,7 @@ rubyforge_project:
|
|
818
819
|
rubygems_version: 2.2.2
|
819
820
|
signing_key:
|
820
821
|
specification_version: 4
|
821
|
-
summary: cucumber-2.0.0.rc.
|
822
|
+
summary: cucumber-2.0.0.rc.4
|
822
823
|
test_files:
|
823
824
|
- features/docs/api/list_step_defs_as_json.feature
|
824
825
|
- features/docs/api/run_cli_main_with_existing_runtime.feature
|
@@ -845,6 +846,7 @@ test_files:
|
|
845
846
|
- features/docs/exception_in_after_hook.feature
|
846
847
|
- features/docs/exception_in_after_step_hook.feature
|
847
848
|
- features/docs/exception_in_before_hook.feature
|
849
|
+
- features/docs/extending_cucumber/custom_filter.feature
|
848
850
|
- features/docs/extending_cucumber/custom_formatter.feature
|
849
851
|
- features/docs/formatters/debug_formatter.feature
|
850
852
|
- features/docs/formatters/formatter_step_file_colon_line.feature
|