spec/prlbackup/cli_spec.rb in prlbackup-1.1.1 vs spec/prlbackup/cli_spec.rb in prlbackup-1.1.2
- old
+ new
@@ -1,31 +1,31 @@
require 'spec_helper'
module PrlBackup
describe CLI do
- describe '.run' do
+ describe '.start' do
before do
@cli = double('cli')
- @cli.stub(:run)
+ @cli.stub(:start)
CLI.stub(:new).and_return(@cli)
end
it 'should initialize a new instance' do
CLI.should_receive(:new).and_return(@cli)
- CLI.run
+ CLI.start
end
it 'should run the new instance with ARGV' do
- @cli.should_receive(:run).with(ARGV)
- CLI.run
+ @cli.should_receive(:start).with(ARGV)
+ CLI.start
end
end
- describe '#run' do
+ describe '#start' do
before do
@vm = double('vm')
- @vm.stub(:safe_backup)
+ @vm.stub(:safely_backup)
@vm.stub(:cleanup)
VirtualMachine.stub(:new).and_return(@vm)
@cli = CLI.new
end
@@ -33,51 +33,51 @@
before do
VirtualMachine.should_receive(:new).with('foo').and_return(@vm)
end
it 'should backup each selected virtual machine' do
- @vm.should_receive(:safe_backup).once
- @cli.run %w[foo]
+ @vm.should_receive(:safely_backup).once
+ @cli.start %w[foo]
end
it 'should not perform cleanup actions' do
@vm.should_not_receive(:cleanup)
- @cli.run %w[foo]
+ @cli.start %w[foo]
end
end
context 'with option --all' do
it 'should backup all virtual machines' do
VirtualMachine.should_receive(:all).and_return([@vm, @vm])
- @vm.should_receive(:safe_backup).twice
- @cli.run %w[--all]
+ @vm.should_receive(:safely_backup).twice
+ @cli.start %w[--all]
end
end
context 'with options --all and --exclude' do
before do
VirtualMachine.should_receive(:all).and_return([@vm, @vm])
end
it 'should not backup virtual machines which are given' do
@cli.stub(:given_virtual_machines).and_return([@vm])
- @vm.should_not_receive(:safe_backup)
- @cli.run %w[--all --exclude foo]
+ @vm.should_not_receive(:safely_backup)
+ @cli.start %w[--all --exclude foo]
end
it 'should backup virtual machines which are not given' do
@cli.stub(:given_virtual_machines).and_return([])
- @vm.should_receive(:safe_backup).twice
- @cli.run %w[--all --exclude foo]
+ @vm.should_receive(:safely_backup).twice
+ @cli.start %w[--all --exclude foo]
end
end
context 'with option --keep-only' do
it 'should perform cleanup actions after backing up' do
- @vm.should_receive(:safe_backup).ordered
+ @vm.should_receive(:safely_backup).ordered
@vm.should_receive(:cleanup).ordered
@cli.stub(:config).and_return({:keep_only => 3})
- @cli.run %w[foo]
+ @cli.start %w[foo]
end
end
end
end
end