# # Author:: Fletcher Nichol () # Copyright:: Copyright (c) 2012 Fletcher Nichol # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # require 'chef/knife/server_backup' require 'fakefs/spec_helpers' require 'timecop' describe Chef::Knife::ServerBackup do include FakeFS::SpecHelpers before do Chef::Log.logger = Logger.new(StringIO.new) @knife = Chef::Knife::ServerBackup.new @stdout = StringIO.new @knife.ui.stub!(:stdout).and_return(@stdout) @knife.ui.stub(:msg) @stderr = StringIO.new @knife.ui.stub!(:stderr).and_return(@stderr) @knife.config[:backup_dir] = "/baks" Chef::Config[:chef_server_url] = "https://chef.example.com:9876" end describe "configuration" do before do Chef::Config[:_spec_file_backup_path] = Chef::Config[:file_backup_path] end after do Chef::Config[:file_backup_path] = Chef::Config[:_spec_file_backup_path] end it "defaults the backup dir to /_