Sha256: 6e14ac32cff91788b73351362d6725a55452b22cb6b17ca5f98fb1a8a504dedb
Contents?: true
Size: 1.58 KB
Versions: 1
Compression:
Stored size: 1.58 KB
Contents
require 'spec_helper' describe RdiffSimple::RdiffBackup do let(:backup) { RdiffSimple::RdiffBackup.new } describe '.execute' do context 'when rdiff-backup is installed' do before do Open3.stub(:capture2e).with(RdiffSimple::COMMANDS[:installed]).and_return(['', 0]) end context 'when no arguments are given' do before do Open3.stub(:capture2e).with(RdiffSimple::COMMANDS[:rdiff]).and_return(['', 1]) end subject { backup.execute('') } it { should be_false } end context 'when arguments are given' do before do Open3.stub(:capture2e).with("#{RdiffSimple::COMMANDS[:rdiff]} --version").and_return(['', 0]) end subject { backup.execute('--version') } it { should be_true } end end context 'when rdiff-backup is not installed' do before do Open3.stub(:capture2e).with(RdiffSimple::COMMANDS[:installed]).and_return(['', 1]) end it 'should raise an exception' do expect { subject.execute('--version') }.to raise_error(RdiffSimple::NotInstalledError) end end end describe '.installed?' do context 'when rdiff-backup is installed' do before do Open3.stub(:capture2e).with(RdiffSimple::COMMANDS[:installed]).and_return(['', 0]) end it { should be_installed } end context 'when rdiff-backup is not installed' do before do Open3.stub(:capture2e).with(RdiffSimple::COMMANDS[:installed]).and_return(['', 1]) end it { should_not be_installed } end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rdiff-simple-0.0.9 | spec/lib/rdiff_simple/rdiff_backup_spec.rb |