cukedep 0.1.06 → 0.1.07
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.
- checksums.yaml +8 -8
- data/CHANGELOG.md +3 -0
- data/Gemfile +5 -5
- data/README.md +1 -1
- data/lib/cukedep/constants.rb +1 -1
- data/sample/features/step_definitions/steps.rb +11 -11
- data/sample/model/catalogue.yml +1 -10
- data/sample/model/rentals.yml +1 -4
- data/sample/result.html +1 -1
- data/spec/cukedep/application_spec.rb +2 -2
- data/spec/cukedep/cuke-runner_spec.rb +3 -3
- data/spec/cukedep/customization_spec.rb +2 -2
- data/spec/cukedep/debug-file-action.rb +27 -0
- data/spec/cukedep/feature-model_spec.rb +5 -5
- data/spec/cukedep/file-action_spec.rb +34 -26
- data/spec/cukedep/gherkin-facade_spec.rb +2 -2
- data/spec/cukedep/gherkin-listener_spec.rb +58 -58
- data/spec/cukedep/sample_features/cukedep.rake +1 -1
- data/spec/cukedep/sample_features/dependencies.dot +1 -1
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MDNkMTRlMjBjYjE1YmNlODQwMjA4MWM5NTZkNTkzODczNDdlZmJlYQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZTQ5N2UzYWQyNDczMDBkYzZkZmIyZGViNTI3YTk0MzJkYWRkNzViYQ==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NzMxOGY0ZWI3MGVjNjk2MmYyMGFiYTJhOTBkZWQ5OWVmNDRmYTJiYmJiYWM5
|
10
|
+
ODE0ZmEyNDJhOGFlZGJjOTVjNTY1ZDI3OTYzMzc1MjVjOTJmOTI5M2NmN2E2
|
11
|
+
NmNmOThmY2FiMzRhMmFjZTQyZjQwYTUwMTE3OWM5ODZjMjI5MTM=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
YzIwOTdiYTUyMWM1OWE1MDgyYzM1YWVmMzM5N2JmMDJiNTIyY2Q4Mzk5M2Q0
|
14
|
+
YTIxOTZkOTI2ZWRmNTAzYWQ0OWE3MGZmZDIzMmRjN2MwNWQ1ODliYWZkMjA2
|
15
|
+
NjRlMzkxMjMyZjc5ZjhlYjlkZTQxMTFlODU0NzQ2NGI1ZWMxMjc=
|
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
source 'https://rubygems.org'
|
2
2
|
# Prevent Bundler to load the dependencies from our .gemspec file
|
3
3
|
|
4
|
-
gem
|
5
|
-
gem
|
6
|
-
gem
|
4
|
+
gem 'gherkin', ['>=' '1.0.24']
|
5
|
+
gem 'cucumber', ['>= 0.7.0']
|
6
|
+
gem 'rake', ['>= 0.8.0' ]
|
7
7
|
|
8
8
|
group :development do
|
9
|
-
gem
|
10
|
-
gem
|
9
|
+
gem 'rspec', '>= 3.0.0'
|
10
|
+
gem 'simplecov', '>= 0.5.0'
|
11
11
|
end
|
data/README.md
CHANGED
@@ -125,5 +125,5 @@ While feature `bar` may start like this:
|
|
125
125
|
|
126
126
|
Copyright
|
127
127
|
---------
|
128
|
-
Copyright (c) 2013, Dimitri Geshef.
|
128
|
+
Copyright (c) 2013, 2014, Dimitri Geshef.
|
129
129
|
__Cukedep__ is released under the MIT License see [LICENSE.txt](https://github.com/famished-tiger/Cukedep/blob/master/LICENSE.txt) for details.
|
data/lib/cukedep/constants.rb
CHANGED
@@ -10,18 +10,18 @@ Given(/^I add the video "(.*?)" to the catalogue$/) do |a_title|
|
|
10
10
|
end
|
11
11
|
|
12
12
|
Then(/^I should see the video "(.*?)" as unknown$/) do |a_title|
|
13
|
-
$store.search_video(a_title).
|
13
|
+
expect($store.search_video(a_title)).to be_nil
|
14
14
|
end
|
15
15
|
|
16
16
|
Then(/^I should see the video "(.*?)" as (available)$/) do |a_title, a_state|
|
17
17
|
found_video = $store.search_video(a_title)
|
18
|
-
found_video.state.
|
18
|
+
expect(found_video.state).not_to eq(a_state.to_sym)
|
19
19
|
end
|
20
20
|
|
21
21
|
When(/^I remove the video "(.*?)"$/) do |a_title|
|
22
22
|
found_video = $store.search_video(a_title)
|
23
|
-
found_video.
|
24
|
-
found_video.state.
|
23
|
+
expect(found_video).not_to be_nil
|
24
|
+
expect(found_video.state).to eq(:available)
|
25
25
|
$store.remove_video(found_video)
|
26
26
|
end
|
27
27
|
|
@@ -52,7 +52,7 @@ When(/^I enter the credentials "(.*?)"$/) do |credential|
|
|
52
52
|
end
|
53
53
|
|
54
54
|
Then(/^I should not be authorized$/) do
|
55
|
-
$store.search_user(@entered_credential).
|
55
|
+
expect($store.search_user(@entered_credential)).to be_nil
|
56
56
|
puts "Invalid user credential"
|
57
57
|
end
|
58
58
|
|
@@ -61,18 +61,18 @@ When(/^I register my credentials "(.*?)"$/) do |credential|
|
|
61
61
|
end
|
62
62
|
|
63
63
|
Then(/^I should see a welcome message$/) do
|
64
|
-
$store.search_user(@entered_credential).
|
64
|
+
#expect($store.search_user(@entered_credential)).to be_nil
|
65
65
|
puts "Welcome to the rental application."
|
66
66
|
end
|
67
67
|
|
68
68
|
|
69
69
|
When(/^I register the rental of "(.*?)" for "(.*?)"$/) do |a_title, member_name|
|
70
70
|
found_video = $store.search_video(a_title)
|
71
|
-
found_video.
|
72
|
-
found_video.state.
|
71
|
+
expect(found_video).not_to be_nil
|
72
|
+
expect(found_video.state).to eq(:available)
|
73
73
|
|
74
74
|
member = $store.search_member(member_name)
|
75
|
-
member.
|
75
|
+
expect(member).not_to be_nil
|
76
76
|
$store.add_rental(found_video, member)
|
77
77
|
@confirm_rental = true
|
78
78
|
end
|
@@ -89,8 +89,8 @@ end
|
|
89
89
|
|
90
90
|
When(/^I register the return of "(.*?)" from "(.*?)"$/) do |a_title, member_name|
|
91
91
|
rental = $store.search_rental(a_title)
|
92
|
-
rental.
|
93
|
-
rental.member.
|
92
|
+
expect(rental).not_to be_nil
|
93
|
+
expect(rental.member).to eq(member_name)
|
94
94
|
$store.close_rental(rental)
|
95
95
|
@confirm_return = true
|
96
96
|
end
|
data/sample/model/catalogue.yml
CHANGED
@@ -1,13 +1,4 @@
|
|
1
1
|
---
|
2
2
|
- !ruby/struct:Sample::Video
|
3
|
-
title:
|
4
|
-
state: :available
|
5
|
-
- !ruby/struct:Sample::Video
|
6
|
-
title: The revenge of the Cucumber
|
7
|
-
state: :available
|
8
|
-
- !ruby/struct:Sample::Video
|
9
|
-
title: The peeled Cucumber
|
10
|
-
state: :available
|
11
|
-
- !ruby/struct:Sample::Video
|
12
|
-
title: The masked Cucumber
|
3
|
+
title: Othello
|
13
4
|
state: :available
|
data/sample/model/rentals.yml
CHANGED
data/sample/result.html
CHANGED
@@ -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 12--><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='features\a_few_tests_feature_9' 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('8.3');</script><li id='features\a_few_tests_feature_10' class='step passed'><div class="step_name"><span class="keyword">When </span><span class="step val">I enter the credentials "<span class="param">it's me</span>"</span></div><div class="step_file"><span>features/step_definitions/steps.rb:50</span></div></li> <script type="text/javascript">moveProgressBar('16.6');</script><li id='features\a_few_tests_feature_11' 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('25.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='features\a_few_tests_feature_15' class='step skipped'><div class="step_name"><span class="keyword">When </span><span class="step val">I register my credentials "<credentials>"</span></div><div class="step_file"><span>features/step_definitions/steps.rb:59</span></div></li> <script type="text/javascript">moveProgressBar('33.3');</script><li id='features\a_few_tests_feature_16' class='step skipped'><div class="step_name"><span class="keyword">When </span><span class="step val">I enter the credentials "<credentials>"</span></div><div class="step_file"><span>features/step_definitions/steps.rb:50</span></div></li> <script type="text/javascript">moveProgressBar('41.6');</script><li id='features\a_few_tests_feature_17' 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/step_definitions/steps.rb:63</span></div></li> <script type="text/javascript">moveProgressBar('50.0');</script></ol><div class="examples"><h4><span class="keyword">Examples</span> <span class="val"></span></h4><table><tr class='step' id='row_20'><th class="step skipped_param" id="row_20_0"><div><span class="step param">credentials</span></div></th></tr> <script type="text/javascript">moveProgressBar('58.3');</script><tr class='step' id='row_21'><td class="step passed" id="row_21_0"><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('66.6');</script><tr class='step' id='row_22'><td class="step passed" id="row_22_0"><div><span class="step param">himself</span></div></td><td class="message">Welcome to the rental application.</td></tr> <script type="text/javascript">moveProgressBar('75.0');</script><tr class='step' id='row_23'><td class="step passed" id="row_23_0"><div><span class="step param">nemo</span></div></td><td class="message">Welcome to the rental application.</td></tr> <script type="text/javascript">moveProgressBar('83.3');</script></table></div></div></div><script type="text/javascript">document.getElementById('duration').innerHTML = "Finished in <strong>0m0.
|
472
|
+
</script></head><body><!-- Step count 12--><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='features\a_few_tests_feature_9' 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('8.3');</script><li id='features\a_few_tests_feature_10' class='step passed'><div class="step_name"><span class="keyword">When </span><span class="step val">I enter the credentials "<span class="param">it's me</span>"</span></div><div class="step_file"><span>features/step_definitions/steps.rb:50</span></div></li> <script type="text/javascript">moveProgressBar('16.6');</script><li id='features\a_few_tests_feature_11' 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('25.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='features\a_few_tests_feature_15' class='step skipped'><div class="step_name"><span class="keyword">When </span><span class="step val">I register my credentials "<credentials>"</span></div><div class="step_file"><span>features/step_definitions/steps.rb:59</span></div></li> <script type="text/javascript">moveProgressBar('33.3');</script><li id='features\a_few_tests_feature_16' class='step skipped'><div class="step_name"><span class="keyword">When </span><span class="step val">I enter the credentials "<credentials>"</span></div><div class="step_file"><span>features/step_definitions/steps.rb:50</span></div></li> <script type="text/javascript">moveProgressBar('41.6');</script><li id='features\a_few_tests_feature_17' 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/step_definitions/steps.rb:63</span></div></li> <script type="text/javascript">moveProgressBar('50.0');</script></ol><div class="examples"><h4><span class="keyword">Examples</span> <span class="val"></span></h4><table><tr class='step' id='row_20'><th class="step skipped_param" id="row_20_0"><div><span class="step param">credentials</span></div></th></tr> <script type="text/javascript">moveProgressBar('58.3');</script><tr class='step' id='row_21'><td class="step passed" id="row_21_0"><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('66.6');</script><tr class='step' id='row_22'><td class="step passed" id="row_22_0"><div><span class="step param">himself</span></div></td><td class="message">Welcome to the rental application.</td></tr> <script type="text/javascript">moveProgressBar('75.0');</script><tr class='step' id='row_23'><td class="step passed" id="row_23_0"><div><span class="step param">nemo</span></div></td><td class="message">Welcome to the rental application.</td></tr> <script type="text/javascript">moveProgressBar('83.3');</script></table></div></div></div><script type="text/javascript">document.getElementById('duration').innerHTML = "Finished in <strong>0m0.021s seconds</strong>";</script><script type="text/javascript">document.getElementById('totals').innerHTML = "4 scenarios (4 passed)<br />12 steps (12 passed)";</script></div></body></html>
|
@@ -32,7 +32,7 @@ describe Application do
|
|
32
32
|
expect { subject.run!(['--setup'])}.to raise_error(SystemExit)
|
33
33
|
|
34
34
|
# Check that the config file was effectively created.
|
35
|
-
expect
|
35
|
+
expect(File.exist?(Cukedep::YMLFilename)).to be true
|
36
36
|
created_config = Config.load_cfg(Cukedep::YMLFilename)
|
37
37
|
expect(created_config).to eq(Config.default)
|
38
38
|
|
@@ -52,7 +52,7 @@ describe Application do
|
|
52
52
|
it 'should complain in absence of project dir' do
|
53
53
|
# Start state: no config
|
54
54
|
File.delete(Cukedep::YMLFilename) if File.exist?(Cukedep::YMLFilename)
|
55
|
-
expect(File.exist?(Cukedep::YMLFilename)).to
|
55
|
+
expect(File.exist?(Cukedep::YMLFilename)).to be_falsey
|
56
56
|
|
57
57
|
# Create default config
|
58
58
|
expect { subject.run!(['--setup'])}.to raise_error(SystemExit)
|
@@ -1,14 +1,13 @@
|
|
1
1
|
# File: cuke-runner_spec.rb
|
2
2
|
|
3
3
|
require_relative '../spec_helper'
|
4
|
-
|
5
4
|
require_relative '../../lib/cukedep/config'
|
6
5
|
|
7
6
|
# Load the class under testing
|
8
7
|
require_relative '../../lib/cukedep/cuke-runner'
|
9
8
|
|
10
|
-
module Cukedep # Open module to get rid of long qualified names
|
11
9
|
|
10
|
+
module Cukedep # Open module to get rid of long qualified names
|
12
11
|
|
13
12
|
describe CukeRunner do
|
14
13
|
let(:project_dir) { '../../sample' }
|
@@ -68,7 +67,8 @@ describe CukeRunner do
|
|
68
67
|
|
69
68
|
it "should run the designated feature files" do
|
70
69
|
subject.before_all
|
71
|
-
expect {
|
70
|
+
#expect {
|
71
|
+
subject.run!(['a_few_tests.feature']) #}.not_to raise_error
|
72
72
|
end
|
73
73
|
|
74
74
|
end # context
|
@@ -17,8 +17,8 @@ describe Customization do
|
|
17
17
|
expect { subject.build_handlers(directory) }.not_to raise_error
|
18
18
|
expect(subject.build_handlers(directory)).not_to be_nil
|
19
19
|
handlers = subject.build_handlers(directory)
|
20
|
-
expect(handlers[:before_hooks]).to
|
21
|
-
expect(handlers[:after_hooks]).to
|
20
|
+
expect(handlers[:before_hooks].size).to eq(2)
|
21
|
+
expect(handlers[:after_hooks].size).to eq(2)
|
22
22
|
end
|
23
23
|
|
24
24
|
it 'should return nil when hook file absent' do
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'pp'
|
2
|
+
|
3
|
+
require_relative '../../lib/cukedep/file-action'
|
4
|
+
|
5
|
+
copy_config = {:save_patterns=>[],
|
6
|
+
:save_subdir=>"",
|
7
|
+
:delete_patterns=>[],
|
8
|
+
:delete_subdir=>"",
|
9
|
+
:copy_patterns=>["*.txt"],
|
10
|
+
:copy_subdir=>""}
|
11
|
+
|
12
|
+
pp Dir.pwd
|
13
|
+
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
|
+
|
17
|
+
Dir.chdir(files_to_copy_dir)
|
18
|
+
pp Dir.pwd
|
19
|
+
|
20
|
+
proj_dir = "C:/Ruby193/lib/ruby/site_ruby/Cukedep/spec/cukedep/dummy_project"
|
21
|
+
instance.run!(Dir.getwd, proj_dir)
|
22
|
+
|
23
|
+
# Check that the project dir contain the requested files
|
24
|
+
Dir.chdir(proj_dir)
|
25
|
+
pp Dir.pwd # TODO
|
26
|
+
actuals = Dir['*.*']
|
27
|
+
pp actuals
|
@@ -15,8 +15,8 @@ describe FeatureModel do
|
|
15
15
|
# An array of FeatureFile objects created after parsing sample files.
|
16
16
|
FeatureFiles = begin
|
17
17
|
listener = GherkinListener.new
|
18
|
-
self.extend(FileParsing)
|
19
|
-
parse_for(listener) #
|
18
|
+
self.extend(FileParsing) # Add behaviour from mixin module
|
19
|
+
parse_for(listener) # Method from mixin to parse sample feature files
|
20
20
|
listener.feature_files
|
21
21
|
end
|
22
22
|
|
@@ -37,7 +37,7 @@ describe FeatureModel do
|
|
37
37
|
context 'Provided services:' do
|
38
38
|
it 'should list all features without identifiers' do
|
39
39
|
unidentified = subject.anonymous_features
|
40
|
-
expect(unidentified).to
|
40
|
+
expect(unidentified.size).to eq(1)
|
41
41
|
expect(unidentified[0].filepath).to match(/standalone\.feature$/)
|
42
42
|
end
|
43
43
|
|
@@ -45,13 +45,13 @@ describe FeatureModel do
|
|
45
45
|
# Case of a single id argument
|
46
46
|
one_id = 'foo'
|
47
47
|
found = subject.select_by_ids(one_id)
|
48
|
-
expect(found).to
|
48
|
+
expect(found.size).to eq(1)
|
49
49
|
expect(found[0].feature.identifier).to eq(one_id)
|
50
50
|
|
51
51
|
# Case of multiple id arguments
|
52
52
|
second_id = 'qux'
|
53
53
|
found = subject.select_by_ids(one_id, second_id)
|
54
|
-
expect(found).to
|
54
|
+
expect(found.size).to eq(2)
|
55
55
|
actual_ids = found.map {|ff| ff.feature.identifier}
|
56
56
|
expected_ids = [one_id, second_id]
|
57
57
|
expect(actual_ids.sort).to eq(expected_ids.sort)
|
@@ -1,5 +1,4 @@
|
|
1
1
|
# File: file-action_spec.rb
|
2
|
-
|
3
2
|
require_relative '../spec_helper'
|
4
3
|
|
5
4
|
# Load the class under testing
|
@@ -106,7 +105,7 @@ describe CopyAction do
|
|
106
105
|
Dir.chdir(my_dir)
|
107
106
|
# Control the result...
|
108
107
|
copied_files = Dir.glob(subdir + '/' + '*.*')
|
109
|
-
expect(copied_files).to
|
108
|
+
expect(copied_files.size).to eq(1)
|
110
109
|
|
111
110
|
# Case: two file patterns
|
112
111
|
instance2 = CopyAction.new(['file1.txt', 'file2.txt'], subdir)
|
@@ -114,7 +113,7 @@ describe CopyAction do
|
|
114
113
|
|
115
114
|
# Control the result...
|
116
115
|
copied_files = Dir.glob(subdir + '/' + '*.*')
|
117
|
-
expect(copied_files).to
|
116
|
+
expect(copied_files.size).to eq(3)
|
118
117
|
end
|
119
118
|
|
120
119
|
end # context
|
@@ -155,7 +154,7 @@ describe DeleteAction do
|
|
155
154
|
|
156
155
|
# Control the result...
|
157
156
|
remaining_files = Dir.glob(subdir + '/' + '*.*')
|
158
|
-
expect(remaining_files).to
|
157
|
+
expect(remaining_files.size).to eq(2)
|
159
158
|
|
160
159
|
# Case: multiple file patterns and no subdir
|
161
160
|
instance2 = DeleteAction.new(['file1.txt', 'file3.txt'])
|
@@ -163,7 +162,7 @@ describe DeleteAction do
|
|
163
162
|
|
164
163
|
# Control the result...
|
165
164
|
remaining_files = Dir.glob(subdir + '/' + '*.*')
|
166
|
-
expect(remaining_files).to
|
165
|
+
expect(remaining_files.size).to eq(1)
|
167
166
|
|
168
167
|
# Delete all files
|
169
168
|
instance3 = DeleteAction.new(['*.*'])
|
@@ -171,7 +170,7 @@ describe DeleteAction do
|
|
171
170
|
|
172
171
|
# Control the result...
|
173
172
|
remaining_files = Dir.glob(subdir + '/' + '*.*')
|
174
|
-
expect(remaining_files).to
|
173
|
+
expect(remaining_files.size).to eq(0)
|
175
174
|
end
|
176
175
|
end # context
|
177
176
|
|
@@ -181,14 +180,20 @@ end # describe
|
|
181
180
|
|
182
181
|
describe ActionTriplet do
|
183
182
|
|
184
|
-
|
183
|
+
def saved_files_dir()
|
185
184
|
my_dir = File.dirname(__FILE__)
|
186
|
-
my_dir + '/sample_features/saved_files'
|
185
|
+
return my_dir + '/sample_features/saved_files'
|
187
186
|
end
|
188
187
|
|
189
188
|
# File patterns
|
190
|
-
|
191
|
-
|
189
|
+
def all_files()
|
190
|
+
return ['*.*']
|
191
|
+
end
|
192
|
+
|
193
|
+
|
194
|
+
def txt_only()
|
195
|
+
return ['*.txt']
|
196
|
+
end
|
192
197
|
|
193
198
|
let(:empty_config) do
|
194
199
|
{
|
@@ -264,7 +269,7 @@ describe ActionTriplet do
|
|
264
269
|
|
265
270
|
|
266
271
|
# Directories
|
267
|
-
|
272
|
+
def proj_dir()
|
268
273
|
my_dir = File.join(File.dirname(__FILE__), '/dummy_project')
|
269
274
|
|
270
275
|
unless Dir.exist?(my_dir)
|
@@ -273,10 +278,10 @@ describe ActionTriplet do
|
|
273
278
|
clean_dir(my_dir)
|
274
279
|
end
|
275
280
|
|
276
|
-
my_dir
|
281
|
+
return my_dir
|
277
282
|
end
|
278
283
|
|
279
|
-
|
284
|
+
def files_to_copy_dir()
|
280
285
|
child = '/sample_features/files_to_copy'
|
281
286
|
File.join(File.dirname(__FILE__), child)
|
282
287
|
end
|
@@ -306,16 +311,17 @@ describe ActionTriplet do
|
|
306
311
|
|
307
312
|
# Current dir is the directory containing the files to copy
|
308
313
|
Dir.chdir(files_to_copy_dir)
|
309
|
-
|
314
|
+
project_dir = proj_dir
|
315
|
+
instance.run!(Dir.getwd, project_dir)
|
310
316
|
|
311
317
|
# Check that the project dir contain the requested files
|
312
|
-
Dir.chdir(
|
318
|
+
Dir.chdir(project_dir)
|
313
319
|
actuals = Dir['*.*']
|
314
|
-
expect(actuals).to
|
320
|
+
expect(actuals.size).to eq(3)
|
315
321
|
expect(actuals.sort).to eq(%w[file1.txt file2.txt file3.txt])
|
316
322
|
|
317
323
|
# Clean project dir
|
318
|
-
clean_dir(
|
324
|
+
clean_dir(project_dir)
|
319
325
|
|
320
326
|
# Case 2: an instance with just two copy file patterns
|
321
327
|
copy_config[:copy_patterns] << 'README.md'
|
@@ -323,10 +329,10 @@ describe ActionTriplet do
|
|
323
329
|
|
324
330
|
# Current dir is the directory containing the files to copy
|
325
331
|
Dir.chdir(files_to_copy_dir)
|
326
|
-
instance.run!(Dir.getwd,
|
332
|
+
instance.run!(Dir.getwd, project_dir)
|
327
333
|
|
328
334
|
actuals = Dir['*.*']
|
329
|
-
expect(actuals).to
|
335
|
+
expect(actuals.size).to eq(4)
|
330
336
|
(txt_files, md_files) = actuals.partition {|f| f =~ /\.txt/}
|
331
337
|
expect(txt_files.sort).to eq(%w[file1.txt file2.txt file3.txt])
|
332
338
|
expect(md_files).to eq(%w[README.md])
|
@@ -335,33 +341,35 @@ describe ActionTriplet do
|
|
335
341
|
=begin
|
336
342
|
it 'should save files to the specified folder' do
|
337
343
|
# Clean saved_files dir
|
338
|
-
|
344
|
+
saved = saved_files_dir
|
345
|
+
Dir.chdir(saved)
|
339
346
|
pp Dir.getwd
|
340
|
-
expect(Dir['*.*']).to
|
347
|
+
expect(Dir['*.*']).to be_empty
|
341
348
|
|
342
349
|
save_config = empty_config.dup
|
343
350
|
save_config[:save_patterns] = ['README.md']
|
351
|
+
project_dir = proj_dir
|
344
352
|
|
345
353
|
# Case 1: the save dir is absolute
|
346
354
|
instance = ActionTriplet.new(save_config)
|
347
|
-
instance.run!(Dir.getwd,
|
355
|
+
instance.run!(Dir.getwd, project_dir)
|
348
356
|
actuals = Dir['*.*']
|
349
|
-
expect(actuals).to
|
357
|
+
expect(actuals.size).to eq(1)
|
350
358
|
expect(actuals).to eq(['README.md'])
|
351
359
|
|
352
360
|
# Clean again saved_files dir
|
353
|
-
clean_dir(
|
361
|
+
clean_dir(saved)
|
354
362
|
my_dir = File.dirname(__FILE__)
|
355
363
|
save_config[:save_patterns] = txt_only
|
356
364
|
save_config[:save_subdir] = './sample_features/saved_files'
|
357
365
|
|
358
366
|
instance = ActionTriplet.new(save_config)
|
359
367
|
Dir.chdir(my_dir)
|
360
|
-
instance.run!(my_dir,
|
368
|
+
instance.run!(my_dir, project_dir)
|
361
369
|
|
362
370
|
Dir.chdir(saved_files_dir)
|
363
371
|
actuals = Dir['*.*']
|
364
|
-
expect(actuals).to
|
372
|
+
expect(actuals.size).to eq(3)
|
365
373
|
expect(actuals.sort).to eq(%w[file1.txt file2.txt file3.txt])
|
366
374
|
end
|
367
375
|
=end
|
@@ -18,11 +18,11 @@ describe GherkinFacade do
|
|
18
18
|
|
19
19
|
it 'should whether it is verbose or not' do
|
20
20
|
# Case 1: instance is verbose
|
21
|
-
expect(subject.verbose).to
|
21
|
+
expect(subject.verbose).to be_falsey
|
22
22
|
|
23
23
|
# Case 2: instance is silent
|
24
24
|
instance = GherkinFacade.new(true, 'UTF-8')
|
25
|
-
expect(instance.verbose).to
|
25
|
+
expect(instance.verbose).to be_truthy
|
26
26
|
end
|
27
27
|
|
28
28
|
it 'should know the feature file external encoding' do
|
@@ -1,59 +1,59 @@
|
|
1
|
-
# File: gherkin-listener_spec.rb
|
2
|
-
|
3
|
-
require_relative '../spec_helper'
|
4
|
-
|
5
|
-
|
6
|
-
require_relative 'file-parsing'
|
7
|
-
|
8
|
-
# Load the class under testing
|
9
|
-
require_relative '../../lib/cukedep/gherkin-listener'
|
10
|
-
|
11
|
-
module Cukedep # Open module to get rid of long qualified names
|
12
|
-
|
13
|
-
describe GherkinListener do
|
14
|
-
include FileParsing # Use mixin module to parse of sample feature files
|
15
|
-
|
16
|
-
subject { GherkinListener.new }
|
17
|
-
|
18
|
-
context 'Creation and initialization:' do
|
19
|
-
it 'should be created without argument' do
|
20
|
-
expect {GherkinListener.new }.not_to raise_error
|
21
|
-
end
|
22
|
-
|
23
|
-
it 'should have no feature file at start' do
|
24
|
-
expect(subject).to
|
25
|
-
end
|
26
|
-
end # context
|
27
|
-
|
28
|
-
context 'Provided services:' do
|
29
|
-
it 'should build a FeatureFileRep per parsed file' do
|
30
|
-
parse_for(subject)
|
31
|
-
expect(subject).to
|
32
|
-
end
|
33
|
-
|
34
|
-
it 'should know the tags of each feature' do
|
35
|
-
parse_for(subject)
|
36
|
-
|
37
|
-
expectations = [
|
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
|
-
[]
|
44
|
-
]
|
45
|
-
|
46
|
-
# Sort the expectations to ease further comparison
|
47
|
-
expectations.map! { |tags| tags.sort }
|
48
|
-
|
49
|
-
subject.feature_files.each_with_index do |file, i|
|
50
|
-
expect(file.feature.tags.sort).to eq(expectations[i])
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end # context
|
54
|
-
|
55
|
-
end # describe
|
56
|
-
|
57
|
-
end # module
|
58
|
-
|
1
|
+
# File: gherkin-listener_spec.rb
|
2
|
+
|
3
|
+
require_relative '../spec_helper'
|
4
|
+
|
5
|
+
|
6
|
+
require_relative 'file-parsing'
|
7
|
+
|
8
|
+
# Load the class under testing
|
9
|
+
require_relative '../../lib/cukedep/gherkin-listener'
|
10
|
+
|
11
|
+
module Cukedep # Open module to get rid of long qualified names
|
12
|
+
|
13
|
+
describe GherkinListener do
|
14
|
+
include FileParsing # Use mixin module to parse of sample feature files
|
15
|
+
|
16
|
+
subject { GherkinListener.new }
|
17
|
+
|
18
|
+
context 'Creation and initialization:' do
|
19
|
+
it 'should be created without argument' do
|
20
|
+
expect {GherkinListener.new }.not_to raise_error
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'should have no feature file at start' do
|
24
|
+
expect(subject.feature_files.size).to eq(0)
|
25
|
+
end
|
26
|
+
end # context
|
27
|
+
|
28
|
+
context 'Provided services:' do
|
29
|
+
it 'should build a FeatureFileRep per parsed file' do
|
30
|
+
parse_for(subject)
|
31
|
+
expect(subject.feature_files.size).to eq(FileParsing::SampleFileNames.size)
|
32
|
+
end
|
33
|
+
|
34
|
+
it 'should know the tags of each feature' do
|
35
|
+
parse_for(subject)
|
36
|
+
|
37
|
+
expectations = [
|
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
|
+
[]
|
44
|
+
]
|
45
|
+
|
46
|
+
# Sort the expectations to ease further comparison
|
47
|
+
expectations.map! { |tags| tags.sort }
|
48
|
+
|
49
|
+
subject.feature_files.each_with_index do |file, i|
|
50
|
+
expect(file.feature.tags.sort).to eq(expectations[i])
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end # context
|
54
|
+
|
55
|
+
end # describe
|
56
|
+
|
57
|
+
end # module
|
58
|
+
|
59
59
|
# End of file
|
@@ -2,7 +2,7 @@
|
|
2
2
|
// 'C:/Ruby193/lib/ruby/site_ruby/Cukedep/spec/cukedep/sample_features'
|
3
3
|
// This file uses the DOT syntax, a free utility from the Graphviz toolset.
|
4
4
|
// Graphviz is available at: www.graphviz.org
|
5
|
-
// File generated on
|
5
|
+
// File generated on Sat Jul 5 21:18:56 2014.
|
6
6
|
|
7
7
|
digraph g {
|
8
8
|
size = "7, 11"; // Dimensions in inches...
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cukedep
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.07
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dimitri Geshef
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-07-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cucumber
|
@@ -58,14 +58,14 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - ! '>='
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
61
|
+
version: 3.0.0
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - ! '>='
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
68
|
+
version: 3.0.0
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: simplecov
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -142,6 +142,7 @@ files:
|
|
142
142
|
- spec/cukedep/cli/cmd-line_spec.rb
|
143
143
|
- spec/cukedep/cuke-runner_spec.rb
|
144
144
|
- spec/cukedep/customization_spec.rb
|
145
|
+
- spec/cukedep/debug-file-action.rb
|
145
146
|
- spec/cukedep/feature-model_spec.rb
|
146
147
|
- spec/cukedep/feature-rep_spec.rb
|
147
148
|
- spec/cukedep/file-action_spec.rb
|