cucumber 2.0.0.beta.5 → 2.0.0.rc.1

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.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/History.md +20 -1
  3. data/Rakefile +0 -2
  4. data/cucumber.gemspec +1 -1
  5. data/features/docs/defining_steps/skip_scenario.feature +31 -2
  6. data/lib/cucumber.rb +6 -0
  7. data/lib/cucumber/ast/facade.rb +117 -0
  8. data/lib/cucumber/cli/configuration.rb +1 -1
  9. data/lib/cucumber/cli/profile_loader.rb +1 -1
  10. data/lib/cucumber/file_specs.rb +1 -1
  11. data/lib/cucumber/filters.rb +9 -0
  12. data/lib/cucumber/filters/activate_steps.rb +34 -0
  13. data/lib/cucumber/filters/apply_after_hooks.rb +9 -0
  14. data/lib/cucumber/filters/apply_after_step_hooks.rb +12 -0
  15. data/lib/cucumber/filters/apply_around_hooks.rb +12 -0
  16. data/lib/cucumber/filters/apply_before_hooks.rb +9 -0
  17. data/lib/cucumber/filters/prepare_world.rb +37 -0
  18. data/lib/cucumber/filters/quit.rb +5 -1
  19. data/lib/cucumber/filters/randomizer.rb +5 -1
  20. data/lib/cucumber/filters/tag_limits.rb +7 -2
  21. data/lib/cucumber/formatter/ansicolor.rb +0 -8
  22. data/lib/cucumber/formatter/html.rb +6 -1
  23. data/lib/cucumber/formatter/legacy_api/adapter.rb +17 -1
  24. data/lib/cucumber/formatter/legacy_api/ast.rb +6 -1
  25. data/lib/cucumber/hooks.rb +97 -0
  26. data/lib/cucumber/platform.rb +2 -3
  27. data/lib/cucumber/rb_support/rb_hook.rb +2 -2
  28. data/lib/cucumber/runtime.rb +18 -15
  29. data/lib/cucumber/runtime/after_hooks.rb +24 -0
  30. data/lib/cucumber/runtime/before_hooks.rb +23 -0
  31. data/lib/cucumber/runtime/step_hooks.rb +22 -0
  32. data/lib/cucumber/runtime/support_code.rb +56 -1
  33. data/lib/cucumber/step_match.rb +26 -2
  34. data/spec/cucumber/cli/configuration_spec.rb +16 -1
  35. data/spec/cucumber/cli/profile_loader_spec.rb +10 -0
  36. data/spec/cucumber/file_specs_spec.rb +10 -2
  37. data/spec/cucumber/filters/activate_steps_spec.rb +57 -0
  38. data/spec/cucumber/formatter/debug_spec.rb +0 -14
  39. data/spec/cucumber/formatter/html_spec.rb +29 -0
  40. data/spec/cucumber/formatter/legacy_api/adapter_spec.rb +210 -110
  41. data/spec/cucumber/formatter/pretty_spec.rb +0 -2
  42. data/spec/cucumber/formatter/rerun_spec.rb +17 -16
  43. data/spec/cucumber/formatter/spec_helper.rb +11 -6
  44. data/spec/cucumber/hooks_spec.rb +30 -0
  45. data/spec/cucumber/rb_support/rb_step_definition_spec.rb +11 -4
  46. metadata +22 -16
  47. data/gem_tasks/yard.rake +0 -43
  48. data/gem_tasks/yard/default/layout/html/bubble_32x32.png +0 -0
  49. data/gem_tasks/yard/default/layout/html/footer.erb +0 -5
  50. data/gem_tasks/yard/default/layout/html/index.erb +0 -1
  51. data/gem_tasks/yard/default/layout/html/layout.erb +0 -25
  52. data/gem_tasks/yard/default/layout/html/logo.erb +0 -1
  53. data/gem_tasks/yard/default/layout/html/setup.rb +0 -4
  54. data/lib/cucumber/mappings.rb +0 -238
  55. data/spec/cucumber/mappings_spec.rb +0 -180
@@ -1,180 +0,0 @@
1
- require_relative "../../lib/cucumber/mappings"
2
- require 'cucumber/core'
3
- require 'cucumber/core/gherkin/writer'
4
-
5
- module Cucumber
6
- class Mappings
7
- describe Scenario do
8
- include Core::Gherkin::Writer
9
- include Core
10
- let(:ruby) { double.as_null_object }
11
- let(:runtime) do
12
- double(
13
- load_programming_language: ruby,
14
- step_match: double
15
- )
16
- end
17
- let(:mappings) { Mappings.new(runtime) }
18
- let(:report) { double.as_null_object }
19
-
20
- it "responds to #source_tag_names" do
21
- define_gherkin do
22
- feature 'test', tags: '@foo @bar' do
23
- scenario 'test', tags: '@baz' do
24
- step 'passing'
25
- end
26
- end
27
- end
28
-
29
- before do |scenario|
30
- expect(scenario.source_tag_names).to eq %w(@foo @bar @baz)
31
- end
32
- end
33
-
34
- describe "#failed?" do
35
-
36
- it "is true if the test case is in a failed state" do
37
- define_gherkin do
38
- feature do
39
- scenario do
40
- step 'failing'
41
- end
42
- end
43
- end
44
-
45
- allow(runtime).to receive(:step_match) do |step_name|
46
- if step_name == 'failing'
47
- step_match = double
48
- allow(step_match).to receive(:invoke) { fail }
49
- step_match
50
- else
51
- raise Cucumber::Undefined
52
- end
53
- end
54
-
55
- after do |test_case|
56
- expect(test_case).to be_failed
57
- end
58
- end
59
-
60
- end
61
-
62
- describe "#scenario_outline" do
63
-
64
- # TODO: is this actually desired behaviour?
65
- it "throws a NoMethodError when the test case is from a scenario" do
66
- define_gherkin do
67
- feature do
68
- scenario do
69
- step 'passing'
70
- end
71
- end
72
- end
73
-
74
- before do |test_case|
75
- expect{ test_case.scenario_outline }.to raise_error(NoMethodError)
76
- end
77
- end
78
-
79
- it "points to self when the test case is from a scenario outline" do
80
- define_gherkin do
81
- feature do
82
- scenario_outline 'outline' do
83
- step 'passing'
84
-
85
- examples 'examples' do
86
- row 'a'
87
- row '1'
88
- end
89
- end
90
- end
91
- end
92
-
93
- before do |test_case|
94
- expect(test_case.scenario_outline).to_not be_nil
95
- expect(test_case.scenario_outline.name).to eq "Scenario Outline: outline, examples (row 1)"
96
- end
97
- end
98
-
99
- end
100
-
101
- describe "#outline?" do
102
-
103
- it "returns false when the test case is from a scenario" do
104
- define_gherkin do
105
- feature do
106
- scenario do
107
- step 'passing'
108
- end
109
- end
110
- end
111
-
112
- before do |test_case|
113
- expect(test_case).to_not be_an_outline
114
- end
115
- end
116
-
117
- it "returns true when the test case is from a scenario" do
118
- define_gherkin do
119
- feature do
120
- scenario_outline do
121
- step 'passing'
122
-
123
- examples 'examples' do
124
- row 'a'
125
- row '1'
126
- end
127
- end
128
- end
129
- end
130
-
131
- before do |test_case|
132
- expect(test_case).to be_an_outline
133
- end
134
- end
135
-
136
- end
137
- attr_accessor :gherkin_docs
138
-
139
- def define_gherkin(&block)
140
- self.gherkin_docs = [gherkin(&block)]
141
- end
142
-
143
- def before
144
- # TODO: the complexity of this stubbing shows we need to clean up the interface
145
- scenario_spy = nil
146
- allow(ruby).to receive(:hooks_for) do |phase, scenario|
147
- if phase == :before
148
- hook = double
149
- expect(hook).to receive(:invoke) do |phase, scenario|
150
- scenario_spy = scenario
151
- end
152
- [hook]
153
- else
154
- []
155
- end
156
- end
157
- execute gherkin_docs, mappings, report
158
- yield scenario_spy
159
- end
160
-
161
- def after
162
- # TODO: the complexity of this stubbing shows we need to clean up the interface
163
- scenario_spy = nil
164
- allow(ruby).to receive(:hooks_for) do |phase, scenario|
165
- if phase == :after
166
- hook = double
167
- expect(hook).to receive(:invoke) do |phase, scenario|
168
- scenario_spy = scenario
169
- end
170
- [hook]
171
- else
172
- []
173
- end
174
- end
175
- execute gherkin_docs, mappings, report
176
- yield scenario_spy
177
- end
178
- end
179
- end
180
- end