bovem 2.3.6 → 2.3.7

Sign up to get free protection for your applications and to get access to all the features.
data/.travis.yml CHANGED
@@ -7,4 +7,4 @@ rvm:
7
7
  script: bundle exec rake spec:coverage
8
8
  gemfile: .travis-gemfile
9
9
  notifications:
10
- email: false
10
+ email: false
data/Rakefile CHANGED
@@ -9,3 +9,21 @@ require "rspec/core/rake_task"
9
9
 
10
10
  RSpec::Core::RakeTask.new("spec")
11
11
  RSpec::Core::RakeTask.new("spec:coverage") { |t| t.ruby_opts = "-r./spec/coverage_helper" }
12
+
13
+ desc "Generate the documentation"
14
+ task :docs do
15
+ system("yardoc") || raise("Failed Execution of: yardoc")
16
+ end
17
+
18
+ desc "Get the current release version"
19
+ task :version, :with_name do |_, args|
20
+ gem = Bundler::GemHelper.instance.gemspec
21
+ puts [args[:with_name] == "true" ? gem.name : nil, gem.version].compact.join("-")
22
+ end
23
+
24
+ desc "Prepare the release"
25
+ task :prerelease => ["spec:coverage", "docs"] do
26
+ ["git add -A", "git commit -am \"Version #{Bundler::GemHelper.instance.gemspec.version}\""].each do |cmd|
27
+ system(cmd) || raise("Failed Execution of: #{cmd}")
28
+ end
29
+ end
data/bovem.gemspec CHANGED
@@ -23,6 +23,6 @@ Gem::Specification.new do |gem|
23
23
 
24
24
  gem.required_ruby_version = ">= 1.9.3"
25
25
 
26
- gem.add_dependency("lazier", "~> 3.2.5")
26
+ gem.add_dependency("lazier", "~> 3.2.6")
27
27
  gem.add_dependency("open4", "~> 1.3.0")
28
28
  end
data/doc/Bovem.html CHANGED
@@ -158,7 +158,7 @@ Licensed under the MIT license, which can be found at http://www.opensource.org/
158
158
  </div>
159
159
 
160
160
  <div id="footer">
161
- Generated on Sun Jul 14 16:08:05 2013 by
161
+ Generated on Sat Jul 20 11:12:22 2013 by
162
162
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
163
163
  0.8.6.2 (ruby-1.9.3).
164
164
  </div>
@@ -444,7 +444,7 @@ config.property = "VALUE"
444
444
  </div>
445
445
 
446
446
  <div id="footer">
447
- Generated on Sun Jul 14 16:08:07 2013 by
447
+ Generated on Sat Jul 20 11:12:24 2013 by
448
448
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
449
449
  0.8.6.2 (ruby-1.9.3).
450
450
  </div>
@@ -760,7 +760,7 @@
760
760
  </div>
761
761
 
762
762
  <div id="footer">
763
- Generated on Sun Jul 14 16:08:06 2013 by
763
+ Generated on Sat Jul 20 11:12:23 2013 by
764
764
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
765
765
  0.8.6.2 (ruby-1.9.3).
766
766
  </div>
@@ -116,7 +116,7 @@
116
116
  </div>
117
117
 
118
118
  <div id="footer">
119
- Generated on Sun Jul 14 16:08:05 2013 by
119
+ Generated on Sat Jul 20 11:12:22 2013 by
120
120
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
121
121
  0.8.6.2 (ruby-1.9.3).
122
122
  </div>
@@ -558,7 +558,7 @@
558
558
  </div>
559
559
 
560
560
  <div id="footer">
561
- Generated on Sun Jul 14 16:08:06 2013 by
561
+ Generated on Sat Jul 20 11:12:23 2013 by
562
562
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
563
563
  0.8.6.2 (ruby-1.9.3).
564
564
  </div>
@@ -222,7 +222,7 @@
222
222
  </div>
223
223
 
224
224
  <div id="footer">
225
- Generated on Sun Jul 14 16:08:06 2013 by
225
+ Generated on Sat Jul 20 11:12:23 2013 by
226
226
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
227
227
  0.8.6.2 (ruby-1.9.3).
228
228
  </div>
@@ -2209,7 +2209,7 @@
2209
2209
  </div>
2210
2210
 
2211
2211
  <div id="footer">
2212
- Generated on Sun Jul 14 16:08:06 2013 by
2212
+ Generated on Sat Jul 20 11:12:23 2013 by
2213
2213
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
2214
2214
  0.8.6.2 (ruby-1.9.3).
2215
2215
  </div>
@@ -203,7 +203,7 @@
203
203
  </div>
204
204
 
205
205
  <div id="footer">
206
- Generated on Sun Jul 14 16:08:06 2013 by
206
+ Generated on Sat Jul 20 11:12:23 2013 by
207
207
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
208
208
  0.8.6.2 (ruby-1.9.3).
209
209
  </div>
@@ -1112,7 +1112,7 @@
1112
1112
  </div>
1113
1113
 
1114
1114
  <div id="footer">
1115
- Generated on Sun Jul 14 16:08:05 2013 by
1115
+ Generated on Sat Jul 20 11:12:22 2013 by
1116
1116
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
1117
1117
  0.8.6.2 (ruby-1.9.3).
1118
1118
  </div>
@@ -265,7 +265,7 @@
265
265
  </div>
266
266
 
267
267
  <div id="footer">
268
- Generated on Sun Jul 14 16:08:05 2013 by
268
+ Generated on Sat Jul 20 11:12:22 2013 by
269
269
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
270
270
  0.8.6.2 (ruby-1.9.3).
271
271
  </div>
@@ -641,7 +641,7 @@ Bovem::Console.new.replace_markers("{mark=bright bg_red}{mark=green}Hello world!
641
641
  </div>
642
642
 
643
643
  <div id="footer">
644
- Generated on Sun Jul 14 16:08:05 2013 by
644
+ Generated on Sat Jul 20 11:12:22 2013 by
645
645
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
646
646
  0.8.6.2 (ruby-1.9.3).
647
647
  </div>
@@ -116,7 +116,7 @@
116
116
  </div>
117
117
 
118
118
  <div id="footer">
119
- Generated on Sun Jul 14 16:08:05 2013 by
119
+ Generated on Sat Jul 20 11:12:22 2013 by
120
120
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
121
121
  0.8.6.2 (ruby-1.9.3).
122
122
  </div>
@@ -124,7 +124,7 @@
124
124
  </div>
125
125
 
126
126
  <div id="footer">
127
- Generated on Sun Jul 14 16:08:06 2013 by
127
+ Generated on Sat Jul 20 11:12:23 2013 by
128
128
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
129
129
  0.8.6.2 (ruby-1.9.3).
130
130
  </div>
@@ -124,7 +124,7 @@
124
124
  </div>
125
125
 
126
126
  <div id="footer">
127
- Generated on Sun Jul 14 16:08:06 2013 by
127
+ Generated on Sat Jul 20 11:12:23 2013 by
128
128
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
129
129
  0.8.6.2 (ruby-1.9.3).
130
130
  </div>
@@ -1136,7 +1136,7 @@
1136
1136
  </div>
1137
1137
 
1138
1138
  <div id="footer">
1139
- Generated on Sun Jul 14 16:08:06 2013 by
1139
+ Generated on Sat Jul 20 11:12:23 2013 by
1140
1140
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
1141
1141
  0.8.6.2 (ruby-1.9.3).
1142
1142
  </div>
data/doc/Bovem/Shell.html CHANGED
@@ -493,7 +493,7 @@
493
493
  </div>
494
494
 
495
495
  <div id="footer">
496
- Generated on Sun Jul 14 16:08:06 2013 by
496
+ Generated on Sat Jul 20 11:12:23 2013 by
497
497
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
498
498
  0.8.6.2 (ruby-1.9.3).
499
499
  </div>
@@ -116,7 +116,7 @@
116
116
  </div>
117
117
 
118
118
  <div id="footer">
119
- Generated on Sun Jul 14 16:08:05 2013 by
119
+ Generated on Sat Jul 20 11:12:22 2013 by
120
120
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
121
121
  0.8.6.2 (ruby-1.9.3).
122
122
  </div>
@@ -473,7 +473,7 @@
473
473
  </div>
474
474
 
475
475
  <div id="footer">
476
- Generated on Sun Jul 14 16:08:05 2013 by
476
+ Generated on Sat Jul 20 11:12:22 2013 by
477
477
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
478
478
  0.8.6.2 (ruby-1.9.3).
479
479
  </div>
@@ -556,7 +556,7 @@
556
556
  </div>
557
557
 
558
558
  <div id="footer">
559
- Generated on Sun Jul 14 16:08:05 2013 by
559
+ Generated on Sat Jul 20 11:12:22 2013 by
560
560
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
561
561
  0.8.6.2 (ruby-1.9.3).
562
562
  </div>
@@ -551,7 +551,7 @@
551
551
  </div>
552
552
 
553
553
  <div id="footer">
554
- Generated on Sun Jul 14 16:08:05 2013 by
554
+ Generated on Sat Jul 20 11:12:22 2013 by
555
555
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
556
556
  0.8.6.2 (ruby-1.9.3).
557
557
  </div>
@@ -442,7 +442,7 @@
442
442
  </div>
443
443
 
444
444
  <div id="footer">
445
- Generated on Sun Jul 14 16:08:05 2013 by
445
+ Generated on Sat Jul 20 11:12:22 2013 by
446
446
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
447
447
  0.8.6.2 (ruby-1.9.3).
448
448
  </div>
@@ -665,7 +665,7 @@
665
665
  </div>
666
666
 
667
667
  <div id="footer">
668
- Generated on Sun Jul 14 16:08:05 2013 by
668
+ Generated on Sat Jul 20 11:12:22 2013 by
669
669
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
670
670
  0.8.6.2 (ruby-1.9.3).
671
671
  </div>
@@ -149,7 +149,7 @@
149
149
 
150
150
  </div>
151
151
  </dt>
152
- <dd><pre class="code"><span class='int'>6</span></pre></dd>
152
+ <dd><pre class="code"><span class='int'>7</span></pre></dd>
153
153
 
154
154
  <dt id="STRING-constant" class="">STRING =
155
155
  <div class="docstring">
@@ -180,7 +180,7 @@
180
180
  </div>
181
181
 
182
182
  <div id="footer">
183
- Generated on Sun Jul 14 16:08:06 2013 by
183
+ Generated on Sat Jul 20 11:12:23 2013 by
184
184
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
185
185
  0.8.6.2 (ruby-1.9.3).
186
186
  </div>
data/doc/_index.html CHANGED
@@ -346,7 +346,7 @@
346
346
  </div>
347
347
 
348
348
  <div id="footer">
349
- Generated on Sun Jul 14 16:08:05 2013 by
349
+ Generated on Sat Jul 20 11:12:22 2013 by
350
350
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
351
351
  0.8.6.2 (ruby-1.9.3).
352
352
  </div>
data/doc/file.README.html CHANGED
@@ -101,7 +101,7 @@
101
101
  </div></div>
102
102
 
103
103
  <div id="footer">
104
- Generated on Sun Jul 14 16:08:05 2013 by
104
+ Generated on Sat Jul 20 11:12:22 2013 by
105
105
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
106
106
  0.8.6.2 (ruby-1.9.3).
107
107
  </div>
data/doc/index.html CHANGED
@@ -101,7 +101,7 @@
101
101
  </div></div>
102
102
 
103
103
  <div id="footer">
104
- Generated on Sun Jul 14 16:08:05 2013 by
104
+ Generated on Sat Jul 20 11:12:22 2013 by
105
105
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
106
106
  0.8.6.2 (ruby-1.9.3).
107
107
  </div>
@@ -103,7 +103,7 @@
103
103
  </div>
104
104
 
105
105
  <div id="footer">
106
- Generated on Sun Jul 14 16:08:05 2013 by
106
+ Generated on Sat Jul 20 11:12:22 2013 by
107
107
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
108
108
  0.8.6.2 (ruby-1.9.3).
109
109
  </div>
data/lib/bovem/version.rb CHANGED
@@ -17,7 +17,7 @@ module Bovem
17
17
  MINOR = 3
18
18
 
19
19
  # The patch version.
20
- PATCH = 6
20
+ PATCH = 7
21
21
 
22
22
  # The current version number of Bovem.
23
23
  STRING = [MAJOR, MINOR, PATCH].compact.join(".")
@@ -15,7 +15,7 @@ describe Bovem::Console do
15
15
 
16
16
  before(:each) do
17
17
  ENV["TERM"] = "xterm-256color"
18
- Kernel.stub(:puts).and_return(nil)
18
+ allow(Kernel).to receive(:puts).and_return(nil)
19
19
  end
20
20
 
21
21
  describe ".instance" do
@@ -78,7 +78,7 @@ describe Bovem::Console do
78
78
  end
79
79
 
80
80
  it "should use $stdin.winsize if available" do
81
- $stdin.should_receive(:winsize)
81
+ expect($stdin).to receive(:winsize)
82
82
  console.line_width
83
83
  end
84
84
  end
@@ -172,7 +172,7 @@ describe Bovem::Console do
172
172
 
173
173
  describe "#replace_markers" do
174
174
  it "should just forwards to .replace_markers" do
175
- ::Bovem::Console.should_receive(:replace_markers).with("A", "B")
175
+ expect(::Bovem::Console).to receive(:replace_markers).with("A", "B")
176
176
  console.replace_markers("A", "B")
177
177
  end
178
178
  end
@@ -181,28 +181,28 @@ describe Bovem::Console do
181
181
  it "should correctly align messages" do
182
182
  message = "ABCDE"
183
183
  extended_message = "ABC\e[AD\e[3mE"
184
- console.stub(:line_width).and_return(80)
184
+ allow(console).to receive(:line_width).and_return(80)
185
185
 
186
186
  expect(console.format_right(message)).to eq("\e[A\e[0G\e[#{75}CABCDE")
187
187
  expect(console.format_right(message, 10)).to eq("\e[A\e[0G\e[#{-5}CABCDE")
188
188
  expect(console.format_right(extended_message)).to eq("\e[A\e[0G\e[#{75}CABC\e[AD\e[3mE")
189
189
  expect(console.format_right(message, nil, false)).to eq("\e[0G\e[#{75}CABCDE")
190
- console.stub(:line_width).and_return(10)
190
+ allow(console).to receive(:line_width).and_return(10)
191
191
  expect(console.format_right(message)).to eq("\e[A\e[0G\e[#{5}CABCDE")
192
192
  end
193
193
  end
194
194
 
195
195
  describe "#write" do
196
196
  it "should call #format" do
197
- console.should_receive(:format).with("A", "B", "C", "D", "E")
197
+ expect(console).to receive(:format).with("A", "B", "C", "D", "E")
198
198
  console.write("A", "B", "C", "D", "E")
199
199
  end
200
200
  end
201
201
 
202
202
  describe "#write_banner_aligned" do
203
203
  it "should call #min_banner_length and #format" do
204
- ::Bovem::Console.should_receive(:min_banner_length).and_return(1)
205
- console.should_receive(:format).with(" A", "B", "C", "D", "E")
204
+ expect(::Bovem::Console).to receive(:min_banner_length).and_return(1)
205
+ expect(console).to receive(:format).with(" A", "B", "C", "D", "E")
206
206
  console.write_banner_aligned("A", "B", "C", "D", "E")
207
207
  end
208
208
  end
@@ -220,69 +220,69 @@ describe Bovem::Console do
220
220
 
221
221
  describe "#info" do
222
222
  it "should forward everything to #get_banner" do
223
- console.should_receive(:get_banner).with("I", "bright cyan", false).at_least(1).and_return("")
223
+ expect(console).to receive(:get_banner).with("I", "bright cyan", false).at_least(1).and_return("")
224
224
  console.info("OK", "\n", true, false, false, false, false, false)
225
- console.should_receive(:get_banner).with("I", "bright cyan", true).at_least(1).and_return("")
225
+ expect(console).to receive(:get_banner).with("I", "bright cyan", true).at_least(1).and_return("")
226
226
  console.info("OK", "\n", true, false, false, false, true, false)
227
227
  end
228
228
 
229
229
  it "should forward everything to #write" do
230
- console.should_receive(:write).with(/.+/, "B", "C", "D", "E", false)
230
+ expect(console).to receive(:write).with(/.+/, "B", "C", "D", "E", false)
231
231
  console.info("A", "B", "C", "D", "E", "F", "G", false)
232
232
  end
233
233
  end
234
234
 
235
235
  describe "#begin" do
236
236
  it "should forward everything to #get_banner" do
237
- console.should_receive(:get_banner).with("*", "bright green", false).at_least(1).and_return("")
237
+ expect(console).to receive(:get_banner).with("*", "bright green", false).at_least(1).and_return("")
238
238
  console.begin("OK", "\n", true, false, false, false, false, false)
239
239
  end
240
240
 
241
241
  it "should forward everything to #write" do
242
- console.should_receive(:write).with(/.+/, "B", "C", "D", "E", false)
242
+ expect(console).to receive(:write).with(/.+/, "B", "C", "D", "E", false)
243
243
  console.begin("A", "B", "C", "D", "E", "F", "G", false)
244
244
  end
245
245
  end
246
246
 
247
247
  describe "#warn" do
248
248
  it "should forward everything to #get_banner" do
249
- console.should_receive(:get_banner).with("W", "bright yellow", false).at_least(1).and_return("")
249
+ expect(console).to receive(:get_banner).with("W", "bright yellow", false).at_least(1).and_return("")
250
250
  console.warn("OK", "\n", true, false, false, false, false, false)
251
- console.should_receive(:get_banner).with("W", "bright yellow", true).at_least(1).and_return("")
251
+ expect(console).to receive(:get_banner).with("W", "bright yellow", true).at_least(1).and_return("")
252
252
  console.warn("OK", "\n", true, false, false, false, true, false)
253
253
  end
254
254
 
255
255
  it "should forward everything to #write" do
256
- console.should_receive(:write).with(/.+/, "B", "C", "D", "E", false)
256
+ expect(console).to receive(:write).with(/.+/, "B", "C", "D", "E", false)
257
257
  console.warn("A", "B", "C", "D", "E", "F", "G", false)
258
258
  end
259
259
  end
260
260
 
261
261
  describe "#error" do
262
262
  it "should forward everything to #get_banner" do
263
- console.should_receive(:get_banner).with("E", "bright red", false).at_least(1).and_return("")
263
+ expect(console).to receive(:get_banner).with("E", "bright red", false).at_least(1).and_return("")
264
264
  console.error("OK", "\n", true, false, false, false, false, false)
265
- console.should_receive(:get_banner).with("E", "bright red", true).at_least(1).and_return("")
265
+ expect(console).to receive(:get_banner).with("E", "bright red", true).at_least(1).and_return("")
266
266
  console.error("OK", "\n", true, false, false, false, true, false)
267
267
  end
268
268
 
269
269
  it "should forward everything to #write" do
270
- console.should_receive(:write).with(/.+/, "B", "C", "D", "E", false)
270
+ expect(console).to receive(:write).with(/.+/, "B", "C", "D", "E", false)
271
271
  console.error("A", "B", "C", "D", "E", "F", "G", false)
272
272
  end
273
273
  end
274
274
 
275
275
  describe "#fatal" do
276
276
  it "should forward anything to #error" do
277
- Kernel.stub(:exit).and_return(true)
278
- console.should_receive(:error).with("A", "B", "C", "D", "E", "F", "G", false)
277
+ allow(Kernel).to receive(:exit).and_return(true)
278
+ expect(console).to receive(:error).with("A", "B", "C", "D", "E", "F", "G", false)
279
279
  console.fatal("A", "B", "C", "D", "E", "F", "G", "H", false)
280
280
  end
281
281
 
282
282
  it "should call abort with the right error code" do
283
- Kernel.stub(:exit).and_return(true)
283
+ allow(Kernel).to receive(:exit).and_return(true)
284
284
 
285
- Kernel.should_receive(:exit).with(-1).exactly(2)
285
+ expect(Kernel).to receive(:exit).with(-1).exactly(2)
286
286
  console.fatal("A", "B", "C", "D", "E", "F", "G", -1, false)
287
287
  console.fatal("A", "B", "C", "D", "E", "F", "G", "H", false)
288
288
  end
@@ -290,14 +290,14 @@ describe Bovem::Console do
290
290
 
291
291
  describe "#debug" do
292
292
  it "should forward everything to #get_banner" do
293
- console.should_receive(:get_banner).with("D", "bright magenta", false).at_least(1).and_return("")
293
+ expect(console).to receive(:get_banner).with("D", "bright magenta", false).at_least(1).and_return("")
294
294
  console.debug("OK", "\n", true, false, false, false, false, false)
295
- console.should_receive(:get_banner).with("D", "bright magenta", true).at_least(1).and_return("")
295
+ expect(console).to receive(:get_banner).with("D", "bright magenta", true).at_least(1).and_return("")
296
296
  console.debug("OK", "\n", true, false, false, false, true, false)
297
297
  end
298
298
 
299
299
  it "should forward everything to #write" do
300
- console.should_receive(:write).with(/.+/, "B", "C", "D", "E", false)
300
+ expect(console).to receive(:write).with(/.+/, "B", "C", "D", "E", false)
301
301
  console.debug("A", "B", "C", "D", "E", "F", "G", false)
302
302
  end
303
303
  end
@@ -313,47 +313,47 @@ describe Bovem::Console do
313
313
  end
314
314
 
315
315
  it "should create the banner" do
316
- console.should_receive(:get_banner).with(" OK ", "bright green").and_return("")
316
+ expect(console).to receive(:get_banner).with(" OK ", "bright green").and_return("")
317
317
  console.status(:ok)
318
318
  end
319
319
 
320
320
  it "should format correctly" do
321
- console.should_receive(:format_right).with(/.+/, true, true, false)
321
+ expect(console).to receive(:format_right).with(/.+/, true, true, false)
322
322
  console.status(:ok, false, true)
323
- console.should_receive(:format).with(/.+/, "\n", true, true, false)
323
+ expect(console).to receive(:format).with(/.+/, "\n", true, true, false)
324
324
  console.status(:ok, false, true, false)
325
325
  end
326
326
  end
327
327
 
328
328
  describe "#read" do
329
329
  it "should show a prompt" do
330
- $stdin.stub(:gets).and_return("VALUE\n")
330
+ allow($stdin).to receive(:gets).and_return("VALUE\n")
331
331
 
332
332
  prompt = "PROMPT"
333
- Kernel.should_receive(:print).with("Please insert a value: ")
333
+ expect(Kernel).to receive(:print).with("Please insert a value: ")
334
334
  console.read(true)
335
- Kernel.should_receive(:print).with(prompt + ": ")
335
+ expect(Kernel).to receive(:print).with(prompt + ": ")
336
336
  console.read(prompt)
337
- Kernel.should_not_receive("print")
337
+ expect(Kernel).not_to receive("print")
338
338
  console.read(nil)
339
339
  end
340
340
 
341
341
  it "should read a value or a default" do
342
- $stdin.stub(:gets).and_return("VALUE\n")
342
+ allow($stdin).to receive(:gets).and_return("VALUE\n")
343
343
  expect(console.read(nil, "DEFAULT")).to eq("VALUE")
344
- $stdin.stub(:gets).and_return("\n")
344
+ allow($stdin).to receive(:gets).and_return("\n")
345
345
  expect(console.read(nil, "DEFAULT")).to eq("DEFAULT")
346
346
  end
347
347
 
348
348
  it "should return the default value if the user quits" do
349
- $stdin.stub(:gets).and_raise(Interrupt)
349
+ allow($stdin).to receive(:gets).and_raise(Interrupt)
350
350
  expect(console.read(nil, "DEFAULT")).to eq("DEFAULT")
351
351
  end
352
352
 
353
353
  it "should validate against an object or array validator" do
354
354
  count = 0
355
355
 
356
- $stdin.stub(:gets) do
356
+ allow($stdin).to receive(:gets) do
357
357
  if count == 0 then
358
358
  count += 1
359
359
  "2\n"
@@ -362,7 +362,7 @@ describe Bovem::Console do
362
362
  end
363
363
  end
364
364
 
365
- console.should_receive(:write).with("Sorry, your reply was not understood. Please try again.", false, false).exactly(4)
365
+ expect(console).to receive(:write).with("Sorry, your reply was not understood. Please try again.", false, false).exactly(4)
366
366
  count = 0
367
367
  console.read(nil, nil, "A")
368
368
  count = 0
@@ -376,7 +376,7 @@ describe Bovem::Console do
376
376
  it "should validate against an regexp validator" do
377
377
  count = 0
378
378
 
379
- $stdin.stub(:gets) do
379
+ allow($stdin).to receive(:gets) do
380
380
  if count == 0 then
381
381
  count += 1
382
382
  "2\n"
@@ -385,38 +385,38 @@ describe Bovem::Console do
385
385
  end
386
386
  end
387
387
 
388
- console.should_receive(:write).with("Sorry, your reply was not understood. Please try again.", false, false)
388
+ expect(console).to receive(:write).with("Sorry, your reply was not understood. Please try again.", false, false)
389
389
  console.read(nil, nil, /[abc]/)
390
390
  end
391
391
 
392
392
  it "should hide echo to the user when the terminal shows echo" do
393
- $stdin.should_receive(:noecho).and_return("VALUE")
393
+ expect($stdin).to receive(:noecho).and_return("VALUE")
394
394
  console.read(nil, nil, nil, false)
395
395
  end
396
396
  end
397
397
 
398
398
  describe "#task" do
399
399
  it "should not print the message by default" do
400
- console.should_not_receive("begin")
400
+ expect(console).not_to receive("begin")
401
401
  console.task { :ok }
402
402
  end
403
403
 
404
404
  it "should print the message and indentate correctly" do
405
- console.should_receive(:begin).with("A", "B", "C", "D", "E", "F", "G")
406
- console.should_receive(:with_indentation).with("H", "I")
405
+ expect(console).to receive(:begin).with("A", "B", "C", "D", "E", "F", "G")
406
+ expect(console).to receive(:with_indentation).with("H", "I")
407
407
  console.task("A", "B", "C", "D", "E", "F", "G", "H", "I") { :ok }
408
408
  end
409
409
 
410
410
  it "should execute the given block" do
411
- ::Bovem::Console.should_receive(:foo)
411
+ expect(::Bovem::Console).to receive(:foo)
412
412
  console.task { ::Bovem::Console.foo }
413
413
  end
414
414
 
415
415
  it "should write the correct status" do
416
- console.stub(:begin)
417
- console.should_receive(:status).with(:ok, false)
416
+ allow(console).to receive(:begin)
417
+ expect(console).to receive(:status).with(:ok, false)
418
418
  console.task("OK") { :ok }
419
- console.should_receive(:status).with(:fail, false)
419
+ expect(console).to receive(:status).with(:fail, false)
420
420
  expect { console.task("") { :fatal }}.to raise_error(SystemExit)
421
421
  end
422
422
 
@@ -45,7 +45,7 @@ describe Bovem::Logger do
45
45
 
46
46
  before(:each) do
47
47
  now = Time.now
48
- Time.stub(:now).and_return(now)
48
+ allow(Time).to receive(:now).and_return(now)
49
49
  @time = now.strftime("%Y/%b/%d %H:%M:%S")
50
50
  end
51
51
 
@@ -81,21 +81,21 @@ describe Bovem::Logger do
81
81
  end
82
82
 
83
83
  describe ".get_real_file" do
84
- it("should return the standard ouput") do
84
+ it "should return the standard ouput" do
85
85
  expect(::Bovem::Logger.get_real_file("STDOUT")).to eq($stdout )
86
86
  end
87
87
 
88
- it("should return the standard error") do
88
+ it "should return the standard error" do
89
89
  expect(::Bovem::Logger.get_real_file("STDERR")).to eq($stderr )
90
90
  end
91
91
 
92
- it("should return the file") do
92
+ it "should return the file" do
93
93
  expect(::Bovem::Logger.get_real_file("/dev/null")).to eq("/dev/null" )
94
94
  end
95
95
  end
96
96
 
97
97
  describe ".default_file" do
98
- it("should return the standard output") do
98
+ it "should return the standard output" do
99
99
  expect(::Bovem::Logger.default_file).to eq($stdout)
100
100
  end
101
101
  end
@@ -19,7 +19,7 @@ describe Bovem::Shell do
19
19
  let(:temp_dir_2) { "/tmp/bovem-test-dir-2-#{Time.now.strftime("%Y%m%d-%H%M%S")}" }
20
20
 
21
21
  before(:each) do
22
- Kernel.stub(:puts).and_return(nil)
22
+ allow(Kernel).to receive(:puts).and_return(nil)
23
23
  end
24
24
 
25
25
  describe ".instance" do
@@ -37,57 +37,57 @@ describe Bovem::Shell do
37
37
 
38
38
  describe "#run" do
39
39
  before(:each) do
40
- ::Open4::stub(:popen4) do |_, _, _, _| OpenStruct.new(exitstatus: 0) end
40
+ allow(::Open4).to receive(:popen4) do |_, _, _, _| OpenStruct.new(exitstatus: 0) end
41
41
  end
42
42
 
43
43
  it "should show a message" do
44
- shell.console.should_receive("begin").with("MESSAGE")
44
+ expect(shell.console).to receive("begin").with("MESSAGE")
45
45
  shell.run("echo OK", "MESSAGE", true, false)
46
- shell.console.should_not_receive("begin").with("MESSAGE")
46
+ expect(shell.console).not_to receive("begin").with("MESSAGE")
47
47
  shell.run("echo OK", nil, true, false)
48
48
  end
49
49
 
50
50
  it "should print the command line" do
51
- shell.console.should_receive("info").with("Running command: {mark=bright}\"echo OK\"{/mark}...")
51
+ expect(shell.console).to receive("info").with("Running command: {mark=bright}\"echo OK\"{/mark}...")
52
52
  shell.run("echo OK", nil, true, false, false, true)
53
53
  end
54
54
 
55
55
  it "should only print the command if requested to" do
56
- shell.console.should_receive("warn").with("Will run command: {mark=bright}\"echo OK\"{/mark}...")
57
- ::Open4.should_not_receive("popen4")
56
+ expect(shell.console).to receive("warn").with("Will run command: {mark=bright}\"echo OK\"{/mark}...")
57
+ expect(::Open4).not_to receive("popen4")
58
58
  shell.run("echo OK", nil, false, false)
59
59
  end
60
60
 
61
61
  it "should only execute a command" do
62
- shell.console.should_not_receive("warn").with("Will run command: {mark=bright}\"echo OK\"{/mark}...")
62
+ expect(shell.console).not_to receive("warn").with("Will run command: {mark=bright}\"echo OK\"{/mark}...")
63
63
  shell.run("echo OK", nil, true, false)
64
64
  end
65
65
 
66
66
  it "should show a exit message" do
67
67
  i = -1
68
- ::Open4::stub(:popen4) do |_, _, _, _|
68
+ allow(::Open4).to receive(:popen4) do |_, _, _, _|
69
69
  i += 1
70
70
  OpenStruct.new(exitstatus: i)
71
71
  end
72
72
 
73
- shell.console.should_receive(:status).with(:ok)
73
+ expect(shell.console).to receive(:status).with(:ok)
74
74
  shell.run("echo OK", nil, true, true)
75
- shell.console.should_receive(:status).with(:fail)
75
+ expect(shell.console).to receive(:status).with(:fail)
76
76
  shell.run("echo1 OK", nil, true, true, false, false, false)
77
77
  end
78
78
 
79
79
  it "should print output" do
80
- Kernel.should_receive("print").with("OK\n")
80
+ expect(Kernel).to receive("print").with("OK\n")
81
81
 
82
82
  stdout = Object.new
83
- stdout.stub(:each_line).and_yield("OK\n")
84
- ::Open4::stub(:popen4).and_yield(nil, nil, stdout, nil).and_return(OpenStruct.new(exitstatus: 0))
83
+ allow(stdout).to receive(:each_line).and_yield("OK\n")
84
+ allow(::Open4).to receive(:popen4).and_yield(nil, nil, stdout, nil).and_return(OpenStruct.new(exitstatus: 0))
85
85
 
86
86
  shell.run("echo OK", nil, true, false, true)
87
87
  end
88
88
 
89
89
  it "should raise a exception for failures" do
90
- ::Open4::stub(:popen4) {|_, _, _, _| OpenStruct.new(exitstatus: 1) }
90
+ allow(::Open4).to receive(:popen4) {|_, _, _, _| OpenStruct.new(exitstatus: 1) }
91
91
  expect { shell.run("echo1 OK", nil, true, false, false, false, false) }.not_to raise_error
92
92
  expect { shell.run("echo1 OK", nil, true, false, false) }.to raise_error(SystemExit)
93
93
  end
@@ -119,37 +119,37 @@ describe Bovem::Shell do
119
119
  end
120
120
 
121
121
  it "should only print the list of files" do
122
- shell.console.should_receive(:warn).with("Will remove file(s):")
123
- FileUtils.should_not_receive(:rm_r)
122
+ expect(shell.console).to receive(:warn).with("Will remove file(s):")
123
+ expect(FileUtils).not_to receive(:rm_r)
124
124
  expect(shell.delete(temp_file_1, false)).to be_true
125
125
  end
126
126
 
127
127
  it "should complain about non existing files" do
128
- shell.console.should_receive(:error).with("Cannot remove following non existent file: {mark=bright}#{temp_file_1}{/mark}")
128
+ expect(shell.console).to receive(:error).with("Cannot remove following non existent file: {mark=bright}#{temp_file_1}{/mark}")
129
129
  expect(shell.delete(temp_file_1, true, true, false)).to be_false
130
130
  end
131
131
 
132
132
  it "should complain about non writeable files" do
133
- shell.console.should_receive(:error).with("Cannot remove following non writable file: {mark=bright}/dev/null{/mark}")
133
+ expect(shell.console).to receive(:error).with("Cannot remove following non writable file: {mark=bright}/dev/null{/mark}")
134
134
  expect(shell.delete("/dev/null", true, true, false)).to be_false
135
135
  end
136
136
 
137
137
  it "should complain about other exceptions" do
138
- FileUtils.stub(:rm_r).and_raise(ArgumentError.new("ERROR"))
139
- shell.console.should_receive(:error).with("Cannot remove following file(s):")
140
- shell.console.should_receive(:write).at_least(2)
138
+ allow(FileUtils).to receive(:rm_r).and_raise(ArgumentError.new("ERROR"))
139
+ expect(shell.console).to receive(:error).with("Cannot remove following file(s):")
140
+ expect(shell.console).to receive(:write).at_least(2)
141
141
  expect(shell.delete("/dev/null", true, true, false)).to be_false
142
142
  end
143
143
 
144
144
  describe "should exit when requested to" do
145
145
  it "by calling :fatal" do
146
- shell.console.should_receive(:fatal).with("Cannot remove following non writable file: {mark=bright}/dev/null{/mark}")
146
+ expect(shell.console).to receive(:fatal).with("Cannot remove following non writable file: {mark=bright}/dev/null{/mark}")
147
147
  expect(shell.delete("/dev/null")).to be_false
148
148
  end
149
149
 
150
150
  it "by calling Kernel#exit" do
151
- FileUtils.stub(:rm_r).and_raise(ArgumentError.new("ERROR"))
152
- Kernel.should_receive(:exit).with(-1)
151
+ allow(FileUtils).to receive(:rm_r).and_raise(ArgumentError.new("ERROR"))
152
+ expect(Kernel).to receive(:exit).with(-1)
153
153
  expect(shell.delete("/dev/null", true, true)).to be_false
154
154
  end
155
155
  end
@@ -217,10 +217,10 @@ describe Bovem::Shell do
217
217
  end
218
218
 
219
219
  it "should complain about non existing source" do
220
- shell.console.should_receive(:error).with("Cannot copy non existent file {mark=bright}#{temp_file_1}{/mark}.")
220
+ expect(shell.console).to receive(:error).with("Cannot copy non existent file {mark=bright}#{temp_file_1}{/mark}.")
221
221
  expect(shell.copy_or_move(temp_file_1, temp_file_2, :copy, true, false, false)).to be_false
222
222
 
223
- shell.console.should_receive(:error).with("Cannot move non existent file {mark=bright}#{temp_file_1}{/mark}.")
223
+ expect(shell.console).to receive(:error).with("Cannot move non existent file {mark=bright}#{temp_file_1}{/mark}.")
224
224
  expect(shell.copy_or_move(temp_file_1, temp_file_2, :move, true, false, false)).to be_false
225
225
  end
226
226
 
@@ -228,77 +228,77 @@ describe Bovem::Shell do
228
228
  File.open(temp_file_1, "w") {|f| f.write("OK") }
229
229
  shell.create_directories(temp_file_2)
230
230
 
231
- shell.console.should_receive(:error).with("Cannot copy file {mark=bright}#{temp_file_1}{/mark} to {mark=bright}#{temp_file_2}{/mark} because it is currently a directory.")
231
+ expect(shell.console).to receive(:error).with("Cannot copy file {mark=bright}#{temp_file_1}{/mark} to {mark=bright}#{temp_file_2}{/mark} because it is currently a directory.")
232
232
  expect(shell.copy_or_move(temp_file_1, temp_file_2, :copy, true, false, false)).to be_false
233
233
 
234
- shell.console.should_receive(:error).with("Cannot move file {mark=bright}#{temp_file_1}{/mark} to {mark=bright}#{temp_file_2}{/mark} because it is currently a directory.")
234
+ expect(shell.console).to receive(:error).with("Cannot move file {mark=bright}#{temp_file_1}{/mark} to {mark=bright}#{temp_file_2}{/mark} because it is currently a directory.")
235
235
  expect(shell.copy_or_move(temp_file_1, temp_file_2, :move, true, false, false)).to be_false
236
236
  end
237
237
 
238
238
  it "should create the parent directory if needed" do
239
239
  expect(shell.check(temp_dir_1, :dir)).to be_false
240
240
 
241
- shell.should_receive(:create_directories).exactly(2)
241
+ expect(shell).to receive(:create_directories).exactly(2)
242
242
  expect(shell.copy_or_move(temp_file_1, temp_dir_1 + "/test-1", :copy)).to be_false
243
243
  expect(shell.copy_or_move(temp_file_1, temp_dir_1 + "/test-1", :move)).to be_false
244
244
  end
245
245
 
246
246
  it "should only print the list of files" do
247
- FileUtils.should_not_receive(:cp_r)
248
- FileUtils.should_not_receive(:mv)
247
+ expect(FileUtils).not_to receive(:cp_r)
248
+ expect(FileUtils).not_to receive(:mv)
249
249
 
250
- shell.console.should_receive(:warn).with("Will copy a file:")
250
+ expect(shell.console).to receive(:warn).with("Will copy a file:")
251
251
  expect(shell.copy_or_move(temp_file_1, temp_file_2, :copy, false)).to be_true
252
- shell.console.should_receive(:warn).with("Will copy following entries:")
252
+ expect(shell.console).to receive(:warn).with("Will copy following entries:")
253
253
  expect(shell.copy_or_move([temp_file_1, temp_file_2], temp_dir_1, :copy, false)).to be_true
254
254
 
255
- shell.console.should_receive(:warn).with("Will move a file:")
255
+ expect(shell.console).to receive(:warn).with("Will move a file:")
256
256
  expect(shell.copy_or_move(temp_file_1, temp_file_2, :move, false)).to be_true
257
- shell.console.should_receive(:warn).with("Will move following entries:")
257
+ expect(shell.console).to receive(:warn).with("Will move following entries:")
258
258
  expect(shell.copy_or_move([temp_file_1, temp_file_2], temp_dir_1, :move, false)).to be_true
259
259
  end
260
260
 
261
261
  it "should complain about non writeable parent directory" do
262
262
  File.open(temp_file_1, "w") {|f| f.write("OK") }
263
263
 
264
- shell.console.should_receive(:error).with("Cannot copy file {mark=bright}#{temp_file_1}{/mark} to non writable directory {mark=bright}/dev{/mark}.", "\n", 5)
264
+ expect(shell.console).to receive(:error).with("Cannot copy file {mark=bright}#{temp_file_1}{/mark} to non writable directory {mark=bright}/dev{/mark}.", "\n", 5)
265
265
  expect(shell.copy_or_move(temp_file_1, "/dev/bovem", :copy, true, true, false)).to be_false
266
266
 
267
- shell.console.should_receive(:error).with("Cannot move file {mark=bright}#{temp_file_1}{/mark} to non writable directory {mark=bright}/dev{/mark}.", "\n", 5)
267
+ expect(shell.console).to receive(:error).with("Cannot move file {mark=bright}#{temp_file_1}{/mark} to non writable directory {mark=bright}/dev{/mark}.", "\n", 5)
268
268
  expect(shell.copy_or_move(temp_file_1, "/dev/bovem", :move, true, true, false)).to be_false
269
269
  end
270
270
 
271
271
  it "should complain about other exceptions" do
272
- FileUtils.stub(:cp_r).and_raise(ArgumentError.new("ERROR"))
273
- FileUtils.stub(:mv).and_raise(ArgumentError.new("ERROR"))
272
+ allow(FileUtils).to receive(:cp_r).and_raise(ArgumentError.new("ERROR"))
273
+ allow(FileUtils).to receive(:mv).and_raise(ArgumentError.new("ERROR"))
274
274
  File.open(temp_file_1, "w") {|f| f.write("OK") }
275
275
 
276
- shell.console.should_receive(:error).with("Cannot copy file {mark=bright}#{temp_file_1}{/mark} to directory {mark=bright}#{File.dirname(temp_file_2)}{/mark} due to this error: [ArgumentError] ERROR.", "\n", 5)
276
+ expect(shell.console).to receive(:error).with("Cannot copy file {mark=bright}#{temp_file_1}{/mark} to directory {mark=bright}#{File.dirname(temp_file_2)}{/mark} due to this error: [ArgumentError] ERROR.", "\n", 5)
277
277
  expect(shell.copy_or_move(temp_file_1, temp_file_2, :copy, true, true, false)).to be_false
278
278
 
279
- shell.console.should_receive(:error).with("Cannot move file {mark=bright}#{temp_file_1}{/mark} to directory {mark=bright}#{File.dirname(temp_file_2)}{/mark} due to this error: [ArgumentError] ERROR.", "\n", 5)
279
+ expect(shell.console).to receive(:error).with("Cannot move file {mark=bright}#{temp_file_1}{/mark} to directory {mark=bright}#{File.dirname(temp_file_2)}{/mark} due to this error: [ArgumentError] ERROR.", "\n", 5)
280
280
  expect(shell.copy_or_move(temp_file_1, temp_file_2, :move, true, true, false)).to be_false
281
281
  end
282
282
 
283
283
  describe "should exit when requested to" do
284
284
  it "by calling :fatal" do
285
- FileUtils.stub(:cp_r).and_raise(ArgumentError.new("ERROR"))
286
- FileUtils.stub(:mv).and_raise(ArgumentError.new("ERROR"))
285
+ allow(FileUtils).to receive(:cp_r).and_raise(ArgumentError.new("ERROR"))
286
+ allow(FileUtils).to receive(:mv).and_raise(ArgumentError.new("ERROR"))
287
287
 
288
288
  File.open(temp_file_1, "w") {|f| f.write("OK") }
289
289
  File.open(temp_file_2, "w") {|f| f.write("OK") }
290
290
 
291
- shell.console.should_receive(:fatal).with("Cannot copy file {mark=bright}#{temp_file_1}{/mark} to directory {mark=bright}/dev{/mark} due to this error: [ArgumentError] ERROR.", "\n", 5)
291
+ expect(shell.console).to receive(:fatal).with("Cannot copy file {mark=bright}#{temp_file_1}{/mark} to directory {mark=bright}/dev{/mark} due to this error: [ArgumentError] ERROR.", "\n", 5)
292
292
  expect(shell.copy_or_move(temp_file_1, "/dev/bovem", :copy, true, true, true)).to be_false
293
293
 
294
- shell.console.should_receive(:fatal).with("Cannot move file {mark=bright}#{temp_file_1}{/mark} to directory {mark=bright}/dev{/mark} due to this error: [ArgumentError] ERROR.", "\n", 5)
294
+ expect(shell.console).to receive(:fatal).with("Cannot move file {mark=bright}#{temp_file_1}{/mark} to directory {mark=bright}/dev{/mark} due to this error: [ArgumentError] ERROR.", "\n", 5)
295
295
  expect(shell.copy_or_move(temp_file_1, "/dev/bovem", :move, true, true, true)).to be_false
296
296
 
297
- Kernel.stub(:exit).and_return(true)
298
- shell.console.should_receive(:error).with("Cannot copy following entries to {mark=bright}/dev{/mark}:")
297
+ allow(Kernel).to receive(:exit).and_return(true)
298
+ expect(shell.console).to receive(:error).with("Cannot copy following entries to {mark=bright}/dev{/mark}:")
299
299
  expect(shell.copy_or_move([temp_file_1, temp_file_2], "/dev", :copy, true, true, true)).to be_false
300
300
 
301
- shell.console.should_receive(:error).with("Cannot move following entries to {mark=bright}/dev{/mark}:")
301
+ expect(shell.console).to receive(:error).with("Cannot move following entries to {mark=bright}/dev{/mark}:")
302
302
  expect(shell.copy_or_move([temp_file_1, temp_file_2], "/dev", :move, true, true, true)).to be_false
303
303
  end
304
304
 
@@ -306,7 +306,7 @@ describe Bovem::Shell do
306
306
  File.open(temp_file_1, "w") {|f| f.write("OK") }
307
307
  File.open(temp_file_2, "w") {|f| f.write("OK") }
308
308
 
309
- Kernel.should_receive(:exit).with(-1).exactly(4).and_return(true)
309
+ expect(Kernel).to receive(:exit).with(-1).exactly(4).and_return(true)
310
310
  expect(shell.copy_or_move(temp_file_1, "/dev/bovem", :copy, true, false, true)).to be_false
311
311
  expect(shell.copy_or_move([temp_file_1, temp_file_2], "/dev", :copy, true, false, true)).to be_false
312
312
  expect(shell.copy_or_move(temp_file_1, "/dev/bovem", :move, true, false, true)).to be_false
@@ -317,14 +317,14 @@ describe Bovem::Shell do
317
317
 
318
318
  describe "#copy" do
319
319
  it "should forward everything to #copy_or_move" do
320
- shell.should_receive(:copy_or_move).with("A", "B", :copy, "C", "D", "E")
320
+ expect(shell).to receive(:copy_or_move).with("A", "B", :copy, "C", "D", "E")
321
321
  shell.copy("A", "B", "C", "D", "E")
322
322
  end
323
323
  end
324
324
 
325
325
  describe "#move" do
326
326
  it "should forward everything to #copy_or_move" do
327
- shell.should_receive(:copy_or_move).with("A", "B", :move, "C", "D", "E")
327
+ expect(shell).to receive(:copy_or_move).with("A", "B", :move, "C", "D", "E")
328
328
  shell.move("A", "B", "C", "D", "E")
329
329
  end
330
330
  end
@@ -364,7 +364,7 @@ describe Bovem::Shell do
364
364
  end
365
365
 
366
366
  it "should show messages" do
367
- shell.console.should_receive(:info).with(/Moving (.*)into directory \{mark=bright\}(.+)\{\/mark\}/).exactly(2)
367
+ expect(shell.console).to receive(:info).with(/Moving (.*)into directory \{mark=bright\}(.+)\{\/mark\}/).exactly(2)
368
368
  shell.within_directory(target, true, true) { "OK" }
369
369
  end
370
370
 
@@ -374,11 +374,11 @@ describe Bovem::Shell do
374
374
  expect(shell.within_directory("/invalid") { dir = "OK" }).to be_false
375
375
  expect(dir).to eq("")
376
376
 
377
- Dir.stub(:chdir).and_raise(ArgumentError)
377
+ allow(Dir).to receive(:chdir).and_raise(ArgumentError)
378
378
  expect(shell.within_directory("/") { true }).to be_false
379
379
 
380
- Dir.unstub(:chdir)
381
- Dir.stub(:pwd).and_return("/invalid")
380
+ allow(Dir).to receive(:chdir)
381
+ allow(Dir).to receive(:pwd).and_return("/invalid")
382
382
  expect(shell.within_directory("/") { true }).to be_false
383
383
  end
384
384
  end
@@ -407,45 +407,45 @@ describe Bovem::Shell do
407
407
  end
408
408
 
409
409
  it "should only print the list of files" do
410
- shell.console.should_receive(:warn).with("Will create directories:")
411
- FileUtils.should_not_receive(:mkdir_p)
410
+ expect(shell.console).to receive(:warn).with("Will create directories:")
411
+ expect(FileUtils).not_to receive(:mkdir_p)
412
412
  expect(shell.create_directories(temp_file_1, 0755, false)).to be_true
413
413
  end
414
414
 
415
415
  it "should complain about directory already existing" do
416
416
  shell.create_directories(temp_dir_1, 0755, true, false, false)
417
- shell.console.should_receive(:error).with("The directory {mark=bright}#{temp_dir_1}{/mark} already exists.")
417
+ expect(shell.console).to receive(:error).with("The directory {mark=bright}#{temp_dir_1}{/mark} already exists.")
418
418
  expect(shell.create_directories(temp_dir_1, 0755, true, false, false)).to be_false
419
419
  end
420
420
 
421
421
  it "should complain about paths already existing as a file." do
422
422
  File.open(temp_file_1, "w") {|f| f.write("OK") }
423
423
 
424
- shell.console.should_receive(:error).with("Path {mark=bright}#{temp_file_1}{/mark} is currently a file.")
424
+ expect(shell.console).to receive(:error).with("Path {mark=bright}#{temp_file_1}{/mark} is currently a file.")
425
425
  expect(shell.create_directories(temp_file_1, 0755, true, false, false)).to be_false
426
426
  end
427
427
 
428
428
  it "should complain about non writable parents" do
429
- shell.console.should_receive(:error).with("Cannot create following directory due to permission denied: {mark=bright}/dev/bovem{/mark}.")
429
+ expect(shell.console).to receive(:error).with("Cannot create following directory due to permission denied: {mark=bright}/dev/bovem{/mark}.")
430
430
  expect(shell.create_directories("/dev/bovem", 0755, true, false, false)).to be_false
431
431
  end
432
432
 
433
433
  it "should complain about other exceptions" do
434
- FileUtils.stub(:mkdir_p).and_raise(ArgumentError.new("ERROR"))
435
- shell.console.should_receive(:error).with("Cannot create following directories:")
436
- shell.console.should_receive(:write).at_least(2)
434
+ allow(FileUtils).to receive(:mkdir_p).and_raise(ArgumentError.new("ERROR"))
435
+ expect(shell.console).to receive(:error).with("Cannot create following directories:")
436
+ expect(shell.console).to receive(:write).at_least(2)
437
437
  expect(shell.create_directories(temp_dir_1, 0755, true, true, false)).to be_false
438
438
  end
439
439
 
440
440
  describe "should exit when requested to" do
441
441
  it "by calling :fatal" do
442
- shell.console.should_receive(:fatal).with("Path {mark=bright}/dev/null{/mark} is currently a file.")
442
+ expect(shell.console).to receive(:fatal).with("Path {mark=bright}/dev/null{/mark} is currently a file.")
443
443
  expect(shell.create_directories("/dev/null")).to be_false
444
444
  end
445
445
 
446
446
  it "by calling Kernel#exit" do
447
- FileUtils.stub(:mkdir_p).and_raise(ArgumentError.new("ERROR"))
448
- Kernel.should_receive(:exit).with(-1)
447
+ allow(FileUtils).to receive(:mkdir_p).and_raise(ArgumentError.new("ERROR"))
448
+ expect(Kernel).to receive(:exit).with(-1)
449
449
  expect(shell.create_directories(temp_dir_1, 0755, true, true)).to be_false
450
450
  end
451
451
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bovem
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.6
4
+ version: 2.3.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-07-14 00:00:00.000000000 Z
12
+ date: 2013-07-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: lazier
@@ -18,7 +18,7 @@ dependencies:
18
18
  requirements:
19
19
  - - ~>
20
20
  - !ruby/object:Gem::Version
21
- version: 3.2.5
21
+ version: 3.2.6
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
@@ -26,7 +26,7 @@ dependencies:
26
26
  requirements:
27
27
  - - ~>
28
28
  - !ruby/object:Gem::Version
29
- version: 3.2.5
29
+ version: 3.2.6
30
30
  - !ruby/object:Gem::Dependency
31
31
  name: open4
32
32
  requirement: !ruby/object:Gem::Requirement
@@ -130,7 +130,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
130
130
  version: '0'
131
131
  segments:
132
132
  - 0
133
- hash: -2498802377296804725
133
+ hash: 4382808554281169718
134
134
  requirements: []
135
135
  rubyforge_project: bovem
136
136
  rubygems_version: 1.8.25