spinach 0.5.2 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -4,11 +4,14 @@ module Spinach
4
4
  class Runner
5
5
  describe ScenarioRunner do
6
6
  let(:feature) { stub(name: 'Feature', background_steps: []) }
7
- let(:steps) { [stub(name: 'go shopping'), stub(name: 'do something')] }
7
+ let(:steps) { [
8
+ stub(name: 'go shopping', keyword: "key"), stub(name: 'do something', keyword: "key2")
9
+ ] }
8
10
  let(:scenario) do
9
11
  stub(
10
12
  feature: feature,
11
- steps: steps
13
+ steps: steps,
14
+ name: "scenario name"
12
15
  )
13
16
  end
14
17
 
@@ -35,9 +38,14 @@ module Spinach
35
38
 
36
39
  describe '#run' do
37
40
  describe 'hooks' do
41
+ before(:each) do
42
+ subject.stubs(:step_definitions).returns step_definitions = stub
43
+ step_definitions.stubs(:before_each)
44
+ step_definitions.stubs(:after_each)
45
+ end
46
+
38
47
  it 'runs hooks in order' do
39
48
  hooks = sequence('hooks')
40
- subject.stubs(:step_definitions).returns step_definitions = stub
41
49
 
42
50
  Spinach.hooks.expects(:run_before_scenario).with(scenario, step_definitions).in_sequence(hooks)
43
51
  Spinach.hooks.expects(:run_around_scenario).with(scenario, step_definitions).in_sequence(hooks).yields
@@ -55,6 +63,21 @@ module Spinach
55
63
  subject.run
56
64
  end
57
65
 
66
+ it "runs before_each before run steps" do
67
+ before_each = sequence('before_each')
68
+ subject.stubs(:steps).returns steps = stub
69
+ step_definitions.expects(:before_each).in_sequence(before_each)
70
+ steps.expects(:each).in_sequence(before_each)
71
+ subject.run
72
+ end
73
+
74
+ it "runs after_each after run steps" do
75
+ after_each = sequence('after_each')
76
+ Spinach.hooks.expects(:run_after_step).in_sequence(after_each).twice
77
+ step_definitions.expects(:after_each).in_sequence(after_each)
78
+ subject.run
79
+ end
80
+
58
81
  it 'raises if around hook does not yield' do
59
82
  subject.stubs(:step_definitions).returns stub
60
83
 
@@ -69,9 +92,9 @@ module Spinach
69
92
 
70
93
  describe '#run_step' do
71
94
  before do
72
- @step = stub(name: 'Go shopping')
95
+ @step = stub(name: 'Go shopping', keyword: "key")
73
96
  @step_definitions = stub
74
- @step_definitions.stubs(:step_location_for).with('Go shopping').returns @location = stub
97
+ @step_definitions.stubs(:step_location_for).with('Go shopping').returns @location = [ "" ]
75
98
  subject.stubs(:step_definitions).returns @step_definitions
76
99
  end
77
100
 
@@ -36,6 +36,41 @@ describe Spinach::Runner do
36
36
  end
37
37
  end
38
38
 
39
+ describe '#init_reporter' do
40
+ describe "when no reporter_class option is passed in" do
41
+ it 'inits the default reporter' do
42
+ reporter = stub
43
+ reporter.expects(:bind)
44
+ Spinach::Reporter::Stdout.stubs(new: reporter)
45
+ runner.init_reporter
46
+ end
47
+ end
48
+
49
+ describe "when reporter_class option is passed in" do
50
+ it "inits the reporter class" do
51
+ config = Spinach::Config.new
52
+ Spinach.stubs(:config).returns(config)
53
+ config.reporter_class = "String"
54
+ reporter = stub
55
+ reporter.expects(:bind)
56
+ String.stubs(new: reporter)
57
+ runner.init_reporter
58
+ end
59
+ end
60
+
61
+ describe "when backtrace is passed in" do
62
+ it "inits with backtrace" do
63
+ config = Spinach::Config.new
64
+ Spinach.stubs(:config).returns(config)
65
+ config.reporter_options = {backtrace: true}
66
+ reporter = stub
67
+ reporter.stubs(:bind)
68
+ Spinach::Reporter::Stdout.expects(new: reporter).with(backtrace: true)
69
+ runner.init_reporter
70
+ end
71
+ end
72
+ end
73
+
39
74
  describe '#run' do
40
75
  before do
41
76
  @feature_runner = stub
@@ -47,9 +82,15 @@ describe Spinach::Runner do
47
82
  returns(@feature_runner)
48
83
  end
49
84
 
85
+ @feature_runner.stubs(:run).returns(true)
50
86
  runner.stubs(required_files: [])
51
87
  end
52
88
 
89
+ it "inits reporter" do
90
+ runner.expects(:init_reporter)
91
+ runner.run
92
+ end
93
+
53
94
  it 'instantiates a new Feature and runs it with every file' do
54
95
  @feature_runner.stubs(:run).returns(true)
55
96
  runner.run.must_equal true
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spinach
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.2
4
+ version: 0.6.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -12,11 +12,11 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2012-06-18 00:00:00.000000000 Z
15
+ date: 2012-11-27 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: gherkin-ruby
19
- requirement: &2153592980 !ruby/object:Gem::Requirement
19
+ requirement: !ruby/object:Gem::Requirement
20
20
  none: false
21
21
  requirements:
22
22
  - - ~>
@@ -24,10 +24,15 @@ dependencies:
24
24
  version: 0.2.0
25
25
  type: :runtime
26
26
  prerelease: false
27
- version_requirements: *2153592980
27
+ version_requirements: !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ~>
31
+ - !ruby/object:Gem::Version
32
+ version: 0.2.0
28
33
  - !ruby/object:Gem::Dependency
29
34
  name: colorize
30
- requirement: &2153592500 !ruby/object:Gem::Requirement
35
+ requirement: !ruby/object:Gem::Requirement
31
36
  none: false
32
37
  requirements:
33
38
  - - ! '>='
@@ -35,10 +40,15 @@ dependencies:
35
40
  version: '0'
36
41
  type: :runtime
37
42
  prerelease: false
38
- version_requirements: *2153592500
43
+ version_requirements: !ruby/object:Gem::Requirement
44
+ none: false
45
+ requirements:
46
+ - - ! '>='
47
+ - !ruby/object:Gem::Version
48
+ version: '0'
39
49
  - !ruby/object:Gem::Dependency
40
50
  name: rake
41
- requirement: &2153591980 !ruby/object:Gem::Requirement
51
+ requirement: !ruby/object:Gem::Requirement
42
52
  none: false
43
53
  requirements:
44
54
  - - ! '>='
@@ -46,10 +56,15 @@ dependencies:
46
56
  version: '0'
47
57
  type: :development
48
58
  prerelease: false
49
- version_requirements: *2153591980
59
+ version_requirements: !ruby/object:Gem::Requirement
60
+ none: false
61
+ requirements:
62
+ - - ! '>='
63
+ - !ruby/object:Gem::Version
64
+ version: '0'
50
65
  - !ruby/object:Gem::Dependency
51
66
  name: mocha
52
- requirement: &2153591360 !ruby/object:Gem::Requirement
67
+ requirement: !ruby/object:Gem::Requirement
53
68
  none: false
54
69
  requirements:
55
70
  - - ! '>='
@@ -57,10 +72,15 @@ dependencies:
57
72
  version: '0'
58
73
  type: :development
59
74
  prerelease: false
60
- version_requirements: *2153591360
75
+ version_requirements: !ruby/object:Gem::Requirement
76
+ none: false
77
+ requirements:
78
+ - - ! '>='
79
+ - !ruby/object:Gem::Version
80
+ version: '0'
61
81
  - !ruby/object:Gem::Dependency
62
82
  name: sinatra
63
- requirement: &2153590420 !ruby/object:Gem::Requirement
83
+ requirement: !ruby/object:Gem::Requirement
64
84
  none: false
65
85
  requirements:
66
86
  - - ! '>='
@@ -68,21 +88,31 @@ dependencies:
68
88
  version: '0'
69
89
  type: :development
70
90
  prerelease: false
71
- version_requirements: *2153590420
72
- - !ruby/object:Gem::Dependency
73
- name: capybara
74
- requirement: &2153589600 !ruby/object:Gem::Requirement
91
+ version_requirements: !ruby/object:Gem::Requirement
75
92
  none: false
76
93
  requirements:
77
94
  - - ! '>='
78
95
  - !ruby/object:Gem::Version
79
96
  version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: capybara
99
+ requirement: !ruby/object:Gem::Requirement
100
+ none: false
101
+ requirements:
102
+ - - ~>
103
+ - !ruby/object:Gem::Version
104
+ version: 1.1.3
80
105
  type: :development
81
106
  prerelease: false
82
- version_requirements: *2153589600
107
+ version_requirements: !ruby/object:Gem::Requirement
108
+ none: false
109
+ requirements:
110
+ - - ~>
111
+ - !ruby/object:Gem::Version
112
+ version: 1.1.3
83
113
  - !ruby/object:Gem::Dependency
84
114
  name: pry
85
- requirement: &2153589180 !ruby/object:Gem::Requirement
115
+ requirement: !ruby/object:Gem::Requirement
86
116
  none: false
87
117
  requirements:
88
118
  - - ! '>='
@@ -90,10 +120,15 @@ dependencies:
90
120
  version: '0'
91
121
  type: :development
92
122
  prerelease: false
93
- version_requirements: *2153589180
123
+ version_requirements: !ruby/object:Gem::Requirement
124
+ none: false
125
+ requirements:
126
+ - - ! '>='
127
+ - !ruby/object:Gem::Version
128
+ version: '0'
94
129
  - !ruby/object:Gem::Dependency
95
130
  name: simplecov
96
- requirement: &2153721260 !ruby/object:Gem::Requirement
131
+ requirement: !ruby/object:Gem::Requirement
97
132
  none: false
98
133
  requirements:
99
134
  - - ! '>='
@@ -101,10 +136,15 @@ dependencies:
101
136
  version: '0'
102
137
  type: :development
103
138
  prerelease: false
104
- version_requirements: *2153721260
139
+ version_requirements: !ruby/object:Gem::Requirement
140
+ none: false
141
+ requirements:
142
+ - - ! '>='
143
+ - !ruby/object:Gem::Version
144
+ version: '0'
105
145
  - !ruby/object:Gem::Dependency
106
146
  name: rspec
107
- requirement: &2153720800 !ruby/object:Gem::Requirement
147
+ requirement: !ruby/object:Gem::Requirement
108
148
  none: false
109
149
  requirements:
110
150
  - - ! '>='
@@ -112,21 +152,31 @@ dependencies:
112
152
  version: '0'
113
153
  type: :development
114
154
  prerelease: false
115
- version_requirements: *2153720800
116
- - !ruby/object:Gem::Dependency
117
- name: minitest
118
- requirement: &2153720380 !ruby/object:Gem::Requirement
155
+ version_requirements: !ruby/object:Gem::Requirement
119
156
  none: false
120
157
  requirements:
121
158
  - - ! '>='
122
159
  - !ruby/object:Gem::Version
123
160
  version: '0'
161
+ - !ruby/object:Gem::Dependency
162
+ name: minitest
163
+ requirement: !ruby/object:Gem::Requirement
164
+ none: false
165
+ requirements:
166
+ - - '='
167
+ - !ruby/object:Gem::Version
168
+ version: 4.1.0
124
169
  type: :development
125
170
  prerelease: false
126
- version_requirements: *2153720380
171
+ version_requirements: !ruby/object:Gem::Requirement
172
+ none: false
173
+ requirements:
174
+ - - '='
175
+ - !ruby/object:Gem::Version
176
+ version: 4.1.0
127
177
  - !ruby/object:Gem::Dependency
128
178
  name: turn
129
- requirement: &2153719960 !ruby/object:Gem::Requirement
179
+ requirement: !ruby/object:Gem::Requirement
130
180
  none: false
131
181
  requirements:
132
182
  - - ! '>='
@@ -134,7 +184,12 @@ dependencies:
134
184
  version: '0'
135
185
  type: :development
136
186
  prerelease: false
137
- version_requirements: *2153719960
187
+ version_requirements: !ruby/object:Gem::Requirement
188
+ none: false
189
+ requirements:
190
+ - - ! '>='
191
+ - !ruby/object:Gem::Version
192
+ version: '0'
138
193
  description: Spinach is a BDD framework on top of gherkin
139
194
  email:
140
195
  - info@codegram.com
@@ -158,8 +213,11 @@ files:
158
213
  - bin/spinach
159
214
  - features/automatic_feature_generation.feature
160
215
  - features/background.feature
216
+ - features/before_and_after_hooks.feature
217
+ - features/before_and_after_hooks_inheritance.feature
161
218
  - features/exit_status.feature
162
219
  - features/feature_name_guessing.feature
220
+ - features/reporting/customized_reporter.feature
163
221
  - features/reporting/display_run_summary.feature
164
222
  - features/reporting/error_reporting.feature
165
223
  - features/reporting/pending_feature_reporting.feature
@@ -168,6 +226,8 @@ files:
168
226
  - features/rspec_compatibility.feature
169
227
  - features/steps/automatic_feature_generation.rb
170
228
  - features/steps/background.rb
229
+ - features/steps/before_and_after_hooks.rb
230
+ - features/steps/before_and_after_hooks_inheritance.rb
171
231
  - features/steps/exit_status.rb
172
232
  - features/steps/feature_name_guessing.rb
173
233
  - features/steps/reporting/display_run_summary.rb
@@ -175,6 +235,7 @@ files:
175
235
  - features/steps/reporting/pending_feature_reporting.rb
176
236
  - features/steps/reporting/show_step_source_location.rb
177
237
  - features/steps/reporting/undefined_feature_reporting.rb
238
+ - features/steps/reporting/use_customized_reporter.rb
178
239
  - features/steps/rspec_compatibility.rb
179
240
  - features/support/env.rb
180
241
  - features/support/error_reporting.rb
@@ -195,6 +256,7 @@ files:
195
256
  - lib/spinach/generators.rb
196
257
  - lib/spinach/generators/feature_generator.rb
197
258
  - lib/spinach/generators/step_generator.rb
259
+ - lib/spinach/helpers.rb
198
260
  - lib/spinach/hookable.rb
199
261
  - lib/spinach/hooks.rb
200
262
  - lib/spinach/parser.rb
@@ -222,6 +284,7 @@ files:
222
284
  - test/spinach/generators/feature_generator_test.rb
223
285
  - test/spinach/generators/step_generator_test.rb
224
286
  - test/spinach/generators_test.rb
287
+ - test/spinach/helpers_test.rb
225
288
  - test/spinach/hookable_test.rb
226
289
  - test/spinach/hooks_test.rb
227
290
  - test/spinach/parser/visitor_test.rb
@@ -253,7 +316,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
253
316
  version: '0'
254
317
  segments:
255
318
  - 0
256
- hash: 264819993730994742
319
+ hash: -489699544028213773
257
320
  required_rubygems_version: !ruby/object:Gem::Requirement
258
321
  none: false
259
322
  requirements:
@@ -262,18 +325,21 @@ required_rubygems_version: !ruby/object:Gem::Requirement
262
325
  version: '0'
263
326
  segments:
264
327
  - 0
265
- hash: 264819993730994742
328
+ hash: -489699544028213773
266
329
  requirements: []
267
330
  rubyforge_project:
268
- rubygems_version: 1.8.15
331
+ rubygems_version: 1.8.24
269
332
  signing_key:
270
333
  specification_version: 3
271
334
  summary: Spinach is a BDD framework on top of gherkin
272
335
  test_files:
273
336
  - features/automatic_feature_generation.feature
274
337
  - features/background.feature
338
+ - features/before_and_after_hooks.feature
339
+ - features/before_and_after_hooks_inheritance.feature
275
340
  - features/exit_status.feature
276
341
  - features/feature_name_guessing.feature
342
+ - features/reporting/customized_reporter.feature
277
343
  - features/reporting/display_run_summary.feature
278
344
  - features/reporting/error_reporting.feature
279
345
  - features/reporting/pending_feature_reporting.feature
@@ -282,6 +348,8 @@ test_files:
282
348
  - features/rspec_compatibility.feature
283
349
  - features/steps/automatic_feature_generation.rb
284
350
  - features/steps/background.rb
351
+ - features/steps/before_and_after_hooks.rb
352
+ - features/steps/before_and_after_hooks_inheritance.rb
285
353
  - features/steps/exit_status.rb
286
354
  - features/steps/feature_name_guessing.rb
287
355
  - features/steps/reporting/display_run_summary.rb
@@ -289,6 +357,7 @@ test_files:
289
357
  - features/steps/reporting/pending_feature_reporting.rb
290
358
  - features/steps/reporting/show_step_source_location.rb
291
359
  - features/steps/reporting/undefined_feature_reporting.rb
360
+ - features/steps/reporting/use_customized_reporter.rb
292
361
  - features/steps/rspec_compatibility.rb
293
362
  - features/support/env.rb
294
363
  - features/support/error_reporting.rb
@@ -305,6 +374,7 @@ test_files:
305
374
  - test/spinach/generators/feature_generator_test.rb
306
375
  - test/spinach/generators/step_generator_test.rb
307
376
  - test/spinach/generators_test.rb
377
+ - test/spinach/helpers_test.rb
308
378
  - test/spinach/hookable_test.rb
309
379
  - test/spinach/hooks_test.rb
310
380
  - test/spinach/parser/visitor_test.rb