spec/command_spec.rb in vagrant-shell-commander-0.1.3 vs spec/command_spec.rb in vagrant-shell-commander-0.1.4
- old
+ new
@@ -35,11 +35,11 @@
end
describe 'command execution' do
let(:machine) {double}
- let(:ui) {double(info: true)}
+ let(:ui) {double(info: true, warn: true)}
let(:env) {double(ui: ui)}
let(:machine_name) {'machine_name'}
before(:each) do
subject.stub(:with_target_vms).and_yield(machine)
@@ -55,11 +55,11 @@
before(:each) do
machine.stub_chain(:state, :id).and_return(:not_running)
end
it 'reports information about state' do
- ui.should_receive(:info).with("Machine #{machine_name} is not running.")
+ ui.should_receive(:warn).with("Machine #{machine_name} is not running.")
end
it 'dows not try to execute the command' do
machine.should_not_receive(:communicate)
end
@@ -96,22 +96,25 @@
and_return(parser: 'parser', values: {cmd: cmd, dir: dir})
communicate.should_receive(:execute).with("cd #{dir} && #{cmd}")
end
- describe 'does nothing' do
+ describe 'shows help' do
+ let(:parser) {'parser'}
+
after(:each) do
subject.should_not_receive(:with_target_vms)
+ ui.should_receive(:info).with(parser)
end
it 'an empty command' do
VagrantShellCommander::OptionManager.stub_chain(:new, :execute).
- and_return(parser: 'parser', values: {cmd: '', dir: dir})
+ and_return(parser: parser, values: {cmd: '', dir: dir})
end
it 'non present command' do
VagrantShellCommander::OptionManager.stub_chain(:new, :execute).
- and_return(parser: 'parser', values: {dir: dir})
+ and_return(parser: parser, values: {dir: dir})
end
end
end
end
end