Please review pull request #376: Tickets/2.7.x/6404 filebucket fails when no file specified opened by (lak)
Description:
Signed-off-by: Luke Kanies [email protected]
- Opened: Sat Jan 21 22:11:38 UTC 2012
- Based on: puppetlabs:2.7.x (f9a6337c23319bb2f30b90866034358bc6118aba)
- Requested merge: lak:tickets/2.7.x/6404-filebucket_fails_when_no_file_specified (a6255d2cec8dc151a79d36c2ee43689e9c6a8172)
Diff follows:
diff --git a/lib/puppet/application/filebucket.rb b/lib/puppet/application/filebucket.rb
index 6d59ae4..f78e937 100644
--- a/lib/puppet/application/filebucket.rb
+++ b/lib/puppet/application/filebucket.rb
@@ -128,6 +128,8 @@ def get
end
def backup
+ raise "You must specify a file to back up" unless args.length > 0
+
args.each do |file|
unless FileTest.exists?(file)
$stderr.puts "#{file}: no such file"
diff --git a/spec/unit/application/filebucket_spec.rb b/spec/unit/application/filebucket_spec.rb
index ee30e7d..372a080 100755
--- a/spec/unit/application/filebucket_spec.rb
+++ b/spec/unit/application/filebucket_spec.rb
@@ -182,6 +182,11 @@
end
describe "the command backup" do
+ it "should fail if no arguments are specified" do
+ @filebucket.stubs(:args).returns([])
+ lambda { @filebucket.backup }.should raise_error
+ end
+
it "should call the client backup method for each given parameter" do
@filebucket.stubs(:puts)
FileTest.stubs(:exists?).returns(true)
-- You received this message because you are subscribed to the Google Groups "Puppet Developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to [email protected].
For more options, visit this group at http://groups.google.com/group/puppet-dev?hl=en.
