diff options
author | sersut <serdar@opscode.com> | 2013-10-17 15:28:23 -0700 |
---|---|---|
committer | sersut <serdar@opscode.com> | 2013-10-17 15:28:23 -0700 |
commit | 180e9c1ec6cc324c598b3575a6ba2a209df44a24 (patch) | |
tree | 09bfce4f8c4e8f29a7c6c740f7ed86cec11d5737 /spec/unit/util/backup_spec.rb | |
parent | c995e37339f37be82d7e5b1b7866bef64c1bd05a (diff) | |
parent | 05ba3e301794bd09173c5c3f13a62c2530d8b403 (diff) | |
download | chef-180e9c1ec6cc324c598b3575a6ba2a209df44a24.tar.gz |
Merge branch 'master' into 11-stable
Diffstat (limited to 'spec/unit/util/backup_spec.rb')
-rw-r--r-- | spec/unit/util/backup_spec.rb | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/spec/unit/util/backup_spec.rb b/spec/unit/util/backup_spec.rb index f0e182e181..c49694f924 100644 --- a/spec/unit/util/backup_spec.rb +++ b/spec/unit/util/backup_spec.rb @@ -21,13 +21,6 @@ require 'spec_helper' require 'tmpdir' describe Chef::Util::Backup do - before(:all) do - @original_config = Chef::Config.configuration - end - - after(:all) do - Chef::Config.configuration.replace(@original_config) - end let (:tempfile) do Tempfile.new("chef-util-backup-spec-test") @@ -114,15 +107,15 @@ describe Chef::Util::Backup do describe "backup_filename" do it "should return a timestamped path" do @backup.should_receive(:path).and_return('/a/b/c.txt') - @backup.send(:backup_filename).should =~ %r|^/a/b/c.txt.chef-\d{14}$| + @backup.send(:backup_filename).should =~ %r|^/a/b/c.txt.chef-\d{14}.\d{6}$| end it "should strip the drive letter off for windows" do @backup.should_receive(:path).and_return('c:\a\b\c.txt') - @backup.send(:backup_filename).should =~ %r|^\\a\\b\\c.txt.chef-\d{14}$| + @backup.send(:backup_filename).should =~ %r|^\\a\\b\\c.txt.chef-\d{14}.\d{6}$| end it "should strip the drive letter off for windows (with forwardslashes)" do @backup.should_receive(:path).and_return('c:/a/b/c.txt') - @backup.send(:backup_filename).should =~ %r|^/a/b/c.txt.chef-\d{14}$| + @backup.send(:backup_filename).should =~ %r|^/a/b/c.txt.chef-\d{14}.\d{6}$| end end @@ -130,19 +123,19 @@ describe Chef::Util::Backup do it "uses the file's directory when Chef::Config[:file_backup_path] is nil" do @backup.should_receive(:path).and_return('/a/b/c.txt') Chef::Config[:file_backup_path] = nil - @backup.send(:backup_path).should =~ %r|^/a/b/c.txt.chef-\d{14}$| + @backup.send(:backup_path).should =~ %r|^/a/b/c.txt.chef-\d{14}.\d{6}$| end it "uses the configured Chef::Config[:file_backup_path]" do @backup.should_receive(:path).and_return('/a/b/c.txt') Chef::Config[:file_backup_path] = '/backupdir' - @backup.send(:backup_path).should =~ %r|^/backupdir[\\/]+a/b/c.txt.chef-\d{14}$| + @backup.send(:backup_path).should =~ %r|^/backupdir[\\/]+a/b/c.txt.chef-\d{14}.\d{6}$| end it "uses the configured Chef::Config[:file_backup_path] and strips the drive on windows" do @backup.should_receive(:path).and_return('c:\\a\\b\\c.txt') Chef::Config[:file_backup_path] = 'c:\backupdir' - @backup.send(:backup_path).should =~ %r|^c:\\backupdir[\\/]+a\\b\\c.txt.chef-\d{14}$| + @backup.send(:backup_path).should =~ %r|^c:\\backupdir[\\/]+a\\b\\c.txt.chef-\d{14}.\d{6}$| end end |