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.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +1 -1
  3. data/cucumber-core.gemspec +1 -1
  4. data/lib/cucumber/core.rb +6 -6
  5. data/lib/cucumber/core/ast/data_table.rb +8 -0
  6. data/lib/cucumber/core/ast/describes_itself.rb +1 -1
  7. data/lib/cucumber/core/ast/examples_table.rb +8 -2
  8. data/lib/cucumber/core/ast/feature.rb +2 -3
  9. data/lib/cucumber/core/ast/location.rb +11 -6
  10. data/lib/cucumber/core/ast/names.rb +10 -1
  11. data/lib/cucumber/core/ast/outline_step.rb +6 -3
  12. data/lib/cucumber/core/ast/scenario.rb +0 -1
  13. data/lib/cucumber/core/ast/scenario_outline.rb +2 -3
  14. data/lib/cucumber/core/ast/step.rb +2 -2
  15. data/lib/cucumber/core/gherkin/ast_builder.rb +4 -1
  16. data/lib/cucumber/core/test/case.rb +10 -6
  17. data/lib/cucumber/core/test/filters/debug_filter.rb +28 -0
  18. data/lib/cucumber/core/test/filters/tag_filter.rb +1 -1
  19. data/lib/cucumber/core/test/hooks.rb +76 -0
  20. data/lib/cucumber/core/test/mapper.rb +101 -19
  21. data/lib/cucumber/core/test/mapping.rb +15 -4
  22. data/lib/cucumber/core/test/result.rb +39 -27
  23. data/lib/cucumber/core/test/runner.rb +76 -81
  24. data/lib/cucumber/core/test/step.rb +10 -18
  25. data/lib/cucumber/core/version.rb +1 -1
  26. data/spec/cucumber/core/ast/data_table_spec.rb +12 -0
  27. data/spec/cucumber/core/ast/location_spec.rb +8 -1
  28. data/spec/cucumber/core/ast/outline_step_spec.rb +11 -4
  29. data/spec/cucumber/core/ast/step_spec.rb +2 -2
  30. data/spec/cucumber/core/compiler_spec.rb +6 -6
  31. data/spec/cucumber/core/gherkin/parser_spec.rb +31 -18
  32. data/spec/cucumber/core/test/case_spec.rb +24 -24
  33. data/spec/cucumber/core/test/hooks_spec.rb +30 -0
  34. data/spec/cucumber/core/test/mapper_spec.rb +115 -1
  35. data/spec/cucumber/core/test/mapping_spec.rb +22 -6
  36. data/spec/cucumber/core/test/result_spec.rb +0 -8
  37. data/spec/cucumber/core/test/runner_spec.rb +31 -97
  38. data/spec/cucumber/core/test/step_spec.rb +24 -16
  39. data/spec/cucumber/core_spec.rb +109 -16
  40. data/spec/report_api_spy.rb +24 -0
  41. metadata +32 -28
  42. data/lib/cucumber/core/test/hook_compiler.rb +0 -109
  43. 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