spec/selbackup_spec.rb in selbackup-0.1.3 vs spec/selbackup_spec.rb in selbackup-0.2.0
- old
+ new
@@ -1,6 +1,5 @@
-require 'rspec/autorun'
require File.expand_path("../../lib/selbackup", __FILE__)
describe SelBackup do
before (:each) do
@selbackup = SelBackup.new('key', 'secret', 'bucket')
@@ -29,58 +28,58 @@
end
end
describe '#gen_daily_file' do
it 'pushes a file to daily' do
- File.stub(:open).and_return(nil)
+ allow(File).to receive(:open).and_return(nil)
file = '2013-01-01-file.tgz'
expectation = { myname: 'file.tgz', key: 'file.tgz/2013-01-01-daily-file.tgz', body: nil }
expect(@selbackup.gen_daily_file(file)).to include( expectation )
end
it 'has not an extension' do
- File.stub(:open).and_return(nil)
+ allow(File).to receive(:open).and_return(nil)
file = '2013-01-01-file'
expectation = { myname: 'file', key: 'file/2013-01-01-daily-file', body: nil }
expect(@selbackup.gen_daily_file(file)).to include( expectation )
end
it 'has not a date' do
- File.stub(:open).and_return(nil)
+ allow(File).to receive(:open).and_return(nil)
file = 'file.tgz'
expectation = { myname: 'file.tgz', key: "file.tgz/#{Date.today.to_s}-daily-file.tgz", body: nil }
expect(@selbackup.gen_daily_file(file)).to include( expectation )
end
it 'has not a date and an extension' do
- File.stub(:open).and_return(nil)
+ allow(File).to receive(:open).and_return(nil)
file = 'file'
expectation = { myname: 'file', key: "file/#{Date.today.to_s}-daily-file", body: nil }
expect(@selbackup.gen_daily_file(file)).to include( expectation )
end
it 'has an different extension and not a date' do
- File.stub(:open).and_return(nil)
+ allow(File).to receive(:open).and_return(nil)
file = 'file.myextension'
expectation = { myname: 'file.myextension', key: "file.myextension/#{Date.today.to_s}-daily-file.myextension", body: nil }
expect(@selbackup.gen_daily_file(file)).to include( expectation )
end
it 'has a different extension' do
- File.stub(:open).and_return(nil)
+ allow(File).to receive(:open).and_return(nil)
file = '2013-01-01-file.myextension'
expectation = { myname: 'file.myextension', key: 'file.myextension/2013-01-01-daily-file.myextension', body: nil }
expect(@selbackup.gen_daily_file(file)).to include( expectation )
end
it 'has only a date and an extension' do
- File.stub(:open).and_return(nil)
+ allow(File).to receive(:open).and_return(nil)
file = '2013-01-01.tgz'
expect(@selbackup.gen_daily_file(file)).to eq false
end
it 'has only a date' do
- File.stub(:open).and_return(nil)
+ allow(File).to receive(:open).and_return(nil)
file = '2013-01-01'
expect(@selbackup.gen_daily_file(file)).to eq false
end
end