cucumber 2.0.0.beta.5 → 2.0.0.rc.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/History.md +20 -1
- data/Rakefile +0 -2
- data/cucumber.gemspec +1 -1
- data/features/docs/defining_steps/skip_scenario.feature +31 -2
- data/lib/cucumber.rb +6 -0
- data/lib/cucumber/ast/facade.rb +117 -0
- data/lib/cucumber/cli/configuration.rb +1 -1
- data/lib/cucumber/cli/profile_loader.rb +1 -1
- data/lib/cucumber/file_specs.rb +1 -1
- data/lib/cucumber/filters.rb +9 -0
- data/lib/cucumber/filters/activate_steps.rb +34 -0
- data/lib/cucumber/filters/apply_after_hooks.rb +9 -0
- data/lib/cucumber/filters/apply_after_step_hooks.rb +12 -0
- data/lib/cucumber/filters/apply_around_hooks.rb +12 -0
- data/lib/cucumber/filters/apply_before_hooks.rb +9 -0
- data/lib/cucumber/filters/prepare_world.rb +37 -0
- data/lib/cucumber/filters/quit.rb +5 -1
- data/lib/cucumber/filters/randomizer.rb +5 -1
- data/lib/cucumber/filters/tag_limits.rb +7 -2
- data/lib/cucumber/formatter/ansicolor.rb +0 -8
- data/lib/cucumber/formatter/html.rb +6 -1
- data/lib/cucumber/formatter/legacy_api/adapter.rb +17 -1
- data/lib/cucumber/formatter/legacy_api/ast.rb +6 -1
- data/lib/cucumber/hooks.rb +97 -0
- data/lib/cucumber/platform.rb +2 -3
- data/lib/cucumber/rb_support/rb_hook.rb +2 -2
- data/lib/cucumber/runtime.rb +18 -15
- data/lib/cucumber/runtime/after_hooks.rb +24 -0
- data/lib/cucumber/runtime/before_hooks.rb +23 -0
- data/lib/cucumber/runtime/step_hooks.rb +22 -0
- data/lib/cucumber/runtime/support_code.rb +56 -1
- data/lib/cucumber/step_match.rb +26 -2
- data/spec/cucumber/cli/configuration_spec.rb +16 -1
- data/spec/cucumber/cli/profile_loader_spec.rb +10 -0
- data/spec/cucumber/file_specs_spec.rb +10 -2
- data/spec/cucumber/filters/activate_steps_spec.rb +57 -0
- data/spec/cucumber/formatter/debug_spec.rb +0 -14
- data/spec/cucumber/formatter/html_spec.rb +29 -0
- data/spec/cucumber/formatter/legacy_api/adapter_spec.rb +210 -110
- data/spec/cucumber/formatter/pretty_spec.rb +0 -2
- data/spec/cucumber/formatter/rerun_spec.rb +17 -16
- data/spec/cucumber/formatter/spec_helper.rb +11 -6
- data/spec/cucumber/hooks_spec.rb +30 -0
- data/spec/cucumber/rb_support/rb_step_definition_spec.rb +11 -4
- metadata +22 -16
- data/gem_tasks/yard.rake +0 -43
- data/gem_tasks/yard/default/layout/html/bubble_32x32.png +0 -0
- data/gem_tasks/yard/default/layout/html/footer.erb +0 -5
- data/gem_tasks/yard/default/layout/html/index.erb +0 -1
- data/gem_tasks/yard/default/layout/html/layout.erb +0 -25
- data/gem_tasks/yard/default/layout/html/logo.erb +0 -1
- data/gem_tasks/yard/default/layout/html/setup.rb +0 -4
- data/lib/cucumber/mappings.rb +0 -238
- data/spec/cucumber/mappings_spec.rb +0 -180
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8832bd36266bffbfaa4d3fd708361d72485d0f70
|
4
|
+
data.tar.gz: 1f310aac04ddfedf7e2e7ddd7a53f6adb88aaa8a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fd8670734a46685cde551f37ec2f2d9a35f19d0b280c48ee6c86aa4fca9c7144dc538229add49ec8a48b5169b09e387a134960d3984f39c93ec467c4b147e7ce
|
7
|
+
data.tar.gz: f672204acf7aaa53c92ef59699d9d8b37fb24ad4f5e423fea79de82a9e002184218e45d3a228cb1032341893a1f1d7f4da6e7527aa155a8c318c6d567ea09f7f
|
data/History.md
CHANGED
@@ -1,4 +1,23 @@
|
|
1
|
-
## [In Git](https://github.com/cucumber/cucumber/compare/v2.0.0.
|
1
|
+
## [In Git](https://github.com/cucumber/cucumber/compare/v2.0.0.rc.1...master)
|
2
|
+
|
3
|
+
## [v2.0.0.rc.1](https://github.com/cucumber/cucumber/compare/v2.0.0.beta.5...v2.0.0.rc.1)
|
4
|
+
|
5
|
+
### Removed Features
|
6
|
+
|
7
|
+
* Removed support for IronRuby (@tooky @mattwynne)
|
8
|
+
|
9
|
+
### New Features
|
10
|
+
|
11
|
+
* Let the HTML formatter store the relative path to files in the report ([697](https://github.com/cucumber/cucumber/pull/697) @idstein, @brasmusson)
|
12
|
+
* Allow cucumber.yml to parse % erb code lines ([755](https://github.com/cucumber/cucumber/pull/755) @snowe2010)
|
13
|
+
* Give each step definition a unique copy of argument objects ([760](https://github.com/cucumber/cucumber/pull/760) @tooky)
|
14
|
+
|
15
|
+
### Bugfixes
|
16
|
+
|
17
|
+
* Add old Scenario#skip_invoke! method back (@mattwynne)
|
18
|
+
* No links to lines in backtrace under TextMate ([548](https://github.com/cucumber/cucumber/pull/548) @bilus)
|
19
|
+
* Using file:line CLI to select scenarios was running same scenario multiple times ([786](https://github.com/cucumber/cucumber/pull/786) @jdks)
|
20
|
+
* Allow spaces in filenames for rerun formatter ([793](https://github.com/cucumber/cucumber/pull/793) @callahat)
|
2
21
|
|
3
22
|
## [v2.0.0.beta.5](https://github.com/cucumber/cucumber/compare/v2.0.0.beta.4...v2.0.0.beta.5)
|
4
23
|
|
data/Rakefile
CHANGED
data/cucumber.gemspec
CHANGED
@@ -14,7 +14,7 @@ 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.0.0
|
17
|
+
s.add_dependency 'cucumber-core', '~> 1.0.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'
|
@@ -1,7 +1,6 @@
|
|
1
1
|
Feature: Skip Scenario
|
2
|
-
-
|
3
2
|
|
4
|
-
Scenario: With a
|
3
|
+
Scenario: With a passing step
|
5
4
|
Given a file named "features/test.feature" with:
|
6
5
|
"""
|
7
6
|
Feature: test
|
@@ -31,3 +30,33 @@ Feature: Skip Scenario
|
|
31
30
|
|
32
31
|
"""
|
33
32
|
|
33
|
+
Scenario: Use legacy API from a hook
|
34
|
+
Given a file named "features/test.feature" with:
|
35
|
+
"""
|
36
|
+
Feature: test
|
37
|
+
Scenario: test
|
38
|
+
Given this step passes
|
39
|
+
And this step passes
|
40
|
+
"""
|
41
|
+
And the standard step definitions
|
42
|
+
And a file named "features/support/hook.rb" with:
|
43
|
+
"""
|
44
|
+
Before do |scenario|
|
45
|
+
scenario.skip_invoke!
|
46
|
+
end
|
47
|
+
"""
|
48
|
+
When I run `cucumber -q`
|
49
|
+
Then it should pass with:
|
50
|
+
"""
|
51
|
+
Feature: test
|
52
|
+
|
53
|
+
Scenario: test
|
54
|
+
Given this step passes
|
55
|
+
And this step passes
|
56
|
+
|
57
|
+
1 scenario (1 skipped)
|
58
|
+
2 steps (2 skipped)
|
59
|
+
0m0.012s
|
60
|
+
|
61
|
+
"""
|
62
|
+
|
data/lib/cucumber.rb
CHANGED
@@ -22,5 +22,11 @@ module Cucumber
|
|
22
22
|
def logger=(logger)
|
23
23
|
@log = logger
|
24
24
|
end
|
25
|
+
|
26
|
+
def deprecate(class_name, method, message)
|
27
|
+
return self # deprecation warnings will come in v2.1
|
28
|
+
called_by = caller[1]
|
29
|
+
warn("Deprecated: #{class_name}##{method} #{message}. Caller: #{called_by}")
|
30
|
+
end
|
25
31
|
end
|
26
32
|
end
|
@@ -0,0 +1,117 @@
|
|
1
|
+
require 'cucumber/runtime'
|
2
|
+
require 'cucumber'
|
3
|
+
require 'cucumber/multiline_argument'
|
4
|
+
require 'cucumber/core/test/result'
|
5
|
+
|
6
|
+
module Cucumber
|
7
|
+
# Decorates the `Cucumber::Core::Test::Case` to look like the
|
8
|
+
# Cucumber 1.3's `Cucumber::Ast::Scenario`.
|
9
|
+
#
|
10
|
+
# This is for backwards compatability in before / after hooks.
|
11
|
+
module Ast
|
12
|
+
class Facade
|
13
|
+
def initialize(test_case)
|
14
|
+
@test_case = test_case
|
15
|
+
test_case.describe_source_to(self)
|
16
|
+
end
|
17
|
+
|
18
|
+
def feature(feature)
|
19
|
+
@feature = feature
|
20
|
+
end
|
21
|
+
|
22
|
+
def scenario(scenario)
|
23
|
+
@factory = Scenario
|
24
|
+
end
|
25
|
+
|
26
|
+
def scenario_outline(scenario)
|
27
|
+
@factory = ScenarioOutlineExample
|
28
|
+
end
|
29
|
+
|
30
|
+
def examples_table(examples_table)
|
31
|
+
end
|
32
|
+
|
33
|
+
def examples_table_row(row)
|
34
|
+
end
|
35
|
+
|
36
|
+
def build_scenario
|
37
|
+
@factory.new(@test_case, Feature.new(@feature.legacy_conflated_name_and_description))
|
38
|
+
end
|
39
|
+
|
40
|
+
class Scenario
|
41
|
+
def initialize(test_case, feature, result = Core::Test::Result::Unknown.new)
|
42
|
+
@test_case = test_case
|
43
|
+
@feature = feature
|
44
|
+
@result = result
|
45
|
+
end
|
46
|
+
|
47
|
+
def accept_hook?(hook)
|
48
|
+
hook.tag_expressions.all? { |expression| @test_case.match_tags?(expression) }
|
49
|
+
end
|
50
|
+
|
51
|
+
def failed?
|
52
|
+
@result.failed?
|
53
|
+
end
|
54
|
+
|
55
|
+
def passed?
|
56
|
+
!failed?
|
57
|
+
end
|
58
|
+
|
59
|
+
def language
|
60
|
+
@test_case.language
|
61
|
+
end
|
62
|
+
|
63
|
+
def feature
|
64
|
+
@feature
|
65
|
+
end
|
66
|
+
|
67
|
+
def name
|
68
|
+
@test_case.name
|
69
|
+
end
|
70
|
+
|
71
|
+
def title
|
72
|
+
warn("deprecated: call #name instead")
|
73
|
+
name
|
74
|
+
end
|
75
|
+
|
76
|
+
def source_tags
|
77
|
+
#warn('deprecated: call #tags instead')
|
78
|
+
tags
|
79
|
+
end
|
80
|
+
|
81
|
+
def source_tag_names
|
82
|
+
tags.map &:name
|
83
|
+
end
|
84
|
+
|
85
|
+
def skip_invoke!
|
86
|
+
Cucumber.deprecate(self.class.name, __method__, "Call #skip_this_scenario on the World directly")
|
87
|
+
raise Cucumber::Core::Test::Result::Skipped
|
88
|
+
end
|
89
|
+
|
90
|
+
def tags
|
91
|
+
@test_case.tags
|
92
|
+
end
|
93
|
+
|
94
|
+
def outline?
|
95
|
+
false
|
96
|
+
end
|
97
|
+
|
98
|
+
def with_result(result)
|
99
|
+
self.class.new(@test_case, @feature, result)
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
class ScenarioOutlineExample < Scenario
|
104
|
+
def outline?
|
105
|
+
true
|
106
|
+
end
|
107
|
+
|
108
|
+
def scenario_outline
|
109
|
+
self
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
Feature = Struct.new(:name)
|
114
|
+
|
115
|
+
end
|
116
|
+
end
|
117
|
+
end
|
@@ -107,7 +107,7 @@ module Cucumber
|
|
107
107
|
Dir["#{path}/**/*.feature"].sort
|
108
108
|
elsif path[0..0] == '@' and # @listfile.txt
|
109
109
|
File.file?(path[1..-1]) # listfile.txt is a file
|
110
|
-
IO.read(path[1..-1]).split
|
110
|
+
IO.read(path[1..-1]).split(/(.*?\.feature.*?) /).collect(&:strip).reject(&:empty?)
|
111
111
|
else
|
112
112
|
path
|
113
113
|
end
|
@@ -60,7 +60,7 @@ Defined profiles in cucumber.yml:
|
|
60
60
|
require 'erb'
|
61
61
|
require 'yaml'
|
62
62
|
begin
|
63
|
-
@cucumber_erb = ERB.new(IO.read(cucumber_file)).result(binding)
|
63
|
+
@cucumber_erb = ERB.new(IO.read(cucumber_file), nil, '%').result(binding)
|
64
64
|
rescue Exception => e
|
65
65
|
raise(YmlLoadError,"cucumber.yml was found, but could not be parsed with ERB. Please refer to cucumber's documentation on correct profile usage.\n#{$!.inspect}")
|
66
66
|
end
|
data/lib/cucumber/file_specs.rb
CHANGED
@@ -0,0 +1,9 @@
|
|
1
|
+
require 'cucumber/filters/activate_steps'
|
2
|
+
require 'cucumber/filters/apply_after_step_hooks'
|
3
|
+
require 'cucumber/filters/apply_before_hooks'
|
4
|
+
require 'cucumber/filters/apply_after_hooks'
|
5
|
+
require 'cucumber/filters/apply_around_hooks'
|
6
|
+
require 'cucumber/filters/prepare_world'
|
7
|
+
require 'cucumber/filters/quit'
|
8
|
+
require 'cucumber/filters/randomizer'
|
9
|
+
require 'cucumber/filters/tag_limits'
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'cucumber/multiline_argument'
|
2
|
+
require 'cucumber/core/filter'
|
3
|
+
|
4
|
+
module Cucumber
|
5
|
+
module Filters
|
6
|
+
class ActivateSteps < Core::Filter.new(:step_definitions)
|
7
|
+
|
8
|
+
def test_case(test_case)
|
9
|
+
CaseFilter.new(test_case, step_definitions).test_case.describe_to receiver
|
10
|
+
end
|
11
|
+
|
12
|
+
class CaseFilter
|
13
|
+
def initialize(test_case, step_definitions)
|
14
|
+
@original_test_case = test_case
|
15
|
+
@step_definitions = step_definitions
|
16
|
+
end
|
17
|
+
|
18
|
+
def test_case
|
19
|
+
@original_test_case.with_steps(new_test_steps)
|
20
|
+
end
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
def new_test_steps
|
25
|
+
@original_test_case.test_steps.map(&self.method(:attempt_to_activate))
|
26
|
+
end
|
27
|
+
|
28
|
+
def attempt_to_activate(test_step)
|
29
|
+
@step_definitions.find_match(test_step).activate(test_step)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'cucumber/core/filter'
|
2
|
+
|
3
|
+
module Cucumber
|
4
|
+
module Filters
|
5
|
+
class ApplyAfterStepHooks < Core::Filter.new(:hooks)
|
6
|
+
def test_case(test_case)
|
7
|
+
test_steps = hooks.find_after_step_hooks(test_case).apply(test_case.test_steps)
|
8
|
+
test_case.with_steps(test_steps).describe_to(receiver)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'cucumber/core/filter'
|
2
|
+
|
3
|
+
module Cucumber
|
4
|
+
module Filters
|
5
|
+
class ApplyAroundHooks < Core::Filter.new(:hooks)
|
6
|
+
def test_case(test_case)
|
7
|
+
around_hooks = hooks.find_around_hooks(test_case)
|
8
|
+
test_case.with_around_hooks(around_hooks).describe_to(receiver)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require 'cucumber/core/filter'
|
2
|
+
require 'cucumber/ast/facade'
|
3
|
+
require 'cucumber/hooks'
|
4
|
+
|
5
|
+
module Cucumber
|
6
|
+
module Filters
|
7
|
+
|
8
|
+
class PrepareWorld < Core::Filter.new(:runtime)
|
9
|
+
|
10
|
+
def test_case(test_case)
|
11
|
+
CaseFilter.new(runtime, test_case).test_case.describe_to receiver
|
12
|
+
end
|
13
|
+
|
14
|
+
class CaseFilter
|
15
|
+
def initialize(runtime, original_test_case)
|
16
|
+
@runtime, @original_test_case = runtime, original_test_case
|
17
|
+
end
|
18
|
+
|
19
|
+
def test_case
|
20
|
+
init_scenario = Cucumber::Hooks.before_hook(@original_test_case.source) do
|
21
|
+
@runtime.begin_scenario(scenario)
|
22
|
+
end
|
23
|
+
steps = [init_scenario] + @original_test_case.test_steps
|
24
|
+
@original_test_case.with_steps(steps)
|
25
|
+
end
|
26
|
+
|
27
|
+
private
|
28
|
+
|
29
|
+
def scenario
|
30
|
+
@scenario ||= Ast::Facade.new(test_case).build_scenario
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
end
|
@@ -2,7 +2,7 @@ module Cucumber
|
|
2
2
|
module Filters
|
3
3
|
|
4
4
|
class Quit
|
5
|
-
def initialize(receiver)
|
5
|
+
def initialize(receiver=nil)
|
6
6
|
@receiver = receiver
|
7
7
|
end
|
8
8
|
|
@@ -17,6 +17,10 @@ module Cucumber
|
|
17
17
|
@receiver.done
|
18
18
|
self
|
19
19
|
end
|
20
|
+
|
21
|
+
def with_receiver(receiver)
|
22
|
+
self.class.new(receiver)
|
23
|
+
end
|
20
24
|
end
|
21
25
|
|
22
26
|
end
|
@@ -3,7 +3,7 @@ module Cucumber
|
|
3
3
|
|
4
4
|
# Batches up all test cases, randomizes them, and then sends them on
|
5
5
|
class Randomizer
|
6
|
-
def initialize(seed, receiver)
|
6
|
+
def initialize(seed, receiver=nil)
|
7
7
|
@receiver = receiver
|
8
8
|
@test_cases = []
|
9
9
|
@seed = seed
|
@@ -22,6 +22,10 @@ module Cucumber
|
|
22
22
|
self
|
23
23
|
end
|
24
24
|
|
25
|
+
def with_receiver(receiver)
|
26
|
+
self.class.new(@seed, receiver)
|
27
|
+
end
|
28
|
+
|
25
29
|
private
|
26
30
|
|
27
31
|
def shuffled_test_cases
|
@@ -11,10 +11,11 @@ module Cucumber
|
|
11
11
|
end
|
12
12
|
|
13
13
|
class TagLimits
|
14
|
-
def initialize(tag_limits, receiver)
|
14
|
+
def initialize(tag_limits, receiver=nil)
|
15
|
+
@tag_limits = tag_limits
|
15
16
|
@gated_receiver = GatedReceiver.new(receiver)
|
16
17
|
@test_case_index = TestCaseIndex.new
|
17
|
-
@verifier = Verifier.new(tag_limits)
|
18
|
+
@verifier = Verifier.new(@tag_limits)
|
18
19
|
end
|
19
20
|
|
20
21
|
def test_case(test_case)
|
@@ -29,6 +30,10 @@ module Cucumber
|
|
29
30
|
self
|
30
31
|
end
|
31
32
|
|
33
|
+
def with_receiver(receiver)
|
34
|
+
self.class.new(@tag_limits, receiver)
|
35
|
+
end
|
36
|
+
|
32
37
|
private
|
33
38
|
|
34
39
|
attr_reader :gated_receiver
|