cukedep 0.1.10 → 0.1.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/CHANGELOG.md +4 -0
- data/Rakefile +4 -6
- data/lib/cukedep/application.rb +89 -91
- data/lib/cukedep/cli/cmd-line.rb +0 -7
- data/lib/cukedep/config.rb +70 -74
- data/lib/cukedep/constants.rb +1 -1
- data/lib/cukedep/cuke-runner.rb +0 -5
- data/lib/cukedep/customization.rb +0 -5
- data/lib/cukedep/feature-model.rb +1 -7
- data/lib/cukedep/feature-rep.rb +0 -4
- data/lib/cukedep/file-action.rb +209 -221
- data/lib/cukedep/gherkin-facade.rb +7 -10
- data/lib/cukedep/gherkin-listener.rb +82 -89
- data/lib/cukedep/hook-dsl.rb +0 -4
- data/lib/cukedep/sandbox.rb +0 -5
- data/sample/features/step_definitions/steps.rb +30 -26
- data/sample/features/support/env.rb +1 -1
- data/sample/model/model.rb +198 -205
- data/sample/result.html +1 -1
- data/spec/cukedep/application_spec.rb +15 -16
- data/spec/cukedep/cli/cmd-line_spec.rb +13 -16
- data/spec/cukedep/cuke-runner_spec.rb +55 -61
- data/spec/cukedep/customization_spec.rb +21 -26
- data/spec/cukedep/debug-file-action.rb +12 -10
- data/spec/cukedep/feature-model_spec.rb +13 -16
- data/spec/cukedep/feature-rep_spec.rb +4 -7
- data/spec/cukedep/file-action_spec.rb +18 -34
- data/spec/cukedep/file-parsing.rb +9 -11
- data/spec/cukedep/gherkin-facade_spec.rb +3 -8
- data/spec/cukedep/gherkin-listener_spec.rb +10 -12
- data/spec/cukedep/hook-dsl_spec.rb +6 -9
- data/spec/cukedep/sample_features/cukedep.rake +44 -37
- data/spec/cukedep/sample_features/cukedep_hooks.rb +2 -2
- data/spec/cukedep/sample_features/dependencies.dot +1 -1
- data/templates/rake.erb +36 -29
- metadata +2 -2
@@ -6,10 +6,9 @@ require_relative '../spec_helper'
|
|
6
6
|
require_relative '../../lib/cukedep/feature-rep'
|
7
7
|
|
8
8
|
module Cukedep # Open module to get rid of long qualified names
|
9
|
-
|
10
9
|
describe FeatureRep do
|
11
10
|
# Tag names as provided by Gherkin parser
|
12
|
-
RawTagNames = %w
|
11
|
+
RawTagNames = %w(@some @feature:CO801_foo @depends_on:CO201_bar @depends_on:CO001_qux)
|
13
12
|
|
14
13
|
SampleTagNames = RawTagNames.map { |t| t[1..-1] }
|
15
14
|
|
@@ -18,7 +17,7 @@ describe FeatureRep do
|
|
18
17
|
|
19
18
|
context 'Creation and initialization:' do
|
20
19
|
it 'could be created with an empty list of tags' do
|
21
|
-
expect {FeatureRep.new([]) }.not_to raise_error
|
20
|
+
expect { FeatureRep.new([]) }.not_to raise_error
|
22
21
|
end
|
23
22
|
|
24
23
|
it 'could be created with a list of tag names' do
|
@@ -40,14 +39,12 @@ describe FeatureRep do
|
|
40
39
|
|
41
40
|
context 'Provided services:' do
|
42
41
|
it 'should know the feature files it depends on' do
|
43
|
-
expected_values = %w
|
42
|
+
expected_values = %w(CO201_bar CO001_qux)
|
44
43
|
|
45
44
|
expect(subject.dependency_tags.sort).to eq(expected_values.sort)
|
46
45
|
end
|
47
46
|
end # context
|
48
|
-
|
49
47
|
end # describe
|
50
|
-
|
51
48
|
end # module
|
52
49
|
|
53
|
-
# End of file
|
50
|
+
# End of file
|
@@ -5,16 +5,14 @@ require_relative '../spec_helper'
|
|
5
5
|
require_relative '../../lib/cukedep/file-action'
|
6
6
|
|
7
7
|
module Cukedep # Open module to get rid of long qualified names
|
8
|
-
|
9
8
|
# Test the behaviour of the superclass
|
10
9
|
describe FileAction do
|
11
|
-
let(:some_patterns) { %w
|
10
|
+
let(:some_patterns) { %w(README.* *tests.feature) }
|
12
11
|
let(:subpath) { './some-dir' }
|
13
12
|
|
14
13
|
subject { FileAction.new(some_patterns, subpath) }
|
15
14
|
|
16
15
|
context 'Creation & initialization:' do
|
17
|
-
|
18
16
|
it 'should be created with file patterns and a subdirectory argument' do
|
19
17
|
# Case 1: empty instance
|
20
18
|
expect { FileAction.new([], '') }.not_to raise_error
|
@@ -30,12 +28,10 @@ describe FileAction do
|
|
30
28
|
it "should know the target's subdirectory" do
|
31
29
|
expect(subject.delta).to eq(subpath)
|
32
30
|
end
|
33
|
-
|
34
31
|
end # context
|
35
32
|
|
36
33
|
|
37
34
|
context 'Basic services:' do
|
38
|
-
|
39
35
|
it 'should know whether it is equal to another instance' do
|
40
36
|
# Case 1: comparing with itself
|
41
37
|
expect(subject).to eq(subject)
|
@@ -50,7 +46,6 @@ describe FileAction do
|
|
50
46
|
expect(subject).not_to eq(another)
|
51
47
|
end
|
52
48
|
end # context
|
53
|
-
|
54
49
|
end # describe
|
55
50
|
|
56
51
|
|
@@ -73,11 +68,12 @@ describe CopyAction do
|
|
73
68
|
|
74
69
|
before(:all) do
|
75
70
|
# Clean stuffed dirs
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
else
|
71
|
+
path_suffix = '/sample_features/saved_files'
|
72
|
+
target_dir = File.join(File.dirname(__FILE__), path_suffix)
|
73
|
+
if Dir.exist?(target_dir)
|
80
74
|
clean_dir(target_dir)
|
75
|
+
else
|
76
|
+
Dir.mkdir(target_dir)
|
81
77
|
end
|
82
78
|
end
|
83
79
|
|
@@ -100,7 +96,7 @@ describe CopyAction do
|
|
100
96
|
|
101
97
|
# Case: one file pattern
|
102
98
|
instance1 = CopyAction.new(['*.md'], subdir)
|
103
|
-
expect{ instance1.run!(source_dir, my_dir) }.not_to raise_error
|
99
|
+
expect { instance1.run!(source_dir, my_dir) }.not_to raise_error
|
104
100
|
|
105
101
|
Dir.chdir(my_dir)
|
106
102
|
# Control the result...
|
@@ -109,15 +105,13 @@ describe CopyAction do
|
|
109
105
|
|
110
106
|
# Case: two file patterns
|
111
107
|
instance2 = CopyAction.new(['file1.txt', 'file2.txt'], subdir)
|
112
|
-
expect{ instance2.run!(source_dir, my_dir) }.not_to raise_error
|
108
|
+
expect { instance2.run!(source_dir, my_dir) }.not_to raise_error
|
113
109
|
|
114
110
|
# Control the result...
|
115
111
|
copied_files = Dir.glob(subdir + '/' + '*.*')
|
116
112
|
expect(copied_files.size).to eq(3)
|
117
113
|
end
|
118
|
-
|
119
114
|
end # context
|
120
|
-
|
121
115
|
end # describe
|
122
116
|
|
123
117
|
|
@@ -149,7 +143,7 @@ describe DeleteAction do
|
|
149
143
|
|
150
144
|
# Case: one file pattern and a subdir
|
151
145
|
instance1 = DeleteAction.new(['*.md'], subdir)
|
152
|
-
expect{ instance1.run!(my_dir) }.not_to raise_error
|
146
|
+
expect { instance1.run!(my_dir) }.not_to raise_error
|
153
147
|
Dir.chdir(my_dir)
|
154
148
|
|
155
149
|
# Control the result...
|
@@ -158,7 +152,7 @@ describe DeleteAction do
|
|
158
152
|
|
159
153
|
# Case: multiple file patterns and no subdir
|
160
154
|
instance2 = DeleteAction.new(['file1.txt', 'file3.txt'])
|
161
|
-
expect{ instance2.run!(target_dir) }.not_to raise_error
|
155
|
+
expect { instance2.run!(target_dir) }.not_to raise_error
|
162
156
|
|
163
157
|
# Control the result...
|
164
158
|
remaining_files = Dir.glob(subdir + '/' + '*.*')
|
@@ -166,20 +160,17 @@ describe DeleteAction do
|
|
166
160
|
|
167
161
|
# Delete all files
|
168
162
|
instance3 = DeleteAction.new(['*.*'])
|
169
|
-
expect{ instance3.run!(target_dir) }.not_to raise_error
|
163
|
+
expect { instance3.run!(target_dir) }.not_to raise_error
|
170
164
|
|
171
165
|
# Control the result...
|
172
166
|
remaining_files = Dir.glob(subdir + '/' + '*.*')
|
173
167
|
expect(remaining_files.size).to eq(0)
|
174
168
|
end
|
175
169
|
end # context
|
176
|
-
|
177
|
-
|
178
170
|
end # describe
|
179
171
|
|
180
172
|
|
181
173
|
describe ActionTriplet do
|
182
|
-
|
183
174
|
def saved_files_dir()
|
184
175
|
my_dir = File.dirname(__FILE__)
|
185
176
|
return my_dir + '/sample_features/saved_files'
|
@@ -218,7 +209,6 @@ describe ActionTriplet do
|
|
218
209
|
end
|
219
210
|
|
220
211
|
context 'Creation & initialization:' do
|
221
|
-
|
222
212
|
it 'should be created with Hash-like arguments' do
|
223
213
|
# Case 1: empty instance
|
224
214
|
expect { ActionTriplet.new(empty_config) }.not_to raise_error
|
@@ -226,7 +216,6 @@ describe ActionTriplet do
|
|
226
216
|
# Case 2: stuffed instance
|
227
217
|
expect { ActionTriplet.new(sample_config) }.not_to raise_error
|
228
218
|
end
|
229
|
-
|
230
219
|
end # context
|
231
220
|
|
232
221
|
context 'Basic services:' do
|
@@ -248,7 +237,6 @@ describe ActionTriplet do
|
|
248
237
|
end # context
|
249
238
|
|
250
239
|
|
251
|
-
|
252
240
|
context 'Actions on files:' do
|
253
241
|
before(:each) do
|
254
242
|
# Store the working dir before starting
|
@@ -267,15 +255,14 @@ describe ActionTriplet do
|
|
267
255
|
clean_dir(proj_dir)
|
268
256
|
end
|
269
257
|
|
270
|
-
|
271
258
|
# Directories
|
272
259
|
def proj_dir()
|
273
260
|
my_dir = File.join(File.dirname(__FILE__), '/dummy_project')
|
274
261
|
|
275
|
-
|
276
|
-
Dir.mkdir(my_dir)
|
277
|
-
else
|
262
|
+
if Dir.exist?(my_dir)
|
278
263
|
clean_dir(my_dir)
|
264
|
+
else
|
265
|
+
Dir.mkdir(my_dir)
|
279
266
|
end
|
280
267
|
|
281
268
|
return my_dir
|
@@ -286,7 +273,6 @@ describe ActionTriplet do
|
|
286
273
|
File.join(File.dirname(__FILE__), child)
|
287
274
|
end
|
288
275
|
|
289
|
-
|
290
276
|
def clean_dir(aDirectory)
|
291
277
|
# Create an instance with just delete file items
|
292
278
|
instance = DeleteAction.new(all_files, '')
|
@@ -318,7 +304,7 @@ describe ActionTriplet do
|
|
318
304
|
Dir.chdir(project_dir)
|
319
305
|
actuals = Dir['*.*']
|
320
306
|
expect(actuals.size).to eq(3)
|
321
|
-
expect(actuals.sort).to eq(%w
|
307
|
+
expect(actuals.sort).to eq(%w(file1.txt file2.txt file3.txt))
|
322
308
|
|
323
309
|
# Clean project dir
|
324
310
|
clean_dir(project_dir)
|
@@ -333,9 +319,9 @@ describe ActionTriplet do
|
|
333
319
|
|
334
320
|
actuals = Dir['*.*']
|
335
321
|
expect(actuals.size).to eq(4)
|
336
|
-
(txt_files, md_files) = actuals.partition {|f| f =~ /\.txt/}
|
337
|
-
expect(txt_files.sort).to eq(%w
|
338
|
-
expect(md_files).to eq(%w
|
322
|
+
(txt_files, md_files) = actuals.partition { |f| f =~ /\.txt/ }
|
323
|
+
expect(txt_files.sort).to eq(%w(file1.txt file2.txt file3.txt))
|
324
|
+
expect(md_files).to eq(%w(README.md))
|
339
325
|
end
|
340
326
|
|
341
327
|
=begin
|
@@ -374,9 +360,7 @@ describe ActionTriplet do
|
|
374
360
|
end
|
375
361
|
=end
|
376
362
|
end # context
|
377
|
-
|
378
363
|
end # describe
|
379
|
-
|
380
364
|
end # module
|
381
365
|
|
382
366
|
# End of file
|
@@ -3,23 +3,23 @@
|
|
3
3
|
require_relative '../../lib/cukedep/gherkin-facade'
|
4
4
|
|
5
5
|
module Cukedep # This module is used as a namespace
|
6
|
-
|
7
6
|
# Mixin module used in tests.
|
8
7
|
# Purpose: to parse a sample of feature files.
|
9
8
|
module FileParsing
|
10
9
|
# The list of sample feature file names.
|
11
|
-
SampleFileNames =
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
10
|
+
SampleFileNames =
|
11
|
+
[ 'a_few_tests.feature',
|
12
|
+
'some_tests.feature',
|
13
|
+
'still_other_tests.feature',
|
14
|
+
'yet_other_tests.feature',
|
15
|
+
'more_tests.feature',
|
16
|
+
'standalone.feature'
|
17
17
|
]
|
18
18
|
|
19
19
|
# Helper method. It parses sample feature files and
|
20
20
|
# notifies the provided listener of its progress.
|
21
21
|
def parse_for(aListener)
|
22
|
-
orig_dir = Dir.getwd
|
22
|
+
orig_dir = Dir.getwd
|
23
23
|
begin
|
24
24
|
# Determine the folder where the sample files reside
|
25
25
|
my_dir = File.dirname(__FILE__)
|
@@ -37,7 +37,5 @@ module Cukedep # This module is used as a namespace
|
|
37
37
|
end
|
38
38
|
|
39
39
|
end # module
|
40
|
-
|
41
40
|
end # module
|
42
|
-
|
43
|
-
# End of file
|
41
|
+
# End of file
|
@@ -7,7 +7,6 @@ require_relative '../../lib/cukedep/gherkin-facade'
|
|
7
7
|
require_relative '../../lib/cukedep/gherkin-listener'
|
8
8
|
|
9
9
|
module Cukedep # Open module to get rid of long qualified names
|
10
|
-
|
11
10
|
describe GherkinFacade do
|
12
11
|
subject { GherkinFacade.new(false, 'UTF-8') }
|
13
12
|
|
@@ -28,7 +27,6 @@ describe GherkinFacade do
|
|
28
27
|
it 'should know the feature file external encoding' do
|
29
28
|
expect(subject.external_encoding).to eq('UTF-8')
|
30
29
|
end
|
31
|
-
|
32
30
|
end # context
|
33
31
|
|
34
32
|
|
@@ -38,17 +36,14 @@ describe GherkinFacade do
|
|
38
36
|
it 'should parse ASCII feature files' do
|
39
37
|
instance = GherkinFacade.new(false, 'US-ASCII')
|
40
38
|
patterns = [ 'sample_features/a_few_tests.feature' ]
|
41
|
-
expect {instance.parse_features(listener, patterns)}.not_to raise_error
|
39
|
+
expect { instance.parse_features(listener, patterns) }.not_to raise_error
|
42
40
|
end
|
43
41
|
|
44
42
|
it 'should parse feature files with other external encoding' do
|
45
43
|
patterns = [ 'sample_features/standalone.feature' ]
|
46
|
-
expect {subject.parse_features(listener, patterns)}.not_to raise_error
|
44
|
+
expect { subject.parse_features(listener, patterns) }.not_to raise_error
|
47
45
|
end
|
48
46
|
end # context
|
49
|
-
|
50
47
|
end # describe
|
51
|
-
|
52
48
|
end # module
|
53
|
-
|
54
|
-
# End of file
|
49
|
+
# End of file
|
@@ -9,7 +9,6 @@ require_relative 'file-parsing'
|
|
9
9
|
require_relative '../../lib/cukedep/gherkin-listener'
|
10
10
|
|
11
11
|
module Cukedep # Open module to get rid of long qualified names
|
12
|
-
|
13
12
|
describe GherkinListener do
|
14
13
|
include FileParsing # Use mixin module to parse of sample feature files
|
15
14
|
|
@@ -17,7 +16,7 @@ describe GherkinListener do
|
|
17
16
|
|
18
17
|
context 'Creation and initialization:' do
|
19
18
|
it 'should be created without argument' do
|
20
|
-
expect {GherkinListener.new }.not_to raise_error
|
19
|
+
expect { GherkinListener.new }.not_to raise_error
|
21
20
|
end
|
22
21
|
|
23
22
|
it 'should have no feature file at start' do
|
@@ -28,32 +27,31 @@ describe GherkinListener do
|
|
28
27
|
context 'Provided services:' do
|
29
28
|
it 'should build a FeatureFileRep per parsed file' do
|
30
29
|
parse_for(subject)
|
31
|
-
expect(subject.feature_files.size)
|
30
|
+
expect(subject.feature_files.size)
|
31
|
+
.to eq(FileParsing::SampleFileNames.size)
|
32
32
|
end
|
33
33
|
|
34
34
|
it 'should know the tags of each feature' do
|
35
35
|
parse_for(subject)
|
36
36
|
|
37
37
|
expectations = [
|
38
|
-
%w
|
39
|
-
%w
|
40
|
-
%w
|
41
|
-
%w
|
42
|
-
%w
|
38
|
+
%w(a_few feature:qux),
|
39
|
+
%w(some feature:foo depends_on:bar depends_on:qux),
|
40
|
+
%w(still_other feature:baz),
|
41
|
+
%w(yet_other feature:bar depends_on:baz depends_on:qux depends_on:quux),
|
42
|
+
%w(feature:quux more),
|
43
43
|
[]
|
44
44
|
]
|
45
45
|
|
46
46
|
# Sort the expectations to ease further comparison
|
47
|
-
expectations.map!
|
47
|
+
expectations.map!(&:sort)
|
48
48
|
|
49
49
|
subject.feature_files.each_with_index do |file, i|
|
50
50
|
expect(file.feature.tags.sort).to eq(expectations[i])
|
51
51
|
end
|
52
52
|
end
|
53
53
|
end # context
|
54
|
-
|
55
54
|
end # describe
|
56
|
-
|
57
55
|
end # module
|
58
56
|
|
59
|
-
# End of file
|
57
|
+
# End of file
|
@@ -7,10 +7,8 @@ require_relative '../spec_helper'
|
|
7
7
|
require_relative '../../lib/cukedep/hook-dsl'
|
8
8
|
|
9
9
|
module Cukedep # Open module to get rid of long qualified names
|
10
|
-
|
11
10
|
# Let's specify the behaviour of the mix-in module
|
12
11
|
describe HookDSL do
|
13
|
-
|
14
12
|
subject do
|
15
13
|
obj = Object.new
|
16
14
|
obj.extend(HookDSL)
|
@@ -19,7 +17,7 @@ describe HookDSL do
|
|
19
17
|
|
20
18
|
context 'Hook definitions:' do
|
21
19
|
let(:code_block) do
|
22
|
-
-> {
|
20
|
+
-> { }
|
23
21
|
end
|
24
22
|
|
25
23
|
it 'should accept the before all hook' do
|
@@ -59,11 +57,13 @@ describe HookDSL do
|
|
59
57
|
# Case 1: before invalid with block code
|
60
58
|
msg = "Unknown scope 'invalid' for before_cuke hook."
|
61
59
|
error = StandardError
|
62
|
-
expect { subject.before_cuke(:invalid, &code_block) }
|
60
|
+
expect { subject.before_cuke(:invalid, &code_block) }
|
61
|
+
.to raise_error(error, msg)
|
63
62
|
|
64
63
|
# Case 2: after invalid with block code
|
65
64
|
msg = "Unknown scope 'invalid' for after_cuke hook."
|
66
|
-
expect { subject.after_cuke(:invalid, &code_block) }
|
65
|
+
expect { subject.after_cuke(:invalid, &code_block) }
|
66
|
+
.to raise_error(error, msg)
|
67
67
|
end
|
68
68
|
|
69
69
|
|
@@ -118,7 +118,6 @@ describe HookDSL do
|
|
118
118
|
expect(subject.after_hooks.keys).to eq([:all, :each])
|
119
119
|
expect(subject.after_hooks[:each]).to eq(code_block)
|
120
120
|
end
|
121
|
-
|
122
121
|
end # context
|
123
122
|
=begin
|
124
123
|
context 'Executing handler code:' do
|
@@ -177,9 +176,7 @@ describe HookDSL do
|
|
177
176
|
|
178
177
|
end # context
|
179
178
|
=end
|
180
|
-
|
181
179
|
end # describe
|
182
|
-
|
183
180
|
end # module
|
184
181
|
|
185
|
-
# End of file
|
182
|
+
# End of file
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# File: cukedep.rake
|
2
|
-
# Generated by Cukedep 0.1.
|
2
|
+
# Generated by Cukedep 0.1.11 on 18/06/2015 21:34:32
|
3
3
|
|
4
4
|
require 'rake'
|
5
5
|
|
@@ -13,19 +13,25 @@ require 'cucumber/rake/task'
|
|
13
13
|
# UGLY workaround for bug in Cucumber's rake task
|
14
14
|
if Gem::VERSION[0].to_i >= 2 && Cucumber::VERSION <= '1.3.2'
|
15
15
|
# Monkey-patch a buggy method
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
16
|
+
module Cucumber
|
17
|
+
module Rake
|
18
|
+
module Task
|
19
|
+
class ForkedCucumberRunner
|
20
|
+
def gem_available?(gemname)
|
21
|
+
if Gem::VERSION[0].to_i >= 2
|
22
|
+
gem_available_new_rubygems?(gemname)
|
23
|
+
else
|
24
|
+
gem_available_old_rubygems?(gemname)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
22
28
|
end
|
23
|
-
end
|
29
|
+
end
|
24
30
|
end # class
|
25
31
|
end
|
26
32
|
|
27
33
|
# Create a task called cucumber
|
28
|
-
Cucumber::Rake::Task.new do |
|
34
|
+
Cucumber::Rake::Task.new do |_|
|
29
35
|
end
|
30
36
|
|
31
37
|
#######################################
|
@@ -38,11 +44,12 @@ SOURCE_DIR = 'C:/Ruby193/lib/ruby/site_ruby/Cukedep/spec/cukedep/sample_features
|
|
38
44
|
# Constant holding the location of the Cucumber project
|
39
45
|
CUKE_PROJECT = 'C:/Ruby193/lib/ruby/site_ruby/Cukedep/sample'
|
40
46
|
|
41
|
-
# The list of all "legacy" feature file
|
47
|
+
# The list of all "legacy" feature file
|
48
|
+
# (feature files without the @feature: tag)
|
42
49
|
AllUnidentifiedFeatures = [
|
43
50
|
'standalone.feature'
|
44
51
|
]
|
45
|
-
|
52
|
+
|
46
53
|
# The list of all encountered feature ids
|
47
54
|
AllFeatureIdentifiers = [
|
48
55
|
:qux,
|
@@ -71,7 +78,7 @@ def project_path_of(aFilename)
|
|
71
78
|
CUKE_PROJECT + '/features/' + aFilename
|
72
79
|
end
|
73
80
|
|
74
|
-
# Helper method. Given the name of files in the source dir, copy them
|
81
|
+
# Helper method. Given the name of files in the source dir, copy them
|
75
82
|
# into the project dir.
|
76
83
|
def copy_to_project(filenames)
|
77
84
|
filenames.each do |fname|
|
@@ -82,7 +89,7 @@ def copy_to_project(filenames)
|
|
82
89
|
end
|
83
90
|
|
84
91
|
|
85
|
-
# Helper method. Given the name of files in the features dir of the project,
|
92
|
+
# Helper method. Given the name of files in the features dir of the project,
|
86
93
|
# copy them into the source dir.
|
87
94
|
def copy_from_project(*filenames)
|
88
95
|
filenames.each do |fname|
|
@@ -92,28 +99,28 @@ def copy_from_project(*filenames)
|
|
92
99
|
end
|
93
100
|
end
|
94
101
|
|
95
|
-
# Helper method. Delete all the files in the
|
96
|
-
# the project's features dir that match one of
|
102
|
+
# Helper method. Delete all the files in the
|
103
|
+
# the project's features dir that match one of
|
97
104
|
# the file name pattern
|
98
105
|
def clean_project_dir(fname_patterns)
|
99
|
-
curr_dir = Dir.getwd
|
106
|
+
curr_dir = Dir.getwd
|
100
107
|
begin
|
101
108
|
Dir.chdir(CUKE_PROJECT + '/features')
|
102
109
|
fname_patterns.each do |patt|
|
103
110
|
filenames = Dir.glob(patt)
|
104
111
|
filenames.each { |fn| FileUtils.remove_file(fn) }
|
105
112
|
end
|
106
|
-
ensure #Always restore previous working dir.
|
113
|
+
ensure # Always restore previous working dir.
|
107
114
|
Dir.chdir(curr_dir)
|
108
115
|
end
|
109
116
|
end
|
110
117
|
|
111
118
|
|
112
119
|
# Helper method. Invoke Cucumber with the given project root dir.
|
113
|
-
# Assumption: all features files to execute are placed
|
120
|
+
# Assumption: all features files to execute are placed
|
114
121
|
# in the appropriate folder.
|
115
122
|
def invoke_cuke(projectDir)
|
116
|
-
curr_dir = Dir.getwd
|
123
|
+
curr_dir = Dir.getwd
|
117
124
|
Dir.chdir(projectDir)
|
118
125
|
begin
|
119
126
|
do_cuke = Rake::Task[:cucumber]
|
@@ -130,7 +137,7 @@ def process_files(filenames)
|
|
130
137
|
copy_to_project(filenames)
|
131
138
|
invoke_cuke(CUKE_PROJECT)
|
132
139
|
run_builtin_actions(:after_each)
|
133
|
-
#del_from_project(filenames)
|
140
|
+
# del_from_project(filenames)
|
134
141
|
end
|
135
142
|
|
136
143
|
def process_a_feature(filename)
|
@@ -139,16 +146,16 @@ end
|
|
139
146
|
|
140
147
|
|
141
148
|
# Default rake task is also top-level task
|
142
|
-
task :
|
149
|
+
task default: :run_all_features
|
143
150
|
|
144
151
|
|
145
152
|
desc 'Run all features'
|
146
|
-
task :
|
153
|
+
task run_all_features: [:before_all, :all_features, :after_all] do
|
147
154
|
; # Do nothing
|
148
155
|
end
|
149
156
|
|
150
157
|
|
151
|
-
desc 'Before all'
|
158
|
+
desc 'Before all'
|
152
159
|
task :before_all do
|
153
160
|
run_builtin_actions(:before_all)
|
154
161
|
end
|
@@ -166,43 +173,43 @@ end
|
|
166
173
|
# Tasks for feature files involved in dependencies
|
167
174
|
|
168
175
|
|
169
|
-
desc
|
170
|
-
task
|
176
|
+
desc 'qux: run a_few_tests.feature'
|
177
|
+
task qux do
|
171
178
|
process_a_feature('a_few_tests.feature')
|
172
179
|
end
|
173
180
|
|
174
181
|
|
175
|
-
desc
|
176
|
-
task
|
182
|
+
desc 'quux: run more_tests.feature'
|
183
|
+
task quux do
|
177
184
|
process_a_feature('more_tests.feature')
|
178
185
|
end
|
179
186
|
|
180
187
|
|
181
|
-
desc
|
182
|
-
task :
|
188
|
+
desc 'corge: run other_tests.feature'
|
189
|
+
task corge: [:foo] do
|
183
190
|
process_a_feature('other_tests.feature')
|
184
191
|
end
|
185
192
|
|
186
193
|
|
187
|
-
desc
|
188
|
-
task :
|
194
|
+
desc 'foo: run some_tests.feature'
|
195
|
+
task foo: [:bar, :qux] do
|
189
196
|
process_a_feature('some_tests.feature')
|
190
197
|
end
|
191
198
|
|
192
199
|
|
193
|
-
desc
|
194
|
-
task
|
200
|
+
desc 'baz: run still_other_tests.feature'
|
201
|
+
task baz do
|
195
202
|
process_a_feature('still_other_tests.feature')
|
196
203
|
end
|
197
204
|
|
198
205
|
|
199
|
-
desc
|
200
|
-
task :
|
206
|
+
desc 'bar: run yet_other_tests.feature'
|
207
|
+
task bar: [:baz, :qux, :quux] do
|
201
208
|
process_a_feature('yet_other_tests.feature')
|
202
209
|
end
|
203
210
|
|
204
211
|
|
205
|
-
task :
|
212
|
+
task all_features: ([:unidentified] + AllFeatureIdentifiers) do
|
206
213
|
end
|
207
214
|
|
208
|
-
# End of file
|
215
|
+
# End of file
|