spinach 0.1.5.4 → 0.2.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. data/Gemfile +2 -0
  2. data/README.markdown +18 -12
  3. data/features/background.feature +13 -0
  4. data/features/reporting/show_step_source_location.feature +11 -1
  5. data/features/steps/automatic_feature_generation.rb +7 -7
  6. data/features/steps/background.rb +30 -0
  7. data/features/steps/exit_status.rb +12 -13
  8. data/features/steps/feature_name_guessing.rb +7 -7
  9. data/features/steps/reporting/display_run_summary.rb +22 -22
  10. data/features/steps/reporting/error_reporting.rb +7 -7
  11. data/features/steps/reporting/show_step_source_location.rb +63 -14
  12. data/features/steps/reporting/undefined_feature_reporting.rb +7 -7
  13. data/features/steps/rspec_compatibility.rb +14 -14
  14. data/features/support/error_reporting.rb +5 -5
  15. data/features/support/filesystem.rb +71 -0
  16. data/features/support/spinach_runner.rb +5 -6
  17. data/lib/spinach.rb +11 -6
  18. data/lib/spinach/background.rb +11 -0
  19. data/lib/spinach/capybara.rb +7 -1
  20. data/lib/spinach/cli.rb +36 -13
  21. data/lib/spinach/config.rb +40 -6
  22. data/lib/spinach/dsl.rb +14 -11
  23. data/lib/spinach/exceptions.rb +1 -1
  24. data/lib/spinach/feature.rb +16 -0
  25. data/lib/spinach/frameworks.rb +2 -0
  26. data/lib/spinach/{suites → frameworks}/minitest.rb +0 -0
  27. data/lib/spinach/{suites → frameworks}/rspec.rb +0 -0
  28. data/lib/spinach/generators/feature_generator.rb +12 -23
  29. data/lib/spinach/generators/step_generator.rb +5 -5
  30. data/lib/spinach/hookable.rb +6 -4
  31. data/lib/spinach/hooks.rb +12 -4
  32. data/lib/spinach/parser.rb +6 -8
  33. data/lib/spinach/parser/visitor.rb +109 -0
  34. data/lib/spinach/reporter.rb +10 -6
  35. data/lib/spinach/reporter/stdout.rb +41 -16
  36. data/lib/spinach/reporter/stdout/error_reporting.rb +2 -2
  37. data/lib/spinach/runner.rb +9 -6
  38. data/lib/spinach/runner/feature_runner.rb +40 -34
  39. data/lib/spinach/runner/scenario_runner.rb +63 -36
  40. data/lib/spinach/scenario.rb +12 -0
  41. data/lib/spinach/step.rb +10 -0
  42. data/lib/spinach/version.rb +1 -1
  43. data/spinach.gemspec +3 -3
  44. data/test/spinach/background_test.rb +6 -0
  45. data/test/spinach/capybara_test.rb +30 -13
  46. data/test/spinach/cli_test.rb +46 -1
  47. data/test/spinach/config_test.rb +39 -0
  48. data/test/spinach/dsl_test.rb +12 -10
  49. data/test/spinach/feature_steps_test.rb +3 -3
  50. data/test/spinach/feature_test.rb +6 -0
  51. data/test/spinach/{suites → frameworks}/minitest_test.rb +2 -2
  52. data/test/spinach/generators/feature_generator_test.rb +18 -58
  53. data/test/spinach/generators/step_generator_test.rb +3 -3
  54. data/test/spinach/generators_test.rb +12 -10
  55. data/test/spinach/hookable_test.rb +8 -0
  56. data/test/spinach/hooks_test.rb +6 -7
  57. data/test/spinach/parser/visitor_test.rb +173 -0
  58. data/test/spinach/parser_test.rb +14 -27
  59. data/test/spinach/reporter/stdout/error_reporting_test.rb +9 -9
  60. data/test/spinach/reporter/stdout_test.rb +15 -19
  61. data/test/spinach/reporter_test.rb +15 -0
  62. data/test/spinach/runner/feature_runner_test.rb +79 -69
  63. data/test/spinach/runner/scenario_runner_test.rb +118 -92
  64. data/test/spinach/runner_test.rb +10 -6
  65. data/test/spinach/scenario_test.rb +6 -0
  66. data/test/spinach/step_test.rb +6 -0
  67. data/test/spinach_test.rb +7 -7
  68. metadata +60 -39
  69. data/lib/spinach/suites.rb +0 -2
@@ -38,22 +38,26 @@ describe Spinach::Runner do
38
38
 
39
39
  describe '#run' do
40
40
  before do
41
- @feature = stub
41
+ @feature_runner = stub
42
42
  filenames.each do |filename|
43
+ Spinach::Parser.expects(:open_file).with(filename).returns parser = stub
44
+ parser.stubs(:parse).returns feature = stub
43
45
  Spinach::Runner::FeatureRunner.expects(:new).
44
- with(filename, anything).
45
- returns(@feature)
46
+ with(feature, anything).
47
+ returns(@feature_runner)
46
48
  end
49
+
50
+ runner.stubs(required_files: [])
47
51
  end
48
52
 
49
53
  it 'instantiates a new Feature and runs it with every file' do
50
- @feature.stubs(run: true)
54
+ @feature_runner.stubs(:run).returns(true)
51
55
  runner.run.must_equal true
52
56
  end
53
57
 
54
58
  it 'returns false if it fails' do
55
- @feature.stubs(run: false)
56
- runner.run
59
+ @feature_runner.stubs(:run).returns(false)
60
+ runner.run.must_equal false
57
61
  end
58
62
  end
59
63
 
@@ -0,0 +1,6 @@
1
+ require 'test_helper'
2
+
3
+ module Spinach
4
+ describe Scenario do
5
+ end
6
+ end
@@ -0,0 +1,6 @@
1
+ require 'test_helper'
2
+
3
+ module Spinach
4
+ describe Step do
5
+ end
6
+ end
data/test/spinach_test.rb CHANGED
@@ -29,20 +29,20 @@ describe Spinach do
29
29
  end
30
30
  end
31
31
 
32
- describe '#find_feature_steps' do
32
+ describe '#find_step_definitions' do
33
33
  it 'finds a feature by name' do
34
- Spinach.find_feature_steps('User authentication').must_equal @feature_steps1
35
- Spinach.find_feature_steps('Slip management').must_equal @feature_steps2
36
- Spinach.find_feature_steps('File attachments').must_equal @feature_steps3
34
+ Spinach.find_step_definitions('User authentication').must_equal @feature_steps1
35
+ Spinach.find_step_definitions('Slip management').must_equal @feature_steps2
36
+ Spinach.find_step_definitions('File attachments').must_equal @feature_steps3
37
37
  end
38
38
 
39
- describe 'when a feature class does no set a feature_name' do
39
+ describe 'when a feature class does not set a feature_name' do
40
40
  it 'guesses the feature class from the feature name' do
41
- Spinach.find_feature_steps('User sends a message').must_equal @feature_steps4
41
+ Spinach.find_step_definitions('User sends a message').must_equal @feature_steps4
42
42
  end
43
43
 
44
44
  it 'returns nil when it cannot find the class' do
45
- Spinach.find_feature_steps('This feature does not exist').must_equal nil
45
+ Spinach.find_step_definitions('This feature does not exist').must_equal nil
46
46
  end
47
47
  end
48
48
  end
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.1.5.4
4
+ version: 0.2.0.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -12,22 +12,22 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2011-11-01 00:00:00.000000000 Z
15
+ date: 2012-01-18 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
- name: gherkin
19
- requirement: &70148296624980 !ruby/object:Gem::Requirement
18
+ name: gherkin-ruby
19
+ requirement: &70348225806600 !ruby/object:Gem::Requirement
20
20
  none: false
21
21
  requirements:
22
- - - =
22
+ - - ~>
23
23
  - !ruby/object:Gem::Version
24
- version: 2.5.4
24
+ version: 0.0.2
25
25
  type: :runtime
26
26
  prerelease: false
27
- version_requirements: *70148296624980
27
+ version_requirements: *70348225806600
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: colorize
30
- requirement: &70148296623440 !ruby/object:Gem::Requirement
30
+ requirement: &70348225806100 !ruby/object:Gem::Requirement
31
31
  none: false
32
32
  requirements:
33
33
  - - ! '>='
@@ -35,10 +35,10 @@ dependencies:
35
35
  version: '0'
36
36
  type: :runtime
37
37
  prerelease: false
38
- version_requirements: *70148296623440
38
+ version_requirements: *70348225806100
39
39
  - !ruby/object:Gem::Dependency
40
40
  name: rake
41
- requirement: &70148296622320 !ruby/object:Gem::Requirement
41
+ requirement: &70348225804500 !ruby/object:Gem::Requirement
42
42
  none: false
43
43
  requirements:
44
44
  - - ! '>='
@@ -46,10 +46,10 @@ dependencies:
46
46
  version: '0'
47
47
  type: :development
48
48
  prerelease: false
49
- version_requirements: *70148296622320
49
+ version_requirements: *70348225804500
50
50
  - !ruby/object:Gem::Dependency
51
51
  name: mocha
52
- requirement: &70148296619140 !ruby/object:Gem::Requirement
52
+ requirement: &70348225803620 !ruby/object:Gem::Requirement
53
53
  none: false
54
54
  requirements:
55
55
  - - ! '>='
@@ -57,10 +57,10 @@ dependencies:
57
57
  version: '0'
58
58
  type: :development
59
59
  prerelease: false
60
- version_requirements: *70148296619140
60
+ version_requirements: *70348225803620
61
61
  - !ruby/object:Gem::Dependency
62
62
  name: sinatra
63
- requirement: &70148296617420 !ruby/object:Gem::Requirement
63
+ requirement: &70348225802560 !ruby/object:Gem::Requirement
64
64
  none: false
65
65
  requirements:
66
66
  - - ! '>='
@@ -68,10 +68,10 @@ dependencies:
68
68
  version: '0'
69
69
  type: :development
70
70
  prerelease: false
71
- version_requirements: *70148296617420
71
+ version_requirements: *70348225802560
72
72
  - !ruby/object:Gem::Dependency
73
73
  name: capybara
74
- requirement: &70148296616720 !ruby/object:Gem::Requirement
74
+ requirement: &70348225801980 !ruby/object:Gem::Requirement
75
75
  none: false
76
76
  requirements:
77
77
  - - ! '>='
@@ -79,10 +79,10 @@ dependencies:
79
79
  version: '0'
80
80
  type: :development
81
81
  prerelease: false
82
- version_requirements: *70148296616720
82
+ version_requirements: *70348225801980
83
83
  - !ruby/object:Gem::Dependency
84
- name: aruba
85
- requirement: &70148296615940 !ruby/object:Gem::Requirement
84
+ name: open4
85
+ requirement: &70348225801080 !ruby/object:Gem::Requirement
86
86
  none: false
87
87
  requirements:
88
88
  - - ! '>='
@@ -90,10 +90,10 @@ dependencies:
90
90
  version: '0'
91
91
  type: :development
92
92
  prerelease: false
93
- version_requirements: *70148296615940
93
+ version_requirements: *70348225801080
94
94
  - !ruby/object:Gem::Dependency
95
95
  name: pry
96
- requirement: &70148296615000 !ruby/object:Gem::Requirement
96
+ requirement: &70348225798240 !ruby/object:Gem::Requirement
97
97
  none: false
98
98
  requirements:
99
99
  - - ! '>='
@@ -101,10 +101,10 @@ dependencies:
101
101
  version: '0'
102
102
  type: :development
103
103
  prerelease: false
104
- version_requirements: *70148296615000
104
+ version_requirements: *70348225798240
105
105
  - !ruby/object:Gem::Dependency
106
106
  name: simplecov
107
- requirement: &70148296613140 !ruby/object:Gem::Requirement
107
+ requirement: &70348225797000 !ruby/object:Gem::Requirement
108
108
  none: false
109
109
  requirements:
110
110
  - - ! '>='
@@ -112,10 +112,10 @@ dependencies:
112
112
  version: '0'
113
113
  type: :development
114
114
  prerelease: false
115
- version_requirements: *70148296613140
115
+ version_requirements: *70348225797000
116
116
  - !ruby/object:Gem::Dependency
117
117
  name: rspec
118
- requirement: &70148296612020 !ruby/object:Gem::Requirement
118
+ requirement: &70348225795160 !ruby/object:Gem::Requirement
119
119
  none: false
120
120
  requirements:
121
121
  - - ! '>='
@@ -123,10 +123,10 @@ dependencies:
123
123
  version: '0'
124
124
  type: :development
125
125
  prerelease: false
126
- version_requirements: *70148296612020
126
+ version_requirements: *70348225795160
127
127
  - !ruby/object:Gem::Dependency
128
128
  name: fakefs
129
- requirement: &70148296610520 !ruby/object:Gem::Requirement
129
+ requirement: &70348225793580 !ruby/object:Gem::Requirement
130
130
  none: false
131
131
  requirements:
132
132
  - - ! '>='
@@ -134,21 +134,21 @@ dependencies:
134
134
  version: '0'
135
135
  type: :development
136
136
  prerelease: false
137
- version_requirements: *70148296610520
137
+ version_requirements: *70348225793580
138
138
  - !ruby/object:Gem::Dependency
139
139
  name: minitest
140
- requirement: &70148296608440 !ruby/object:Gem::Requirement
140
+ requirement: &70348225792980 !ruby/object:Gem::Requirement
141
141
  none: false
142
142
  requirements:
143
- - - ! '>='
143
+ - - ~>
144
144
  - !ruby/object:Gem::Version
145
- version: '0'
145
+ version: 2.8.0
146
146
  type: :development
147
147
  prerelease: false
148
- version_requirements: *70148296608440
148
+ version_requirements: *70348225792980
149
149
  - !ruby/object:Gem::Dependency
150
150
  name: turn
151
- requirement: &70148296607360 !ruby/object:Gem::Requirement
151
+ requirement: &70348225792120 !ruby/object:Gem::Requirement
152
152
  none: false
153
153
  requirements:
154
154
  - - ! '>='
@@ -156,7 +156,7 @@ dependencies:
156
156
  version: '0'
157
157
  type: :development
158
158
  prerelease: false
159
- version_requirements: *70148296607360
159
+ version_requirements: *70348225792120
160
160
  description: Spinach is a BDD framework on top of gherkin
161
161
  email:
162
162
  - info@codegram.com
@@ -179,6 +179,7 @@ files:
179
179
  - Rakefile
180
180
  - bin/spinach
181
181
  - features/automatic_feature_generation.feature
182
+ - features/background.feature
182
183
  - features/exit_status.feature
183
184
  - features/feature_name_guessing.feature
184
185
  - features/reporting/display_run_summary.feature
@@ -187,6 +188,7 @@ files:
187
188
  - features/reporting/undefined_feature_reporting.feature
188
189
  - features/rspec_compatibility.feature
189
190
  - features/steps/automatic_feature_generation.rb
191
+ - features/steps/background.rb
190
192
  - features/steps/exit_status.rb
191
193
  - features/steps/feature_name_guessing.rb
192
194
  - features/steps/reporting/display_run_summary.rb
@@ -196,42 +198,52 @@ files:
196
198
  - features/steps/rspec_compatibility.rb
197
199
  - features/support/env.rb
198
200
  - features/support/error_reporting.rb
201
+ - features/support/filesystem.rb
199
202
  - features/support/spinach_runner.rb
200
203
  - lib/spinach.rb
204
+ - lib/spinach/background.rb
201
205
  - lib/spinach/capybara.rb
202
206
  - lib/spinach/cli.rb
203
207
  - lib/spinach/config.rb
204
208
  - lib/spinach/dsl.rb
205
209
  - lib/spinach/exceptions.rb
210
+ - lib/spinach/feature.rb
206
211
  - lib/spinach/feature_steps.rb
212
+ - lib/spinach/frameworks.rb
213
+ - lib/spinach/frameworks/minitest.rb
214
+ - lib/spinach/frameworks/rspec.rb
207
215
  - lib/spinach/generators.rb
208
216
  - lib/spinach/generators/feature_generator.rb
209
217
  - lib/spinach/generators/step_generator.rb
210
218
  - lib/spinach/hookable.rb
211
219
  - lib/spinach/hooks.rb
212
220
  - lib/spinach/parser.rb
221
+ - lib/spinach/parser/visitor.rb
213
222
  - lib/spinach/reporter.rb
214
223
  - lib/spinach/reporter/stdout.rb
215
224
  - lib/spinach/reporter/stdout/error_reporting.rb
216
225
  - lib/spinach/runner.rb
217
226
  - lib/spinach/runner/feature_runner.rb
218
227
  - lib/spinach/runner/scenario_runner.rb
219
- - lib/spinach/suites.rb
220
- - lib/spinach/suites/minitest.rb
221
- - lib/spinach/suites/rspec.rb
228
+ - lib/spinach/scenario.rb
229
+ - lib/spinach/step.rb
222
230
  - lib/spinach/support.rb
223
231
  - lib/spinach/version.rb
224
232
  - spinach.gemspec
233
+ - test/spinach/background_test.rb
225
234
  - test/spinach/capybara_test.rb
226
235
  - test/spinach/cli_test.rb
227
236
  - test/spinach/config_test.rb
228
237
  - test/spinach/dsl_test.rb
229
238
  - test/spinach/feature_steps_test.rb
239
+ - test/spinach/feature_test.rb
240
+ - test/spinach/frameworks/minitest_test.rb
230
241
  - test/spinach/generators/feature_generator_test.rb
231
242
  - test/spinach/generators/step_generator_test.rb
232
243
  - test/spinach/generators_test.rb
233
244
  - test/spinach/hookable_test.rb
234
245
  - test/spinach/hooks_test.rb
246
+ - test/spinach/parser/visitor_test.rb
235
247
  - test/spinach/parser_test.rb
236
248
  - test/spinach/reporter/stdout/error_reporting_test.rb
237
249
  - test/spinach/reporter/stdout_test.rb
@@ -239,7 +251,8 @@ files:
239
251
  - test/spinach/runner/feature_runner_test.rb
240
252
  - test/spinach/runner/scenario_runner_test.rb
241
253
  - test/spinach/runner_test.rb
242
- - test/spinach/suites/minitest_test.rb
254
+ - test/spinach/scenario_test.rb
255
+ - test/spinach/step_test.rb
243
256
  - test/spinach/support_test.rb
244
257
  - test/spinach_test.rb
245
258
  - test/test_helper.rb
@@ -269,6 +282,7 @@ specification_version: 3
269
282
  summary: Spinach is a BDD framework on top of gherkin
270
283
  test_files:
271
284
  - features/automatic_feature_generation.feature
285
+ - features/background.feature
272
286
  - features/exit_status.feature
273
287
  - features/feature_name_guessing.feature
274
288
  - features/reporting/display_run_summary.feature
@@ -277,6 +291,7 @@ test_files:
277
291
  - features/reporting/undefined_feature_reporting.feature
278
292
  - features/rspec_compatibility.feature
279
293
  - features/steps/automatic_feature_generation.rb
294
+ - features/steps/background.rb
280
295
  - features/steps/exit_status.rb
281
296
  - features/steps/feature_name_guessing.rb
282
297
  - features/steps/reporting/display_run_summary.rb
@@ -286,17 +301,22 @@ test_files:
286
301
  - features/steps/rspec_compatibility.rb
287
302
  - features/support/env.rb
288
303
  - features/support/error_reporting.rb
304
+ - features/support/filesystem.rb
289
305
  - features/support/spinach_runner.rb
306
+ - test/spinach/background_test.rb
290
307
  - test/spinach/capybara_test.rb
291
308
  - test/spinach/cli_test.rb
292
309
  - test/spinach/config_test.rb
293
310
  - test/spinach/dsl_test.rb
294
311
  - test/spinach/feature_steps_test.rb
312
+ - test/spinach/feature_test.rb
313
+ - test/spinach/frameworks/minitest_test.rb
295
314
  - test/spinach/generators/feature_generator_test.rb
296
315
  - test/spinach/generators/step_generator_test.rb
297
316
  - test/spinach/generators_test.rb
298
317
  - test/spinach/hookable_test.rb
299
318
  - test/spinach/hooks_test.rb
319
+ - test/spinach/parser/visitor_test.rb
300
320
  - test/spinach/parser_test.rb
301
321
  - test/spinach/reporter/stdout/error_reporting_test.rb
302
322
  - test/spinach/reporter/stdout_test.rb
@@ -304,7 +324,8 @@ test_files:
304
324
  - test/spinach/runner/feature_runner_test.rb
305
325
  - test/spinach/runner/scenario_runner_test.rb
306
326
  - test/spinach/runner_test.rb
307
- - test/spinach/suites/minitest_test.rb
327
+ - test/spinach/scenario_test.rb
328
+ - test/spinach/step_test.rb
308
329
  - test/spinach/support_test.rb
309
330
  - test/spinach_test.rb
310
331
  - test/test_helper.rb
@@ -1,2 +0,0 @@
1
- require_relative 'suites/minitest'
2
- require_relative 'suites/rspec' if defined?(RSpec::Expectations)