cucumber-core 0.2.0 → 1.0.0.beta.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -1
- data/cucumber-core.gemspec +1 -1
- data/lib/cucumber/core.rb +6 -6
- data/lib/cucumber/core/ast/data_table.rb +8 -0
- data/lib/cucumber/core/ast/describes_itself.rb +1 -1
- data/lib/cucumber/core/ast/examples_table.rb +8 -2
- data/lib/cucumber/core/ast/feature.rb +2 -3
- data/lib/cucumber/core/ast/location.rb +11 -6
- data/lib/cucumber/core/ast/names.rb +10 -1
- data/lib/cucumber/core/ast/outline_step.rb +6 -3
- data/lib/cucumber/core/ast/scenario.rb +0 -1
- data/lib/cucumber/core/ast/scenario_outline.rb +2 -3
- data/lib/cucumber/core/ast/step.rb +2 -2
- data/lib/cucumber/core/gherkin/ast_builder.rb +4 -1
- data/lib/cucumber/core/test/case.rb +10 -6
- data/lib/cucumber/core/test/filters/debug_filter.rb +28 -0
- data/lib/cucumber/core/test/filters/tag_filter.rb +1 -1
- data/lib/cucumber/core/test/hooks.rb +76 -0
- data/lib/cucumber/core/test/mapper.rb +101 -19
- data/lib/cucumber/core/test/mapping.rb +15 -4
- data/lib/cucumber/core/test/result.rb +39 -27
- data/lib/cucumber/core/test/runner.rb +76 -81
- data/lib/cucumber/core/test/step.rb +10 -18
- data/lib/cucumber/core/version.rb +1 -1
- data/spec/cucumber/core/ast/data_table_spec.rb +12 -0
- data/spec/cucumber/core/ast/location_spec.rb +8 -1
- data/spec/cucumber/core/ast/outline_step_spec.rb +11 -4
- data/spec/cucumber/core/ast/step_spec.rb +2 -2
- data/spec/cucumber/core/compiler_spec.rb +6 -6
- data/spec/cucumber/core/gherkin/parser_spec.rb +31 -18
- data/spec/cucumber/core/test/case_spec.rb +24 -24
- data/spec/cucumber/core/test/hooks_spec.rb +30 -0
- data/spec/cucumber/core/test/mapper_spec.rb +115 -1
- data/spec/cucumber/core/test/mapping_spec.rb +22 -6
- data/spec/cucumber/core/test/result_spec.rb +0 -8
- data/spec/cucumber/core/test/runner_spec.rb +31 -97
- data/spec/cucumber/core/test/step_spec.rb +24 -16
- data/spec/cucumber/core_spec.rb +109 -16
- data/spec/report_api_spy.rb +24 -0
- metadata +32 -28
- data/lib/cucumber/core/test/hook_compiler.rb +0 -109
- data/spec/cucumber/core/test/hook_compiler_spec.rb +0 -78
@@ -1,78 +0,0 @@
|
|
1
|
-
require 'cucumber/core/test/hook_compiler'
|
2
|
-
require 'cucumber/core/test/case'
|
3
|
-
require 'cucumber/core/test/step'
|
4
|
-
require 'cucumber/core/test/runner'
|
5
|
-
require 'cucumber/core/test/mapper'
|
6
|
-
|
7
|
-
module Cucumber::Core::Test
|
8
|
-
describe HookCompiler do
|
9
|
-
|
10
|
-
subject(:hook_compiler) { HookCompiler.new(mappings, receiver) }
|
11
|
-
let(:mappings) { double('mappings', test_case: nil) }
|
12
|
-
let(:receiver) { double('receiver', test_case: nil) }
|
13
|
-
let(:test_case) { Case.new([test_step], source) }
|
14
|
-
let(:test_step) { Step.new([double('step', name: 'passing')]) }
|
15
|
-
let(:source) { [feature, scenario] }
|
16
|
-
let(:feature) { double('feature') }
|
17
|
-
let(:scenario) { double('scenario') }
|
18
|
-
|
19
|
-
before do
|
20
|
-
expect( receiver ).to receive(:test_case) do |test_case|
|
21
|
-
expect( test_case ).to have(1).test_steps
|
22
|
-
end
|
23
|
-
test_case.describe_to hook_compiler
|
24
|
-
end
|
25
|
-
|
26
|
-
it "prepends before hooks to the test case" do
|
27
|
-
mappings.stub(:test_case) do |test_case, mapper|
|
28
|
-
mapper.before {}
|
29
|
-
end
|
30
|
-
expect( receiver ).to receive(:test_case) do |test_case|
|
31
|
-
expect( test_case ).to have(2).test_steps
|
32
|
-
end
|
33
|
-
test_case.describe_to hook_compiler
|
34
|
-
end
|
35
|
-
|
36
|
-
it "appends after hooks to the test case" do
|
37
|
-
mappings.stub(:test_case) do |test_case, mapper|
|
38
|
-
mapper.after {}
|
39
|
-
end
|
40
|
-
expect( receiver ).to receive(:test_case) do |test_case|
|
41
|
-
expect( test_case ).to have(2).test_steps
|
42
|
-
end
|
43
|
-
test_case.describe_to hook_compiler
|
44
|
-
end
|
45
|
-
|
46
|
-
it "adds hooks in the right order" do
|
47
|
-
log = double
|
48
|
-
mappings.stub(:test_case) do |test_case, mapper|
|
49
|
-
mapper.before { log.before }
|
50
|
-
mapper.after { log.after }
|
51
|
-
end
|
52
|
-
mappings.stub(:test_step) do |test_step, mapper|
|
53
|
-
mapper.map { log.step }
|
54
|
-
end
|
55
|
-
[:before, :step, :after].each do |message|
|
56
|
-
expect( log ).to receive(message).ordered
|
57
|
-
end
|
58
|
-
runner = Runner.new(double.as_null_object)
|
59
|
-
mapper = Mapper.new(mappings, runner)
|
60
|
-
hook_compiler = HookCompiler.new(mappings, mapper)
|
61
|
-
test_case.describe_to hook_compiler
|
62
|
-
end
|
63
|
-
|
64
|
-
it "sets the source on the hook step to be just the hook" do
|
65
|
-
test_case = Case.new([], source)
|
66
|
-
mappings.stub(:test_case) do |test_case_to_be_mapped, mapper|
|
67
|
-
mapper.before {}
|
68
|
-
end
|
69
|
-
receiver.stub(:test_case).and_yield
|
70
|
-
receiver.stub(:test_step) do |test_step|
|
71
|
-
expect( receiver ).to receive(:hook)
|
72
|
-
test_step.describe_source_to(receiver)
|
73
|
-
end
|
74
|
-
test_case.describe_to(hook_compiler)
|
75
|
-
end
|
76
|
-
|
77
|
-
end
|
78
|
-
end
|