cukedep 0.1.10 → 0.1.11

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 (37) hide show
  1. checksums.yaml +8 -8
  2. data/CHANGELOG.md +4 -0
  3. data/Rakefile +4 -6
  4. data/lib/cukedep/application.rb +89 -91
  5. data/lib/cukedep/cli/cmd-line.rb +0 -7
  6. data/lib/cukedep/config.rb +70 -74
  7. data/lib/cukedep/constants.rb +1 -1
  8. data/lib/cukedep/cuke-runner.rb +0 -5
  9. data/lib/cukedep/customization.rb +0 -5
  10. data/lib/cukedep/feature-model.rb +1 -7
  11. data/lib/cukedep/feature-rep.rb +0 -4
  12. data/lib/cukedep/file-action.rb +209 -221
  13. data/lib/cukedep/gherkin-facade.rb +7 -10
  14. data/lib/cukedep/gherkin-listener.rb +82 -89
  15. data/lib/cukedep/hook-dsl.rb +0 -4
  16. data/lib/cukedep/sandbox.rb +0 -5
  17. data/sample/features/step_definitions/steps.rb +30 -26
  18. data/sample/features/support/env.rb +1 -1
  19. data/sample/model/model.rb +198 -205
  20. data/sample/result.html +1 -1
  21. data/spec/cukedep/application_spec.rb +15 -16
  22. data/spec/cukedep/cli/cmd-line_spec.rb +13 -16
  23. data/spec/cukedep/cuke-runner_spec.rb +55 -61
  24. data/spec/cukedep/customization_spec.rb +21 -26
  25. data/spec/cukedep/debug-file-action.rb +12 -10
  26. data/spec/cukedep/feature-model_spec.rb +13 -16
  27. data/spec/cukedep/feature-rep_spec.rb +4 -7
  28. data/spec/cukedep/file-action_spec.rb +18 -34
  29. data/spec/cukedep/file-parsing.rb +9 -11
  30. data/spec/cukedep/gherkin-facade_spec.rb +3 -8
  31. data/spec/cukedep/gherkin-listener_spec.rb +10 -12
  32. data/spec/cukedep/hook-dsl_spec.rb +6 -9
  33. data/spec/cukedep/sample_features/cukedep.rake +44 -37
  34. data/spec/cukedep/sample_features/cukedep_hooks.rb +2 -2
  35. data/spec/cukedep/sample_features/dependencies.dot +1 -1
  36. data/templates/rake.erb +36 -29
  37. metadata +2 -2
@@ -469,4 +469,4 @@ e&&e.document?e.document.compatMode==="CSS1Compat"&&e.document.documentElement["
469
469
  $('#'+element_id).css('color', '#000000');
470
470
  }
471
471
 
472
- </script></head><body><!-- Step count 0--><div class="cucumber"><div id="cucumber-header"><div id="label"><h1>Cucumber Features</h1></div><div id="summary"><p id="totals"></p><p id="duration"></p><div id="expand-collapse"><p id="expander">Expand All</p><p id="collapser">Collapse All</p></div></div></div><div class="feature"><span class="tag">@a_few</span> <span class="tag">@feature:qux</span><h2><span class="val">Feature: Registering user credentials</span></h2><p class="narrative">As a video rental employee<br/>I want to enter my credentials<br/>So I can identify myself when use the rental application<br/></p><div class='scenario'><span class="scenario_file">features/a_few_tests.feature:8</span><h3 id="scenario_1"><span class="keyword">Scenario:</span> <span class="val">Start without credentials</span></h3><ol><li id='' class='step passed'><div class="step_name"><span class="keyword">Given </span><span class="step val">there is no registered user</span></div><div class="step_file"><span>features/step_definitions/steps.rb:46</span></div></li> <script type="text/javascript">moveProgressBar('100.0');</script><li id='' class='step passed'><div class="step_name"><span class="keyword">When </span><span class="step val">I enter the credentials &quot;<span class="param">it's me</span>&quot;</span></div><div class="step_file"><span>features/step_definitions/steps.rb:50</span></div></li> <script type="text/javascript">moveProgressBar('100.0');</script><li id='' class='step passed'><div class="step_name"><span class="keyword">Then </span><span class="step val">I should not be authorized</span></div><div class="step_file"><span>features/step_definitions/steps.rb:54</span></div></li><li class="step message">Invalid user credential</li> <script type="text/javascript">moveProgressBar('100.0');</script></ol></div><div class='scenario outline'><span class="scenario_file">features/a_few_tests.feature:14</span><h3 id="scenario_2"><span class="keyword">Scenario Outline:</span> <span class="val">Registering some credentials</span></h3><ol><li id='' class='step skipped'><div class="step_name"><span class="keyword">When </span><span class="step val">I register my credentials &quot;&lt;credentials&gt;&quot;</span></div><div class="step_file"><span>features/a_few_tests.feature:15</span></div></li> <script type="text/javascript">moveProgressBar('100.0');</script><li id='' class='step skipped'><div class="step_name"><span class="keyword">When </span><span class="step val">I enter the credentials &quot;&lt;credentials&gt;&quot;</span></div><div class="step_file"><span>features/a_few_tests.feature:16</span></div></li> <script type="text/javascript">moveProgressBar('100.0');</script><li id='' class='step skipped'><div class="step_name"><span class="keyword">Then </span><span class="step val">I should see a welcome message</span></div><div class="step_file"><span>features/a_few_tests.feature:17</span></div></li> <script type="text/javascript">moveProgressBar('100.0');</script></ol><div class="examples"><h4><span class="keyword">Examples</span> <span class="val"></span></h4><table><tr class='step' id='features_a_few_tests_feature_19'><th id="features_a_few_tests_feature_19_0" class="step skipped_param"><div><span class="step param">credentials</span></div></th></tr> <script type="text/javascript">moveProgressBar('100.0');</script><tr class='step' id='features_a_few_tests_feature_21'><td id="features_a_few_tests_feature_21_0" class="step passed"><div><span class="step param">it's me</span></div></td><td class="message">Welcome to the rental application.</td></tr> <script type="text/javascript">moveProgressBar('100.0');</script><tr class='step' id='features_a_few_tests_feature_22'><td id="features_a_few_tests_feature_22_0" class="step passed"><div><span class="step param">himself</span></div></td><td class="message">Welcome to the rental application.</td></tr> <script type="text/javascript">moveProgressBar('100.0');</script><tr class='step' id='features_a_few_tests_feature_23'><td id="features_a_few_tests_feature_23_0" class="step passed"><div><span class="step param">nemo</span></div></td><td class="message">Welcome to the rental application.</td></tr> <script type="text/javascript">moveProgressBar('100.0');</script></table></div></div></div><script type="text/javascript">document.getElementById('duration').innerHTML = "Finished in <strong>0m0.016s seconds</strong>";</script><script type="text/javascript">document.getElementById('totals').innerHTML = "4 scenarios (4 passed)<br />12 steps (12 passed)";</script></div></body></html>
472
+ </script></head><body><!-- Step count 0--><div class="cucumber"><div id="cucumber-header"><div id="label"><h1>Cucumber Features</h1></div><div id="summary"><p id="totals"></p><p id="duration"></p><div id="expand-collapse"><p id="expander">Expand All</p><p id="collapser">Collapse All</p></div></div></div><div class="feature"><span class="tag">@a_few</span> <span class="tag">@feature:qux</span><h2><span class="val">Feature: Registering user credentials</span></h2><p class="narrative">As a video rental employee<br/>I want to enter my credentials<br/>So I can identify myself when use the rental application<br/></p><div class='scenario'><span class="scenario_file">features/a_few_tests.feature:8</span><h3 id="scenario_1"><span class="keyword">Scenario:</span> <span class="val">Start without credentials</span></h3><ol><li id='' class='step passed'><div class="step_name"><span class="keyword">Given </span><span class="step val">there is no registered user</span></div><div class="step_file"><span>features/step_definitions/steps.rb:50</span></div></li> <script type="text/javascript">moveProgressBar('100.0');</script><li id='' class='step passed'><div class="step_name"><span class="keyword">When </span><span class="step val">I enter the credentials &quot;<span class="param">it's me</span>&quot;</span></div><div class="step_file"><span>features/step_definitions/steps.rb:54</span></div></li> <script type="text/javascript">moveProgressBar('100.0');</script><li id='' class='step passed'><div class="step_name"><span class="keyword">Then </span><span class="step val">I should not be authorized</span></div><div class="step_file"><span>features/step_definitions/steps.rb:58</span></div></li><li class="step message">Invalid user credential</li> <script type="text/javascript">moveProgressBar('100.0');</script></ol></div><div class='scenario outline'><span class="scenario_file">features/a_few_tests.feature:14</span><h3 id="scenario_2"><span class="keyword">Scenario Outline:</span> <span class="val">Registering some credentials</span></h3><ol><li id='' class='step skipped'><div class="step_name"><span class="keyword">When </span><span class="step val">I register my credentials &quot;&lt;credentials&gt;&quot;</span></div><div class="step_file"><span>features/a_few_tests.feature:15</span></div></li> <script type="text/javascript">moveProgressBar('100.0');</script><li id='' class='step skipped'><div class="step_name"><span class="keyword">When </span><span class="step val">I enter the credentials &quot;&lt;credentials&gt;&quot;</span></div><div class="step_file"><span>features/a_few_tests.feature:16</span></div></li> <script type="text/javascript">moveProgressBar('100.0');</script><li id='' class='step skipped'><div class="step_name"><span class="keyword">Then </span><span class="step val">I should see a welcome message</span></div><div class="step_file"><span>features/a_few_tests.feature:17</span></div></li> <script type="text/javascript">moveProgressBar('100.0');</script></ol><div class="examples"><h4><span class="keyword">Examples</span> <span class="val"></span></h4><table><tr class='step' id='features_a_few_tests_feature_19'><th id="features_a_few_tests_feature_19_0" class="step skipped_param"><div><span class="step param">credentials</span></div></th></tr> <script type="text/javascript">moveProgressBar('100.0');</script><tr class='step' id='features_a_few_tests_feature_21'><td id="features_a_few_tests_feature_21_0" class="step passed"><div><span class="step param">it's me</span></div></td><td class="message">Welcome to the rental application.</td></tr> <script type="text/javascript">moveProgressBar('100.0');</script><tr class='step' id='features_a_few_tests_feature_22'><td id="features_a_few_tests_feature_22_0" class="step passed"><div><span class="step param">himself</span></div></td><td class="message">Welcome to the rental application.</td></tr> <script type="text/javascript">moveProgressBar('100.0');</script><tr class='step' id='features_a_few_tests_feature_23'><td id="features_a_few_tests_feature_23_0" class="step passed"><div><span class="step param">nemo</span></div></td><td class="message">Welcome to the rental application.</td></tr> <script type="text/javascript">moveProgressBar('100.0');</script></table></div></div></div><script type="text/javascript">document.getElementById('duration').innerHTML = "Finished in <strong>0m0.031s seconds</strong>";</script><script type="text/javascript">document.getElementById('totals').innerHTML = "4 scenarios (4 passed)<br />12 steps (12 passed)";</script></div></body></html>
@@ -1,15 +1,14 @@
1
1
  # File: cmd-line_spec.rb
2
2
 
3
3
  require 'stringio'
4
+ require 'English'
4
5
  require_relative '../spec_helper'
5
6
 
6
7
  # Load the class under testing
7
8
  require_relative '../../lib/cukedep/application'
8
9
 
9
10
  module Cukedep # Open module to get rid of long qualified names
10
-
11
11
  describe Application do
12
-
13
12
  context 'Creation & initialization:' do
14
13
  it 'should be created without argument' do
15
14
  expect { Application.new }.not_to raise_error
@@ -20,7 +19,7 @@ describe Application do
20
19
  subject { Application.new }
21
20
 
22
21
  it 'should read its command-line' do
23
- options = subject.send(:options_from, %w[])
22
+ options = subject.send(:options_from, [])
24
23
  expect(options).to be_empty
25
24
  end
26
25
 
@@ -29,7 +28,7 @@ describe Application do
29
28
  File.delete(Cukedep::YMLFilename) if File.exist?(Cukedep::YMLFilename)
30
29
 
31
30
  # --setup option creates the config file then stops the application
32
- expect { subject.run!(['--setup'])}.to raise_error(SystemExit)
31
+ expect { subject.run!(['--setup']) }.to raise_error(SystemExit)
33
32
 
34
33
  # Check that the config file was effectively created.
35
34
  expect(File.exist?(Cukedep::YMLFilename)).to be true
@@ -39,14 +38,14 @@ describe Application do
39
38
  # Re-run again with --setup option.
40
39
  # It should ask permission for overwriting
41
40
  # Capture console IO
42
- old_stdout = $>
41
+ old_stdout = $DEFAULT_OUTPUT
43
42
  ostream = StringIO.new('rw')
44
- $> = ostream
43
+ $DEFAULT_OUTPUT = ostream
45
44
  old_stdin = $stdin
46
45
  $stdin = StringIO.new("n\n", 'r')
47
- expect { subject.run!(['--setup'])}.to raise_error(SystemExit)
48
- $> = old_stdout
49
- $sdtin = old_stdin
46
+ expect { subject.run!(['--setup']) }.to raise_error(SystemExit)
47
+ $DEFAULT_OUTPUT = old_stdout
48
+ $stdin = old_stdin
50
49
  end
51
50
 
52
51
  it 'should complain in absence of project dir' do
@@ -55,20 +54,21 @@ describe Application do
55
54
  expect(File.exist?(Cukedep::YMLFilename)).to be_falsey
56
55
 
57
56
  # Create default config
58
- expect { subject.run!(['--setup'])}.to raise_error(SystemExit)
57
+ expect { subject.run!(['--setup']) }.to raise_error(SystemExit)
59
58
 
60
59
  err = StandardError
61
- err_msg = "No project dir specified in '.cukedep.yml' nor via --project option."
62
- expect {subject.run!([])}.to raise_error(err, err_msg)
60
+ err_msg1 = "No project dir specified in '.cukedep.yml'"
61
+ err_msg2 = ' nor via --project option.'
62
+ expect { subject.run!([]) }.to raise_error(err, err_msg1 + err_msg2)
63
63
  end
64
64
 
65
65
  it 'should parse the feature files' do
66
- curr_dir = Dir.getwd()
66
+ curr_dir = Dir.getwd
67
67
  begin
68
68
  file_dir = File.dirname(__FILE__)
69
69
  Dir.chdir(file_dir + '/sample_features')
70
70
  unless File.exist?(Cukedep::YMLFilename)
71
- expect { subject.run!(['--setup'])}.to raise_error(SystemExit)
71
+ expect { subject.run!(['--setup']) }.to raise_error(SystemExit)
72
72
  end
73
73
  subject.run!(['--project', '../../../sample'])
74
74
  ensure
@@ -77,5 +77,4 @@ describe Application do
77
77
  end
78
78
  end # context
79
79
  end # describe
80
-
81
- end # module
80
+ end # module
@@ -1,15 +1,14 @@
1
1
  # File: cmd-line_spec.rb
2
2
 
3
3
  require 'stringio'
4
+ require 'English'
4
5
  require_relative '../../spec_helper'
5
6
 
6
7
  # Load the class under testing
7
8
  require_relative '../../../lib/cukedep/cli/cmd-line'
8
9
 
9
10
  module Cukedep # Open module to get rid of long qualified names
10
-
11
11
  describe CLI::CmdLine do
12
-
13
12
  context 'Creation & initialization:' do
14
13
  subject { CLI::CmdLine.new }
15
14
 
@@ -20,13 +19,13 @@ describe CLI::CmdLine do
20
19
 
21
20
  context 'Provided services:' do
22
21
  def capture_output()
23
- @output = $>
22
+ @output = $DEFAULT_OUTPUT
24
23
  ostream = StringIO.new('rw')
25
- $> = ostream
24
+ $DEFAULT_OUTPUT = ostream
26
25
  end
27
26
 
28
27
  def release_output()
29
- $> = @output
28
+ $DEFAULT_OUTPUT = @output
30
29
  end
31
30
 
32
31
 
@@ -37,12 +36,12 @@ describe CLI::CmdLine do
37
36
 
38
37
  it 'should accept the dry-run option' do
39
38
  expect { subject.parse!(['--dry-run']) }.not_to raise_error
40
- expect(subject.options).to eq({ :dryrun => true })
39
+ expect(subject.options).to eq(dryrun: true)
41
40
  end
42
41
 
43
42
  it 'should accept the setup option' do
44
43
  expect { subject.parse!(['--setup']) }.not_to raise_error
45
- expect(subject.options).to eq({ :setup => true })
44
+ expect(subject.options).to eq(setup: true)
46
45
  end
47
46
 
48
47
  it 'should validate the project option argument' do
@@ -62,16 +61,16 @@ MSG_END
62
61
  expect { subject.parse!(cmd_opts) }.to raise_error(err_type, err_msg)
63
62
 
64
63
  # Case 3: project dir exists
65
- #cmd_opts = ['--project', '../../../sample']
66
- #expect { subject.parse!(cmd_opts) }.not_to raise_error
67
- #expect(subject.options).to eq({ :project => '../../../sample' })
64
+ # cmd_opts = ['--project', '../../../sample']
65
+ # expect { subject.parse!(cmd_opts) }.not_to raise_error
66
+ # expect(subject.options).to eq({ :project => '../../../sample' })
68
67
  end
69
68
 
70
69
  it 'should handle the version option' do
71
70
  capture_output
72
71
  cmd_opts = ['--version']
73
72
  expect { subject.parse!(cmd_opts) }.to raise_error(SystemExit)
74
- expect($>.string).to eq(Cukedep::Version + "\n")
73
+ expect($DEFAULT_OUTPUT.string).to eq(Cukedep::Version + "\n")
75
74
  release_output
76
75
  end
77
76
 
@@ -79,13 +78,11 @@ MSG_END
79
78
  capture_output
80
79
  cmd_opts = ['--help']
81
80
  expect { subject.parse!(cmd_opts) }.to raise_error(SystemExit)
82
- expect($>.string).to eq(subject.parser.to_s)
81
+ expect($DEFAULT_OUTPUT.string).to eq(subject.parser.to_s)
83
82
  release_output
84
83
  end
85
84
  end # context
86
-
87
-
88
-
89
85
  end # describe
86
+ end # module
90
87
 
91
- end # module
88
+ # End of file
@@ -8,73 +8,67 @@ require_relative '../../lib/cukedep/cuke-runner'
8
8
 
9
9
 
10
10
  module Cukedep # Open module to get rid of long qualified names
11
-
12
- describe CukeRunner do
13
- let(:project_dir) { '../../sample' }
14
- let(:base_dir) do
15
- file_dir = File.dirname(__FILE__)
16
- file_dir + '/sample_features'
17
- end
18
-
19
- subject { CukeRunner.new(base_dir, project_dir, Config.default) }
20
-
21
- before(:each) do
22
- @orig_dir = Dir.getwd
23
- Dir.chdir(File.dirname(__FILE__))
24
- end
25
-
26
- after(:each) do
27
- Dir.chdir(@orig_dir)
28
- end
29
-
30
-
31
- context 'Creation & initialization:' do
32
-
33
- it 'should be created with three arguments' do
34
- expect { CukeRunner.new(base_dir, project_dir, Config.default) }.not_to raise_error
35
- end
36
-
37
- it 'should know its work directory' do
38
- expect(subject.base_dir).to eq(base_dir)
39
- end
40
-
41
- it 'should know the project directory' do
42
- expect(subject.proj_dir).to eq(File.expand_path(project_dir))
43
- end
44
- end # context
45
-
46
-
47
- context 'Provided services:' do
48
-
49
- it 'should launch Cucumber when requested' do
50
- #subject.invoke
11
+ describe CukeRunner do
12
+ let(:project_dir) { '../../sample' }
13
+ let(:base_dir) do
14
+ file_dir = File.dirname(__FILE__)
15
+ file_dir + '/sample_features'
51
16
  end
52
17
 
53
- it "should handle the 'before_all' event" do
54
- expect { subject.before_all }.not_to raise_error
55
- end
56
-
57
- it "should reject a second 'before_all' event" do
58
- subject.before_all
59
- err_msg = "expected state was 'Initialized' instead of 'ReadyToRun'."
60
- expect { subject.before_all }.to raise_error(StandardError, err_msg)
61
- end
18
+ subject { CukeRunner.new(base_dir, project_dir, Config.default) }
62
19
 
63
- it "should handle the 'after_all' event" do
64
- subject.before_all
65
- expect { subject.after_all }.not_to raise_error
20
+ before(:each) do
21
+ @orig_dir = Dir.getwd
22
+ Dir.chdir(File.dirname(__FILE__))
66
23
  end
67
24
 
68
- it "should run the designated feature files" do
69
- subject.before_all
70
- #expect {
71
- subject.run!(['a_few_tests.feature']) #}.not_to raise_error
25
+ after(:each) do
26
+ Dir.chdir(@orig_dir)
72
27
  end
73
28
 
74
- end # context
75
-
76
- end # describe
77
29
 
30
+ context 'Creation & initialization:' do
31
+ it 'should be created with three arguments' do
32
+ expect { CukeRunner.new(base_dir, project_dir, Config.default) }
33
+ .not_to raise_error
34
+ end
35
+
36
+ it 'should know its work directory' do
37
+ expect(subject.base_dir).to eq(base_dir)
38
+ end
39
+
40
+ it 'should know the project directory' do
41
+ expect(subject.proj_dir).to eq(File.expand_path(project_dir))
42
+ end
43
+ end # context
44
+
45
+
46
+ context 'Provided services:' do
47
+ it 'should launch Cucumber when requested' do
48
+ # subject.invoke
49
+ end
50
+
51
+ it "should handle the 'before_all' event" do
52
+ expect { subject.before_all }.not_to raise_error
53
+ end
54
+
55
+ it "should reject a second 'before_all' event" do
56
+ subject.before_all
57
+ err_msg = "expected state was 'Initialized' instead of 'ReadyToRun'."
58
+ expect { subject.before_all }.to raise_error(StandardError, err_msg)
59
+ end
60
+
61
+ it "should handle the 'after_all' event" do
62
+ subject.before_all
63
+ expect { subject.after_all }.not_to raise_error
64
+ end
65
+
66
+ it 'should run the designated feature files' do
67
+ subject.before_all
68
+ # expect {
69
+ subject.run!(['a_few_tests.feature']) # }.not_to raise_error
70
+ end
71
+ end # context
72
+ end # describe
78
73
  end # module
79
-
80
- # End of file
74
+ # End of file
@@ -6,31 +6,26 @@ require_relative '../spec_helper'
6
6
  require_relative '../../lib/cukedep/customization'
7
7
 
8
8
  module Cukedep # Open module to get rid of long qualified names
9
-
10
- describe Customization do
11
-
12
-
13
- context 'Provided services:' do
14
- it 'should load hook handlers' do
15
- directory = File.join(File.dirname(__FILE__), '/sample_features')
16
-
17
- expect { subject.build_handlers(directory) }.not_to raise_error
18
- expect(subject.build_handlers(directory)).not_to be_nil
19
- handlers = subject.build_handlers(directory)
20
- expect(handlers[:before_hooks].size).to eq(2)
21
- expect(handlers[:after_hooks].size).to eq(2)
22
- end
23
-
24
- it 'should return nil when hook file absent' do
25
- directory = File.dirname(__FILE__)
26
-
27
- expect { subject.build_handlers(directory) }.not_to raise_error
28
- expect(subject.build_handlers(directory)).to be_nil
29
- end
30
- end # context
31
-
32
- end # describe
33
-
9
+ describe Customization do
10
+ context 'Provided services:' do
11
+ it 'should load hook handlers' do
12
+ directory = File.join(File.dirname(__FILE__), '/sample_features')
13
+
14
+ expect { subject.build_handlers(directory) }.not_to raise_error
15
+ expect(subject.build_handlers(directory)).not_to be_nil
16
+ handlers = subject.build_handlers(directory)
17
+ expect(handlers[:before_hooks].size).to eq(2)
18
+ expect(handlers[:after_hooks].size).to eq(2)
19
+ end
20
+
21
+ it 'should return nil when hook file absent' do
22
+ directory = File.dirname(__FILE__)
23
+
24
+ expect { subject.build_handlers(directory) }.not_to raise_error
25
+ expect(subject.build_handlers(directory)).to be_nil
26
+ end
27
+ end # context
28
+ end # describe
34
29
  end # module
35
30
 
36
- # End of file
31
+ # End of file
@@ -2,26 +2,28 @@ require 'pp'
2
2
 
3
3
  require_relative '../../lib/cukedep/file-action'
4
4
 
5
- copy_config = {:save_patterns=>[],
6
- :save_subdir=>"",
7
- :delete_patterns=>[],
8
- :delete_subdir=>"",
9
- :copy_patterns=>["*.txt"],
10
- :copy_subdir=>""}
5
+ copy_config = {
6
+ save_patterns: [],
7
+ save_subdir: '',
8
+ delete_patterns: [],
9
+ delete_subdir: '',
10
+ copy_patterns: ['*.txt'],
11
+ copy_subdir: ''
12
+ }
11
13
 
12
14
  pp Dir.pwd
13
15
  instance = Cukedep::ActionTriplet.new(copy_config)
14
-
15
- files_to_copy_dir = 'C:/Ruby193/lib/ruby/site_ruby/Cukedep/spec/cukedep/sample_features/files_to_copy'
16
+ path = 'C:/Ruby193/lib/ruby/site_ruby/Cukedep/spec/cukedep/'
17
+ files_to_copy_dir = path + 'sample_features/files_to_copy'
16
18
 
17
19
  Dir.chdir(files_to_copy_dir)
18
20
  pp Dir.pwd
19
21
 
20
- proj_dir = "C:/Ruby193/lib/ruby/site_ruby/Cukedep/spec/cukedep/dummy_project"
22
+ proj_dir = path + 'dummy_project'
21
23
  instance.run!(Dir.getwd, proj_dir)
22
24
 
23
25
  # Check that the project dir contain the requested files
24
26
  Dir.chdir(proj_dir)
25
27
  pp Dir.pwd # TODO
26
28
  actuals = Dir['*.*']
27
- pp actuals
29
+ pp actuals
@@ -10,12 +10,11 @@ require_relative '../../lib/cukedep/gherkin-listener'
10
10
  require_relative '../../lib/cukedep/feature-model'
11
11
 
12
12
  module Cukedep # Open module to get rid of long qualified names
13
-
14
13
  describe FeatureModel do
15
14
  # An array of FeatureFile objects created after parsing sample files.
16
15
  FeatureFiles = begin
17
16
  listener = GherkinListener.new
18
- self.extend(FileParsing) # Add behaviour from mixin module
17
+ extend(FileParsing) # Add behaviour from mixin module
19
18
  parse_for(listener) # Method from mixin to parse sample feature files
20
19
  listener.feature_files
21
20
  end
@@ -31,7 +30,6 @@ describe FeatureModel do
31
30
  it 'should know its feature file objects' do
32
31
  expect(subject.feature_files).to eq(FeatureFiles)
33
32
  end
34
-
35
33
  end # context
36
34
 
37
35
  context 'Provided services:' do
@@ -52,7 +50,7 @@ describe FeatureModel do
52
50
  second_id = 'qux'
53
51
  found = subject.select_by_ids(one_id, second_id)
54
52
  expect(found.size).to eq(2)
55
- actual_ids = found.map {|ff| ff.feature.identifier}
53
+ actual_ids = found.map { |ff| ff.feature.identifier }
56
54
  expected_ids = [one_id, second_id]
57
55
  expect(actual_ids.sort).to eq(expected_ids.sort)
58
56
 
@@ -60,29 +58,31 @@ describe FeatureModel do
60
58
  wrong_id = 'does_not_exist'
61
59
  err_type = StandardError
62
60
  err_msg = "No feature file with identifier 'does_not_exist'."
63
- expect { subject.select_by_ids(wrong_id) }.to raise_error(err_type, err_msg)
61
+ expect { subject.select_by_ids(wrong_id) }
62
+ .to raise_error(err_type, err_msg)
64
63
  end
65
64
 
66
65
 
67
66
  it 'should resolve dependency links' do
68
67
  mapping = subject.send(:id2features)
69
- deps = subject.dependency_links()
68
+ deps = subject.dependency_links
70
69
  expect(deps).not_to be_empty
71
70
 
72
71
  # Case of an identified feature without dependencies
73
- case1 = deps.find {|a_dep| a_dep.dependee == mapping['baz']}
72
+ case1 = deps.find { |a_dep| a_dep.dependee == mapping['baz'] }
74
73
  expect(case1.dependents).to be_empty
75
74
 
76
75
  # Case of a feature having dependencies
77
- case2 = deps.find {|a_dep| a_dep.dependee == mapping['foo']}
76
+ case2 = deps.find { |a_dep| a_dep.dependee == mapping['foo'] }
78
77
  expectations = subject.select_by_ids('bar', 'qux')
79
78
  expect(case2.dependents).to eq(expectations)
80
79
  end
81
80
 
82
81
  it 'should sort the feature files' do
83
- sorted_files = subject.sort_features_by_dep()
84
- actual_order = sorted_files.map {|f| f.feature.identifier}
85
- expected_order = %w[qux baz bar foo]
82
+ sorted_files = subject.sort_features_by_dep
83
+ actual_order = sorted_files.map { |f| f.feature.identifier }
84
+ expected_order = %w(qux baz quux bar foo)
85
+ expect(actual_order).to eq(expected_order)
86
86
  end
87
87
 
88
88
  it 'should generate mapping reports' do
@@ -90,14 +90,11 @@ describe FeatureModel do
90
90
  end
91
91
 
92
92
  it 'should generate dependency graph' do
93
- subject.dependency_links()
93
+ subject.dependency_links
94
94
  subject.draw_dependency_graph('dependencies.dot')
95
95
  end
96
-
97
96
  end # context
98
-
99
97
  end # describe
100
-
101
98
  end # module
102
99
 
103
- # End of file
100
+ # End of file