cucumber-core 1.1.1 → 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/HISTORY.md +8 -3
- data/lib/cucumber/core/ast/data_table.rb +8 -0
- data/lib/cucumber/core/ast/doc_string.rb +8 -0
- data/lib/cucumber/core/ast/empty_multiline_argument.rb +8 -0
- data/lib/cucumber/core/test/around_hook.rb +13 -1
- data/lib/cucumber/core/test/case.rb +5 -6
- data/lib/cucumber/core/test/runner.rb +6 -6
- data/lib/cucumber/core/version.rb +1 -1
- data/spec/cucumber/core/ast/data_table_spec.rb +16 -0
- data/spec/cucumber/core/ast/doc_string_spec.rb +16 -0
- data/spec/cucumber/core/ast/empty_multiline_argument_spec.rb +27 -0
- data/spec/cucumber/core/test/case_spec.rb +4 -4
- data/spec/cucumber/core/test/runner_spec.rb +47 -1
- data/spec/cucumber/core_spec.rb +1 -1
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3f3a3d2a1c3f4b18449225549d35fedcf56dde29
|
4
|
+
data.tar.gz: d7ea03f3906eb56001fd04625875d17a45711680
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 066615ed100d54bf46fc955adc8bc7e1b52b4e9617d82247b436baf3138f05ada07afdeb4f1f5767787cb97fc4f299ddb03a09d48129f92cc79144e88257bb98
|
7
|
+
data.tar.gz: 1a2e6cef1e122116f914087cb44b9e01884ea0c6de67c7c3fb045267db93fc37ff976e5c0aebf33db5540829ede1209512bfd5e341de3cd2b945d71c0a6f85ed
|
data/HISTORY.md
CHANGED
@@ -1,9 +1,14 @@
|
|
1
1
|
## [In Git](https://github.com/cucumber/cucumber-ruby-core/compare/v1.1.1...master)
|
2
2
|
|
3
|
-
|
3
|
+
### New Features
|
4
|
+
|
5
|
+
* Make Test Case names for Scenario Outlines language neutral [83](https://github.com/cucumber/cucumber-ruby-core/pull/83) (@brasmusson)
|
6
|
+
* Add predicate methods for Multline arguments (@mattwynne)
|
7
|
+
* Expose `Test::Case#feature` (@mattwynne)
|
8
|
+
* Fail test case if around hook fails (@mattwynne, @tooky)
|
9
|
+
* Expose `Test::Case#around_hooks` (@tooky)
|
4
10
|
|
5
|
-
##
|
6
|
-
[v1.1.1](https://github.com/cucumber/cucumber-ruby-core/compare/v1.1.1...v1.1.1)
|
11
|
+
## [v1.1.1](https://github.com/cucumber/cucumber-ruby-core/compare/v1.1.0...v1.1.1)
|
7
12
|
|
8
13
|
|
9
14
|
### New Features
|
@@ -4,14 +4,26 @@ module Cucumber
|
|
4
4
|
class AroundHook
|
5
5
|
def initialize(&block)
|
6
6
|
@block = block
|
7
|
+
@timer = Timer.new
|
7
8
|
end
|
8
9
|
|
9
10
|
def describe_to(visitor, *args, &continue)
|
10
11
|
visitor.around_hook(self, *args, &continue)
|
11
12
|
end
|
12
13
|
|
13
|
-
def
|
14
|
+
def execute(*args, &continue)
|
15
|
+
@timer.start
|
14
16
|
@block.call(continue)
|
17
|
+
Result::Unknown.new # Around hook does not know the result of the inner test steps
|
18
|
+
rescue Result::Raisable => exception
|
19
|
+
exception.with_duration(@timer.duration)
|
20
|
+
rescue Exception => exception
|
21
|
+
failed(exception)
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
def failed(exception)
|
26
|
+
Result::Failed.new(@timer.duration, exception)
|
15
27
|
end
|
16
28
|
end
|
17
29
|
end
|
@@ -5,7 +5,6 @@ module Cucumber
|
|
5
5
|
module Test
|
6
6
|
class Case
|
7
7
|
attr_reader :source, :test_steps, :around_hooks
|
8
|
-
private :around_hooks
|
9
8
|
|
10
9
|
def initialize(test_steps, source, around_hooks = [])
|
11
10
|
raise ArgumentError.new("test_steps should be an Array but is a #{test_steps.class}") unless test_steps.kind_of?(Array)
|
@@ -82,6 +81,10 @@ module Cucumber
|
|
82
81
|
"<#{self.class}: #{location}>"
|
83
82
|
end
|
84
83
|
|
84
|
+
def feature
|
85
|
+
source.first
|
86
|
+
end
|
87
|
+
|
85
88
|
private
|
86
89
|
|
87
90
|
def compose_around_hooks(visitor, *args, &block)
|
@@ -90,10 +93,6 @@ module Cucumber
|
|
90
93
|
end.call
|
91
94
|
end
|
92
95
|
|
93
|
-
def feature
|
94
|
-
source.first
|
95
|
-
end
|
96
|
-
|
97
96
|
class NameBuilder
|
98
97
|
attr_reader :result
|
99
98
|
attr_reader :keyword
|
@@ -126,7 +125,7 @@ module Cucumber
|
|
126
125
|
end
|
127
126
|
|
128
127
|
def examples_table_row(row)
|
129
|
-
@result = " (
|
128
|
+
@result = " (##{row.number})"
|
130
129
|
self
|
131
130
|
end
|
132
131
|
end
|
@@ -27,7 +27,7 @@ module Cucumber
|
|
27
27
|
end
|
28
28
|
|
29
29
|
def around_hook(hook, &continue)
|
30
|
-
|
30
|
+
running_test_case.execute(hook, &continue)
|
31
31
|
self
|
32
32
|
end
|
33
33
|
|
@@ -42,8 +42,8 @@ module Cucumber
|
|
42
42
|
@status = Status::Unknown.new(Result::Unknown.new)
|
43
43
|
end
|
44
44
|
|
45
|
-
def execute(test_step)
|
46
|
-
status.execute(test_step, self)
|
45
|
+
def execute(test_step, &continue)
|
46
|
+
status.execute(test_step, self, &continue)
|
47
47
|
end
|
48
48
|
|
49
49
|
def result
|
@@ -95,8 +95,8 @@ module Cucumber
|
|
95
95
|
@step_result = step_result
|
96
96
|
end
|
97
97
|
|
98
|
-
def execute(test_step, monitor)
|
99
|
-
result = test_step.execute(monitor.result)
|
98
|
+
def execute(test_step, monitor, &continue)
|
99
|
+
result = test_step.execute(monitor.result, &continue)
|
100
100
|
result.describe_to(monitor, result)
|
101
101
|
end
|
102
102
|
|
@@ -118,7 +118,7 @@ module Cucumber
|
|
118
118
|
end
|
119
119
|
|
120
120
|
class Failing < Base
|
121
|
-
def execute(test_step, monitor)
|
121
|
+
def execute(test_step, monitor, &continue)
|
122
122
|
test_step.skip(monitor.result)
|
123
123
|
end
|
124
124
|
|
@@ -28,6 +28,22 @@ module Cucumber
|
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
31
|
+
describe "#data_table?" do
|
32
|
+
let(:table) { DataTable.new([[1,2],[3,4]], location) }
|
33
|
+
|
34
|
+
it "returns true" do
|
35
|
+
expect(table).to be_data_table
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
describe "#doc_string" do
|
40
|
+
let(:table) { DataTable.new([[1,2],[3,4]], location) }
|
41
|
+
|
42
|
+
it "returns false" do
|
43
|
+
expect(table).not_to be_doc_string
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
31
47
|
describe "#map" do
|
32
48
|
let(:table) { DataTable.new([ %w{foo bar}, %w{1 2} ], location) }
|
33
49
|
|
@@ -8,6 +8,22 @@ module Cucumber
|
|
8
8
|
let(:location) { double }
|
9
9
|
let(:doc_string) { DocString.new(content, content_type, location) }
|
10
10
|
|
11
|
+
describe "#data_table?" do
|
12
|
+
let(:doc_string) { DocString.new("test", "text/plain" , location) }
|
13
|
+
|
14
|
+
it "returns false" do
|
15
|
+
expect(doc_string).not_to be_data_table
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
describe "#doc_string" do
|
20
|
+
let(:doc_string) { DocString.new("test", "text/plain" , location) }
|
21
|
+
|
22
|
+
it "returns true" do
|
23
|
+
expect(doc_string).to be_doc_string
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
11
27
|
context '#map' do
|
12
28
|
let(:content) { 'original content' }
|
13
29
|
let(:content_type) { double }
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'cucumber/core/ast/location'
|
2
|
+
require 'cucumber/core/ast/empty_multiline_argument'
|
3
|
+
|
4
|
+
module Cucumber
|
5
|
+
module Core
|
6
|
+
module Ast
|
7
|
+
describe EmptyMultilineArgument do
|
8
|
+
|
9
|
+
let(:location) { double }
|
10
|
+
let(:arg) { EmptyMultilineArgument.new }
|
11
|
+
|
12
|
+
describe "#data_table?" do
|
13
|
+
it "returns false" do
|
14
|
+
expect(arg).not_to be_data_table
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
describe "#doc_string" do
|
19
|
+
it "returns false" do
|
20
|
+
expect(arg).not_to be_doc_string
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -97,14 +97,14 @@ module Cucumber
|
|
97
97
|
end
|
98
98
|
receiver = double.as_null_object
|
99
99
|
expect( receiver ).to receive(:test_case) do |test_case|
|
100
|
-
expect( test_case.name ).to eq 'outline name, examples name (
|
100
|
+
expect( test_case.name ).to eq 'outline name, examples name (#1)'
|
101
101
|
expect( test_case.keyword ).to eq 'Scenario Outline'
|
102
102
|
end.once.ordered
|
103
103
|
expect( receiver ).to receive(:test_case) do |test_case|
|
104
|
-
expect( test_case.name ).to eq 'outline name, examples name (
|
104
|
+
expect( test_case.name ).to eq 'outline name, examples name (#2)'
|
105
105
|
end.once.ordered
|
106
106
|
expect( receiver ).to receive(:test_case) do |test_case|
|
107
|
-
expect( test_case.name ).to eq 'outline name, Examples (
|
107
|
+
expect( test_case.name ).to eq 'outline name, Examples (#1)'
|
108
108
|
end.once.ordered
|
109
109
|
compile [gherkin], receiver
|
110
110
|
end
|
@@ -378,7 +378,7 @@ module Cucumber
|
|
378
378
|
end
|
379
379
|
|
380
380
|
let(:test_case) do
|
381
|
-
test_cases.find { |c| c.name == "two, x1 (
|
381
|
+
test_cases.find { |c| c.name == "two, x1 (#1)" }
|
382
382
|
end
|
383
383
|
|
384
384
|
it 'matches the precise location of the scenario outline examples table row' do
|
@@ -7,7 +7,7 @@ module Cucumber::Core::Test
|
|
7
7
|
describe Runner do
|
8
8
|
|
9
9
|
let(:test_case) { Case.new(test_steps, source) }
|
10
|
-
let(:source) { double }
|
10
|
+
let(:source) { [double('ast node', location: double)] }
|
11
11
|
let(:runner) { Runner.new(report) }
|
12
12
|
let(:report) { double.as_null_object }
|
13
13
|
let(:passing) { Step.new([double]).with_action {} }
|
@@ -210,5 +210,51 @@ module Cucumber::Core::Test
|
|
210
210
|
end
|
211
211
|
end
|
212
212
|
|
213
|
+
require 'cucumber/core/test/around_hook'
|
214
|
+
context "with around hooks" do
|
215
|
+
it "passes normally when around hooks don't fail" do
|
216
|
+
around_hook = AroundHook.new { |block| block.call }
|
217
|
+
passing_step = Step.new([double]).with_action {}
|
218
|
+
test_case = Case.new([passing_step], source, [around_hook])
|
219
|
+
expect(report).to receive(:after_test_case).with(test_case, anything) do |reported_test_case, result|
|
220
|
+
expect(result).to be_passed
|
221
|
+
end
|
222
|
+
test_case.describe_to runner
|
223
|
+
end
|
224
|
+
|
225
|
+
it "gets a failed result if the Around hook fails before the test case is run" do
|
226
|
+
around_hook = AroundHook.new { |block| raise exception }
|
227
|
+
passing_step = Step.new([double]).with_action {}
|
228
|
+
test_case = Case.new([passing_step], source, [around_hook])
|
229
|
+
expect(report).to receive(:after_test_case).with(test_case, anything) do |reported_test_case, result|
|
230
|
+
expect(result).to be_failed
|
231
|
+
expect(result.exception).to eq exception
|
232
|
+
end
|
233
|
+
test_case.describe_to runner
|
234
|
+
end
|
235
|
+
|
236
|
+
it "gets a failed result if the Around hook fails after the test case is run" do
|
237
|
+
around_hook = AroundHook.new { |block| block.call; raise exception }
|
238
|
+
passing_step = Step.new([double]).with_action {}
|
239
|
+
test_case = Case.new([passing_step], source, [around_hook])
|
240
|
+
expect(report).to receive(:after_test_case).with(test_case, anything) do |reported_test_case, result|
|
241
|
+
expect(result).to be_failed
|
242
|
+
expect(result.exception).to eq exception
|
243
|
+
end
|
244
|
+
test_case.describe_to runner
|
245
|
+
end
|
246
|
+
|
247
|
+
it "fails when a step fails if the around hook works" do
|
248
|
+
around_hook = AroundHook.new { |block| block.call }
|
249
|
+
failing_step = Step.new([double]).with_action { raise exception }
|
250
|
+
test_case = Case.new([failing_step], source, [around_hook])
|
251
|
+
expect(report).to receive(:after_test_case).with(test_case, anything) do |reported_test_case, result|
|
252
|
+
expect(result).to be_failed
|
253
|
+
expect(result.exception).to eq exception
|
254
|
+
end
|
255
|
+
test_case.describe_to runner
|
256
|
+
end
|
257
|
+
end
|
258
|
+
|
213
259
|
end
|
214
260
|
end
|
data/spec/cucumber/core_spec.rb
CHANGED
@@ -48,7 +48,7 @@ module Cucumber
|
|
48
48
|
it "filters out test cases based on a tag expression" do
|
49
49
|
visitor = double.as_null_object
|
50
50
|
expect( visitor ).to receive(:test_case) do |test_case|
|
51
|
-
expect( test_case.name ).to eq 'foo, bar (
|
51
|
+
expect( test_case.name ).to eq 'foo, bar (#1)'
|
52
52
|
end.exactly(1).times
|
53
53
|
|
54
54
|
gherkin = gherkin do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cucumber-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aslak Hellesøy
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date: 2015-
|
15
|
+
date: 2015-03-19 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: gherkin
|
@@ -173,6 +173,7 @@ files:
|
|
173
173
|
- spec/coverage.rb
|
174
174
|
- spec/cucumber/core/ast/data_table_spec.rb
|
175
175
|
- spec/cucumber/core/ast/doc_string_spec.rb
|
176
|
+
- spec/cucumber/core/ast/empty_multiline_argument_spec.rb
|
176
177
|
- spec/cucumber/core/ast/examples_table_spec.rb
|
177
178
|
- spec/cucumber/core/ast/location_spec.rb
|
178
179
|
- spec/cucumber/core/ast/outline_step_spec.rb
|
@@ -216,12 +217,13 @@ rubyforge_project:
|
|
216
217
|
rubygems_version: 2.2.2
|
217
218
|
signing_key:
|
218
219
|
specification_version: 4
|
219
|
-
summary: cucumber-core-1.1.
|
220
|
+
summary: cucumber-core-1.1.2
|
220
221
|
test_files:
|
221
222
|
- spec/capture_warnings.rb
|
222
223
|
- spec/coverage.rb
|
223
224
|
- spec/cucumber/core/ast/data_table_spec.rb
|
224
225
|
- spec/cucumber/core/ast/doc_string_spec.rb
|
226
|
+
- spec/cucumber/core/ast/empty_multiline_argument_spec.rb
|
225
227
|
- spec/cucumber/core/ast/examples_table_spec.rb
|
226
228
|
- spec/cucumber/core/ast/location_spec.rb
|
227
229
|
- spec/cucumber/core/ast/outline_step_spec.rb
|