Sha256: 1b51f6135fcfdcae4c2862b4792fbce669966507d08ea36c949c734f461fd71d
Contents?: true
Size: 1.43 KB
Versions: 1
Compression:
Stored size: 1.43 KB
Contents
require 'spec_helper' describe RdiffSimple::RdiffBackup do let(:source) { '~/Documents' } let(:destination) { '~/Test' } let(:status) { double('status', exitstatus: Random.rand(100)) } let(:open3) { double('open3') } let(:file) { StringIO.new } let(:rdiff) do RdiffSimple::RdiffBackup.new do |r| r.logger = Logger.new file r.open3 = open3 end end before do open3.stub(:capture3).with(args) { ['output', 'error', status] } end shared_examples "a command" do before { subject } it 'and returns the exit code' do expect(subject).to eq status.exitstatus end it 'and logs the output' do expect(file.string).to match /output/ end it 'and logs any errors' do expect(file.string).to match /error/ end end describe '#backup' do let(:args) { "rdiff-backup --exclude-other-filesystems --verbosity 5 --exclude *.png #{source} #{destination}" } subject { rdiff.backup(source, destination, :exclude_other_filesystems, verbosity: 5, exclude: '*.png') } it_behaves_like "a command" end describe '#verify' do let(:args) { "rdiff-backup --verify-at-time now #{destination}" } subject { rdiff.verify destination } it_behaves_like "a command" end describe '#verify_at_time' do let(:args) { "rdiff-backup --verify-at-time now #{destination}" } subject { rdiff.verify_at_time destination, 'now' } it_behaves_like "a command" end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rdiff-simple-0.1.1 | spec/lib/rdiff_simple/rdiff_backup_spec.rb |