falkorlib 0.6.18 → 0.6.19
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 +4 -4
- data/Gemfile.lock +17 -2
- data/falkorlib.gemspec +1 -1
- data/lib/falkorlib/tasks/rspec.rake +5 -4
- data/lib/falkorlib/version.rb +1 -1
- data/spec/falkorlib/bootstrap_helpers_spec.rb +10 -10
- data/spec/falkorlib/bootstrap_spec.rb +21 -21
- data/spec/falkorlib/common_spec.rb +45 -45
- data/spec/falkorlib/config_spec.rb +5 -5
- data/spec/falkorlib/error_spec.rb +1 -1
- data/spec/falkorlib/git_spec.rb +43 -43
- data/spec/falkorlib/gitflow_spec.rb +13 -13
- data/spec/falkorlib/puppet_modules_spec.rb +166 -166
- data/spec/falkorlib/versioning_gem_spec.rb +22 -22
- data/spec/falkorlib/versioning_puppet_module_spec.rb +11 -11
- data/spec/falkorlib/versioning_spec.rb +86 -86
- data/spec/falkorlib_spec.rb +1 -1
- metadata +15 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2991193ba63366cf054fbf23cafb5b36dfaa2bc9
|
4
|
+
data.tar.gz: 59f153625348b86b00d58631c88c8fd4635f8b67
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d8907de32c3abb0988912fc1165501d946f1fc9bdfb7f50aeeb6a838edea4346915a9407bc6c6dc0dc757a805a3ce47e3efc39e0e83906bc790c783e6485ffe6
|
7
|
+
data.tar.gz: c9dda2e193d2c72a498c60b631aeba60044d842f3131108c9f788b1bf8d8c80dca172ee1cef07610ee180a7b6eb3fa876b375a0b0cc9a1f97fdc40e9ed15eb34
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
falkorlib (0.6.
|
4
|
+
falkorlib (0.6.19)
|
5
5
|
artii (>= 2.1)
|
6
6
|
awesome_print (~> 1.2)
|
7
7
|
configatron (~> 3.2)
|
@@ -30,6 +30,7 @@ GEM
|
|
30
30
|
coderay (1.1.0)
|
31
31
|
configatron (3.2.0)
|
32
32
|
deep_merge (1.0.1)
|
33
|
+
diff-lcs (1.2.5)
|
33
34
|
diffy (3.1.0)
|
34
35
|
docile (1.1.5)
|
35
36
|
ethon (0.7.0)
|
@@ -71,6 +72,19 @@ GEM
|
|
71
72
|
json
|
72
73
|
websocket (~> 1.0)
|
73
74
|
rake (10.5.0)
|
75
|
+
rspec (3.5.0)
|
76
|
+
rspec-core (~> 3.5.0)
|
77
|
+
rspec-expectations (~> 3.5.0)
|
78
|
+
rspec-mocks (~> 3.5.0)
|
79
|
+
rspec-core (3.5.4)
|
80
|
+
rspec-support (~> 3.5.0)
|
81
|
+
rspec-expectations (3.5.0)
|
82
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
83
|
+
rspec-support (~> 3.5.0)
|
84
|
+
rspec-mocks (3.5.0)
|
85
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
86
|
+
rspec-support (~> 3.5.0)
|
87
|
+
rspec-support (3.5.0)
|
74
88
|
rubygems-tasks (0.2.4)
|
75
89
|
safe_yaml (0.9.7)
|
76
90
|
simplecov (0.8.2)
|
@@ -112,6 +126,7 @@ DEPENDENCIES
|
|
112
126
|
falkorlib!
|
113
127
|
pry
|
114
128
|
rake
|
129
|
+
rspec (~> 3.0)
|
115
130
|
rubygems-tasks (~> 0.2)
|
116
131
|
thor-zsh_completion
|
117
132
|
travis (~> 1.6)
|
@@ -119,4 +134,4 @@ DEPENDENCIES
|
|
119
134
|
yard (~> 0.8)
|
120
135
|
|
121
136
|
BUNDLED WITH
|
122
|
-
1.
|
137
|
+
1.13.5
|
data/falkorlib.gemspec
CHANGED
@@ -95,7 +95,7 @@ Gem::Specification.new do |s|
|
|
95
95
|
#
|
96
96
|
#s.add_development_dependency("rake", ">= 10.1.0") #"~> 0.9.2")
|
97
97
|
s.add_development_dependency("bundler", "~> 1.0")
|
98
|
-
|
98
|
+
s.add_development_dependency 'rspec', '~> 3.0' #, '>= 2.7.0'
|
99
99
|
s.add_development_dependency("pry", "~> 0.9")
|
100
100
|
s.add_development_dependency("yard", "~> 0.8")
|
101
101
|
#s.add_development_dependency("minitest", "~> 5.3")
|
@@ -25,6 +25,7 @@
|
|
25
25
|
# rspec and options of the rake task defined below can be found on
|
26
26
|
# http://relishapp.com/rspec
|
27
27
|
#
|
28
|
+
require 'rspec/core'
|
28
29
|
begin
|
29
30
|
require "rspec/core/rake_task"
|
30
31
|
desc "Run RSpec code examples '*_spec.rb' from the spec/ directory"
|
@@ -50,19 +51,19 @@ begin
|
|
50
51
|
t.verbose = true
|
51
52
|
|
52
53
|
# Use rcov for code coverage?
|
53
|
-
t.rcov = false
|
54
|
+
#t.rcov = false
|
54
55
|
|
55
56
|
# Path to rcov.
|
56
|
-
t.rcov_path = "rcov"
|
57
|
+
#t.rcov_path = "rcov"
|
57
58
|
|
58
59
|
# Command line options to pass to rcov. See 'rcov --help' about this
|
59
|
-
t.rcov_opts = []
|
60
|
+
#t.rcov_opts = []
|
60
61
|
|
61
62
|
# Command line options to pass to ruby. See 'ruby --help' about this
|
62
63
|
t.ruby_opts = []
|
63
64
|
|
64
65
|
# Path to rspec
|
65
|
-
t.rspec_path = "rspec"
|
66
|
+
#t.rspec_path = "rspec"
|
66
67
|
|
67
68
|
# Command line options to pass to rspec. See 'rspec --help' about this
|
68
69
|
#t.rspec_opts = ["--color", "--backtrace"]
|
data/lib/falkorlib/version.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
#########################################
|
3
3
|
# bootstrap_spec.rb
|
4
4
|
# @author Sebastien Varrette <Sebastien.Varrette@uni.lu>
|
5
|
-
# Time-stamp: <
|
5
|
+
# Time-stamp: <Sun 2016-10-16 22:02 svarrette>
|
6
6
|
#
|
7
7
|
# @description Check the Bootstrapping operations
|
8
8
|
#
|
@@ -32,22 +32,22 @@ describe FalkorLib::Bootstrap do
|
|
32
32
|
|
33
33
|
context 'helper functions' do
|
34
34
|
it "#select_forge - none" do
|
35
|
-
STDIN.
|
35
|
+
expect(STDIN).to receive(:gets).and_return('1')
|
36
36
|
t = FalkorLib::Bootstrap.select_forge()
|
37
|
-
t.
|
37
|
+
expect(t).to eq(:none)
|
38
38
|
end
|
39
39
|
|
40
40
|
it "#select_forge -- default to github" do
|
41
|
-
STDIN.
|
41
|
+
expect(STDIN).to receive(:gets).and_return('')
|
42
42
|
t = FalkorLib::Bootstrap.select_forge(:github)
|
43
|
-
t.
|
43
|
+
expect(t).to eq(:github)
|
44
44
|
end
|
45
45
|
|
46
46
|
FalkorLib::Config::Bootstrap::DEFAULTS[:licenses].keys.each do |lic|
|
47
47
|
it "#select_licence -- default to #{lic}" do
|
48
|
-
STDIN.
|
48
|
+
expect(STDIN).to receive(:gets).and_return('')
|
49
49
|
t = FalkorLib::Bootstrap.select_licence(lic)
|
50
|
-
t.
|
50
|
+
expect(t).to eq(lic)
|
51
51
|
end
|
52
52
|
end
|
53
53
|
|
@@ -56,8 +56,8 @@ describe FalkorLib::Bootstrap do
|
|
56
56
|
subject = 'licence'
|
57
57
|
status = 'GPL-2.0'
|
58
58
|
t = FalkorLib::Bootstrap.get_badge(subject, status)
|
59
|
-
t.
|
60
|
-
t.
|
59
|
+
expect(t).to match(/#{subject}/)
|
60
|
+
expect(t).to match(/#{status.sub(/-/, '--')}/)
|
61
61
|
end
|
62
62
|
end # context
|
63
63
|
|
@@ -77,7 +77,7 @@ describe FalkorLib::Bootstrap do
|
|
77
77
|
motdfile = File.join(dir, 'motd1')
|
78
78
|
FalkorLib::Bootstrap.motd(dir, { :file => "#{motdfile}", :no_interaction => true })
|
79
79
|
t = File.exists?(motdfile)
|
80
|
-
t.
|
80
|
+
expect(t).to be true
|
81
81
|
end
|
82
82
|
end
|
83
83
|
|
@@ -2,7 +2,7 @@
|
|
2
2
|
#########################################
|
3
3
|
# bootstrap_spec.rb
|
4
4
|
# @author Sebastien Varrette <Sebastien.Varrette@uni.lu>
|
5
|
-
# Time-stamp: <
|
5
|
+
# Time-stamp: <Sun 2016-10-16 22:05 svarrette>
|
6
6
|
#
|
7
7
|
# @description Check the Bootstrapping operations
|
8
8
|
#
|
@@ -45,9 +45,9 @@ describe FalkorLib::Bootstrap do
|
|
45
45
|
if ctx == :with_git
|
46
46
|
it "initialize Git in the temporary directory #{dir}" do
|
47
47
|
c = FalkorLib::Git.init(dir)
|
48
|
-
c.
|
48
|
+
expect(c).to eq(0)
|
49
49
|
t = FalkorLib::Git.init?(dir)
|
50
|
-
t.
|
50
|
+
expect(t).to be true
|
51
51
|
end
|
52
52
|
end
|
53
53
|
|
@@ -55,44 +55,44 @@ describe FalkorLib::Bootstrap do
|
|
55
55
|
it "#trash" do
|
56
56
|
c = FalkorLib::Bootstrap.trash(dir)
|
57
57
|
t = File.exists?( File.join(dir, FalkorLib.config[:templates][:trashdir], '.gitignore'))
|
58
|
-
t.
|
59
|
-
c.
|
58
|
+
expect(t).to be true
|
59
|
+
expect(c).to eq(0)
|
60
60
|
end
|
61
61
|
|
62
62
|
it "#trash - repeat on an existing trash dir" do
|
63
63
|
c = FalkorLib::Bootstrap.trash(dir)
|
64
|
-
c.
|
64
|
+
expect(c).to eq(1)
|
65
65
|
end
|
66
66
|
|
67
67
|
it "#trash - change target trash dir" do
|
68
68
|
newtrashname = 'tmp/mytrash'
|
69
69
|
c = FalkorLib::Bootstrap.trash(dir,newtrashname)
|
70
70
|
t = File.exists?( File.join(dir, newtrashname, '.gitignore'))
|
71
|
-
t.
|
72
|
-
c.
|
71
|
+
expect(t).to be true
|
72
|
+
expect(c).to eq(0)
|
73
73
|
end
|
74
74
|
|
75
75
|
######### RVM #########
|
76
76
|
it "#rvm" do
|
77
77
|
gemset = File.basename(dir)
|
78
|
-
STDIN.
|
79
|
-
STDIN.
|
78
|
+
expect(STDIN).to receive(:gets).and_return('1') if ctx == :without_git
|
79
|
+
expect(STDIN).to receive(:gets).and_return('') if ctx == :without_git
|
80
80
|
c = FalkorLib::Bootstrap.rvm(dir)
|
81
|
-
c.
|
81
|
+
expect(c).to eq(0)
|
82
82
|
content = {}
|
83
83
|
[:versionfile, :gemsetfile].each do |type|
|
84
84
|
f = File.join(dir, FalkorLib.config[:rvm][type.to_sym])
|
85
85
|
t = File.exists?(f)
|
86
|
-
t.
|
86
|
+
expect(t).to be true
|
87
87
|
content[type.to_sym] = `cat #{f}`.chomp
|
88
88
|
end
|
89
|
-
content[:versionfile].
|
90
|
-
content[:gemsetfile].
|
89
|
+
expect(content[:versionfile]).to eq(FalkorLib.config[:rvm][:rubies][0])
|
90
|
+
expect(content[:gemsetfile]).to eq(gemset)
|
91
91
|
end
|
92
92
|
|
93
93
|
it "#rvm -- repeat" do
|
94
94
|
c = FalkorLib::Bootstrap.rvm(dir)
|
95
|
-
c.
|
95
|
+
expect(c).to eq(1)
|
96
96
|
end
|
97
97
|
|
98
98
|
it "#rvm -- change targets (ctx = #{ctx}; dir = #{dir})" do
|
@@ -103,15 +103,15 @@ describe FalkorLib::Bootstrap do
|
|
103
103
|
:gemsetfile => '.mygemset'
|
104
104
|
}
|
105
105
|
c = FalkorLib::Bootstrap.rvm(dir, opts)
|
106
|
-
c.
|
106
|
+
expect(c).to eq(0)
|
107
107
|
content = {}
|
108
108
|
[:versionfile, :gemsetfile].each do |type|
|
109
109
|
f = File.join("#{dir}", opts[type.to_sym])
|
110
110
|
t = File.exists?(f)
|
111
111
|
content[type.to_sym] = `cat #{f}`.chomp
|
112
112
|
end
|
113
|
-
content[:versionfile].
|
114
|
-
content[:gemsetfile].
|
113
|
+
expect(content[:versionfile]).to eq(opts[:ruby])
|
114
|
+
expect(content[:gemsetfile]).to eq(opts[:gemset])
|
115
115
|
end
|
116
116
|
|
117
117
|
|
@@ -123,7 +123,7 @@ describe FalkorLib::Bootstrap do
|
|
123
123
|
FalkorLib.config[:no_interaction] = true
|
124
124
|
FalkorLib::Bootstrap.readme(dir, { :no_interaction => true })
|
125
125
|
t = File.exists?(File.join(dir, 'README.md'))
|
126
|
-
t.
|
126
|
+
expect(t).to be true
|
127
127
|
FalkorLib.config[:no_interaction] = false
|
128
128
|
end
|
129
129
|
|
@@ -139,9 +139,9 @@ describe FalkorLib::Bootstrap do
|
|
139
139
|
:no_interaction => true
|
140
140
|
})
|
141
141
|
t = File.exists?(File.join(dir, file))
|
142
|
-
t.
|
142
|
+
expect(t).to be true
|
143
143
|
v = FalkorLib::Versioning.get_version(dir, { :source => { :filename => file }})
|
144
|
-
v.
|
144
|
+
expect(v).to eq("#{version}")
|
145
145
|
end
|
146
146
|
|
147
147
|
end # context
|
@@ -39,7 +39,7 @@ describe FalkorLib::Common do
|
|
39
39
|
# Check the color functions
|
40
40
|
@print_test_conf.values.collect{ |e| e[:color] }.each do |color|
|
41
41
|
it "##{color} - check #{color} text" do
|
42
|
-
STDOUT.
|
42
|
+
expect(STDOUT).to receive(:puts).with(send("#{color}", "#{color} text"))
|
43
43
|
puts send("#{color}", "#{color} text")
|
44
44
|
end
|
45
45
|
end
|
@@ -47,11 +47,11 @@ describe FalkorLib::Common do
|
|
47
47
|
# Check the prining messages
|
48
48
|
@print_test_conf.each do |method,conf|
|
49
49
|
it "##{method} - put a #{method} message" do
|
50
|
-
((method == :error) ? STDERR : STDOUT).
|
50
|
+
expect((method == :error) ? STDERR : STDOUT).to receive(:puts).with(send("#{conf[:color]}", "#{conf[:prefix]} #{method} text"))
|
51
51
|
if (method == :error)
|
52
|
-
|
52
|
+
expect {
|
53
53
|
send("#{method}", "#{method} text")
|
54
|
-
}.
|
54
|
+
}.to raise_error #(SystemExit)
|
55
55
|
else
|
56
56
|
send("#{method}", "#{method} text")
|
57
57
|
end
|
@@ -62,18 +62,18 @@ describe FalkorLib::Common do
|
|
62
62
|
['', 'default'].each do |default_answer|
|
63
63
|
@query = "Am I a query"
|
64
64
|
it "#ask - ask '#{@query}' with default answer '#{default_answer}' and no answer" do
|
65
|
-
STDIN.
|
65
|
+
expect(STDIN).to receive(:gets).and_return('')
|
66
66
|
results = capture(:stdout) {
|
67
67
|
answer = ask(@query, default_answer)
|
68
68
|
if default_answer.empty?
|
69
|
-
answer.
|
69
|
+
expect(answer).to be_empty
|
70
70
|
else
|
71
|
-
answer.
|
71
|
+
expect(answer).to eq(default_answer)
|
72
72
|
end
|
73
73
|
}
|
74
|
-
results.
|
74
|
+
expect(results).to match(/#{@query}/);
|
75
75
|
unless default_answer.empty?
|
76
|
-
results.
|
76
|
+
expect(results).to match(/Default: #{default_answer}/);
|
77
77
|
end
|
78
78
|
end
|
79
79
|
end
|
@@ -81,48 +81,48 @@ describe FalkorLib::Common do
|
|
81
81
|
# Check the really_continue? function
|
82
82
|
[ '', 'Yes', 'y', 'Y', 'yes' ].each do |answer|
|
83
83
|
it "#really_continue? - should really continue after answer '#{answer}'" do
|
84
|
-
STDIN.
|
84
|
+
expect(STDIN).to receive(:gets).and_return(answer)
|
85
85
|
results = capture(:stdout) { really_continue? }
|
86
|
-
results.
|
87
|
-
results.
|
86
|
+
expect(results).to match(/=> Do you really want to continue/);
|
87
|
+
expect(results).to match(/Default: Yes/);
|
88
88
|
end
|
89
89
|
next if answer.empty?
|
90
90
|
it "#really_continue? - should really continue (despite default answer 'No') after answer '#{answer}'" do
|
91
|
-
STDIN.
|
91
|
+
expect(STDIN).to receive(:gets).and_return(answer)
|
92
92
|
results = capture(:stdout) { really_continue?('No') }
|
93
|
-
results.
|
94
|
-
results.
|
93
|
+
expect(results).to match(/=> Do you really want to continue/);
|
94
|
+
expect(results).to match(/Default: No/);
|
95
95
|
end
|
96
96
|
end
|
97
97
|
|
98
98
|
[ '', 'No', 'n', 'N', 'no' ].each do |answer|
|
99
99
|
it "#really_continue? - should not continue (despite default answer 'No') and exit after answer '#{answer}'" do
|
100
|
-
STDIN.
|
100
|
+
expect(STDIN).to receive(:gets).and_return(answer)
|
101
101
|
results = capture(:stdout) {
|
102
|
-
|
102
|
+
expect{
|
103
103
|
really_continue?('No')
|
104
|
-
}.
|
104
|
+
}.to raise_error (SystemExit)
|
105
105
|
}
|
106
|
-
results.
|
107
|
-
results.
|
106
|
+
expect(results).to match(/=> Do you really want to continue/);
|
107
|
+
expect(results).to match(/Default: No/);
|
108
108
|
end
|
109
109
|
next if answer.empty?
|
110
110
|
it "#really_continue? - should not continue and exit after answer '#{answer}'" do
|
111
|
-
STDIN.
|
111
|
+
expect(STDIN).to receive(:gets).and_return(answer)
|
112
112
|
results = capture(:stdout) {
|
113
|
-
|
113
|
+
expect{
|
114
114
|
really_continue?
|
115
|
-
}.
|
115
|
+
}.to raise_error (SystemExit)
|
116
116
|
}
|
117
|
-
results.
|
118
|
-
results.
|
117
|
+
expect(results).to match(/=> Do you really want to continue/);
|
118
|
+
expect(results).to match(/Default: Yes/);
|
119
119
|
end
|
120
120
|
end
|
121
121
|
|
122
122
|
# Check the command? function
|
123
123
|
[ 'sqgfyueztruyjf', 'ruby' ].each do |command|
|
124
124
|
it "#command? - check the command '#{command}'" do
|
125
|
-
command?(command).
|
125
|
+
expect(command?(command)).to be ((command == 'ruby') ? true : false)
|
126
126
|
end
|
127
127
|
end
|
128
128
|
end
|
@@ -131,38 +131,38 @@ describe FalkorLib::Common do
|
|
131
131
|
b = capture(:stdout) {
|
132
132
|
nice_execute("echo toto")
|
133
133
|
}
|
134
|
-
b.split("\n").
|
134
|
+
expect(b.split("\n")).to include '** [out] toto'
|
135
135
|
end
|
136
136
|
|
137
137
|
it "#nice_execute -- check stderr output" do
|
138
138
|
b = capture(:stderr) {
|
139
139
|
nice_execute("echo 'toto' 1>&2")
|
140
140
|
}
|
141
|
-
b.
|
141
|
+
expect(b).to eq(red("** [err] toto\n"))
|
142
142
|
end
|
143
143
|
|
144
144
|
it "#execute" do
|
145
145
|
b = execute("echo toto")
|
146
|
-
b.to_i.
|
146
|
+
expect(b.to_i).to eq(0)
|
147
147
|
end
|
148
148
|
|
149
149
|
it "#not_implemented" do
|
150
150
|
b = capture(:stderr) {
|
151
151
|
expect { not_implemented }.to raise_error (SystemExit)
|
152
152
|
}
|
153
|
-
b.
|
153
|
+
expect(b).to match(/NOT YET IMPLEMENTED/)
|
154
154
|
end
|
155
155
|
|
156
156
|
it "#exec_or_exit - should exit" do
|
157
157
|
expect { exec_or_exit "false" }.to raise_error (SystemExit)
|
158
158
|
end
|
159
159
|
it "#exec_or_exit - should NOT exit" do
|
160
|
-
expect { exec_or_exit "true" }.not_to raise_error (SystemExit)
|
160
|
+
expect { exec_or_exit "true" }.not_to raise_error # (SystemExit)
|
161
161
|
end
|
162
162
|
|
163
163
|
it "#execute_in_dir -- should execute the command in /tmp" do
|
164
164
|
b = execute_in_dir('/tmp', "pwd | grep -Fq '/tmp'")
|
165
|
-
b.
|
165
|
+
expect(b).to eq(0)
|
166
166
|
end
|
167
167
|
|
168
168
|
|
@@ -171,7 +171,7 @@ describe FalkorLib::Common do
|
|
171
171
|
echo toto
|
172
172
|
echo tata
|
173
173
|
}
|
174
|
-
b.to_i.
|
174
|
+
expect(b.to_i).to eq(0)
|
175
175
|
end
|
176
176
|
|
177
177
|
|
@@ -180,9 +180,9 @@ describe FalkorLib::Common do
|
|
180
180
|
|
181
181
|
it "#load_config - load the correct hash from YAML" do
|
182
182
|
file_config = {:domain => "foo.com", :nested => { 'a1' => 2 }}
|
183
|
-
YAML.
|
183
|
+
allow(YAML).to receive(:load_file).and_return(file_config)
|
184
184
|
loaded = load_config('/tmp') # /tmp to ensure existing target
|
185
|
-
loaded.
|
185
|
+
expect(loaded).to eq(file_config)
|
186
186
|
end
|
187
187
|
|
188
188
|
it "#store_config - should store the correct hash to YAML" do
|
@@ -190,7 +190,7 @@ describe FalkorLib::Common do
|
|
190
190
|
f = Tempfile.new('toto')
|
191
191
|
store_config(f.path, file_config, { :no_interaction => true })
|
192
192
|
copy_file_config = YAML::load_file(f.path)
|
193
|
-
copy_file_config.
|
193
|
+
expect(copy_file_config).to eq(file_config)
|
194
194
|
end
|
195
195
|
|
196
196
|
end
|
@@ -199,32 +199,32 @@ describe FalkorLib::Common do
|
|
199
199
|
context 'Test list selection functions' do
|
200
200
|
|
201
201
|
it "#list_items - Exit on 0" do
|
202
|
-
STDIN.
|
202
|
+
expect(STDIN).to receive(:gets).and_return('0')
|
203
203
|
expect { list_items("#{dir}/*") }.to raise_error (SystemExit)
|
204
204
|
end
|
205
205
|
|
206
206
|
it "#list_items -- select files only" do
|
207
|
-
STDIN.
|
207
|
+
expect(STDIN).to receive(:gets).and_return('1')
|
208
208
|
f = list_items("#{dir}/*", { :only_files => true })
|
209
|
-
f.
|
209
|
+
expect(f).to match(/\/file.?\.txt$/)
|
210
210
|
end
|
211
211
|
|
212
212
|
it "#list_items -- select files only with pattern exclude" do
|
213
|
-
STDIN.
|
213
|
+
expect(STDIN).to receive(:gets).and_return('1')
|
214
214
|
f = list_items("#{dir}/*", { :only_files => true, :pattern_exclude => [ 'file1' ] })
|
215
|
-
f.
|
215
|
+
expect(f).to eq("#{dir}/file2.txt")
|
216
216
|
end
|
217
217
|
|
218
218
|
it "#list_items -- select dirs only" do
|
219
|
-
STDIN.
|
219
|
+
expect(STDIN).to receive(:gets).and_return('1')
|
220
220
|
f = list_items("#{dir}/*", { :only_dirs => true })
|
221
|
-
f.
|
221
|
+
expect(f).to match(/\/dir.?$/)
|
222
222
|
end
|
223
223
|
|
224
224
|
it "#list_items -- select dirs only with pattern exclude" do
|
225
|
-
STDIN.
|
225
|
+
expect(STDIN).to receive(:gets).and_return('1')
|
226
226
|
f = list_items("#{dir}/*", { :only_dirs => true, :pattern_exclude => [ 'dir1' ] })
|
227
|
-
f.
|
227
|
+
expect(f).to eq("#{dir}/dir2")
|
228
228
|
end
|
229
229
|
|
230
230
|
it "#list_items -- exit on empty list" do
|