fission 0.3.0 → 0.4.0.beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +1 -0
- data/CHANGELOG.md +3 -0
- data/README.md +1 -1
- data/lib/fission.rb +5 -6
- data/lib/fission/cli.rb +77 -7
- data/lib/fission/command.rb +43 -1
- data/lib/fission/command/clone.rb +19 -20
- data/lib/fission/command/delete.rb +29 -25
- data/lib/fission/command/snapshot_create.rb +11 -26
- data/lib/fission/command/snapshot_list.rb +13 -19
- data/lib/fission/command/snapshot_revert.rb +11 -26
- data/lib/fission/command/start.rb +11 -25
- data/lib/fission/command/status.rb +26 -10
- data/lib/fission/command/stop.rb +10 -21
- data/lib/fission/command/suspend.rb +21 -21
- data/lib/fission/command_helpers.rb +21 -0
- data/lib/fission/config.rb +35 -0
- data/lib/fission/fusion.rb +11 -3
- data/lib/fission/lease.rb +148 -0
- data/lib/fission/metadata.rb +55 -2
- data/lib/fission/response.rb +76 -0
- data/lib/fission/ui.rb +49 -0
- data/lib/fission/version.rb +1 -1
- data/lib/fission/vm.rb +653 -75
- data/spec/contexts/command.rb +12 -0
- data/spec/fission/cli_spec.rb +4 -11
- data/spec/fission/command/clone_spec.rb +45 -45
- data/spec/fission/command/delete_spec.rb +56 -43
- data/spec/fission/command/snapshot_create_spec.rb +29 -51
- data/spec/fission/command/snapshot_list_spec.rb +25 -26
- data/spec/fission/command/snapshot_revert_spec.rb +27 -53
- data/spec/fission/command/start_spec.rb +25 -69
- data/spec/fission/command/status_spec.rb +48 -13
- data/spec/fission/command/stop_spec.rb +25 -42
- data/spec/fission/command/suspend_spec.rb +54 -49
- data/spec/fission/command_helpers_spec.rb +30 -0
- data/spec/fission/command_spec.rb +19 -0
- data/spec/fission/config_spec.rb +24 -0
- data/spec/fission/fusion_spec.rb +6 -6
- data/spec/fission/lease_spec.rb +176 -0
- data/spec/fission/metadata_spec.rb +8 -8
- data/spec/fission/response_spec.rb +81 -0
- data/spec/fission/vm_spec.rb +869 -193
- data/spec/fission_spec.rb +0 -6
- data/spec/helpers/command_helpers.rb +12 -0
- data/spec/helpers/response_helpers.rb +21 -0
- data/spec/matchers/be_a_successful_response.rb +7 -0
- data/spec/matchers/be_an_unsuccessful_response.rb +10 -0
- data/spec/spec_helper.rb +7 -0
- metadata +24 -5
@@ -1,40 +1,29 @@
|
|
1
1
|
require File.expand_path('../../../spec_helper.rb', __FILE__)
|
2
2
|
|
3
3
|
describe Fission::Command::SnapshotList do
|
4
|
+
include_context 'command_setup'
|
5
|
+
|
4
6
|
before do
|
5
7
|
@target_vm = ['foo']
|
6
|
-
@vm_mock = mock('vm_mock')
|
7
8
|
Fission::VM.stub!(:new).and_return(@vm_mock)
|
8
|
-
@string_io = StringIO.new
|
9
|
-
Fission.stub!(:ui).and_return(Fission::UI.new(@string_io))
|
10
|
-
end
|
11
9
|
|
12
|
-
|
13
|
-
it "should output an error and the help when no VM argument is passed in" do
|
14
|
-
Fission::Command::SnapshotList.should_receive(:help)
|
10
|
+
@snap_list_response_mock = mock('snap_list_response')
|
15
11
|
|
16
|
-
|
17
|
-
|
18
|
-
command.execute
|
19
|
-
}.should raise_error SystemExit
|
12
|
+
@vm_mock.stub(:name).and_return(@target_vm.first)
|
13
|
+
end
|
20
14
|
|
21
|
-
|
15
|
+
describe 'execute' do
|
16
|
+
before do
|
17
|
+
@vm_mock.stub(:snapshots).and_return(@snap_list_response_mock)
|
22
18
|
end
|
23
19
|
|
24
|
-
|
25
|
-
Fission::VM.should_receive(:exists?).with(@target_vm.first).and_return(false)
|
26
|
-
|
27
|
-
lambda {
|
28
|
-
command = Fission::Command::SnapshotList.new @target_vm
|
29
|
-
command.execute
|
30
|
-
}.should raise_error SystemExit
|
20
|
+
subject { Fission::Command::SnapshotList }
|
31
21
|
|
32
|
-
|
33
|
-
end
|
22
|
+
it_should_not_accept_arguments_of [], 'snapshot list'
|
34
23
|
|
35
24
|
it 'should output the list of snapshots if any exist' do
|
36
|
-
|
37
|
-
|
25
|
+
@snap_list_response_mock.stub_as_successful ['snap 1', 'snap 2', 'snap 3']
|
26
|
+
|
38
27
|
command = Fission::Command::SnapshotList.new @target_vm
|
39
28
|
command.execute
|
40
29
|
|
@@ -42,20 +31,30 @@ describe Fission::Command::SnapshotList do
|
|
42
31
|
end
|
43
32
|
|
44
33
|
it 'should output that it could not find any snapshots if none exist' do
|
45
|
-
|
46
|
-
|
34
|
+
@snap_list_response_mock.stub_as_successful []
|
35
|
+
|
47
36
|
command = Fission::Command::SnapshotList.new @target_vm
|
48
37
|
command.execute
|
49
38
|
|
50
39
|
@string_io.string.should match /No snapshots found for VM '#{@target_vm.first}'/
|
51
40
|
end
|
41
|
+
|
42
|
+
it 'should output an error and exit if there was an error getting the list of snapshots' do
|
43
|
+
@snap_list_response_mock.stub_as_unsuccessful
|
44
|
+
|
45
|
+
command = Fission::Command::SnapshotList.new @target_vm
|
46
|
+
lambda { command.execute }.should raise_error SystemExit
|
47
|
+
|
48
|
+
@string_io.string.should match /There was an error listing the snapshots.+it blew up.+/m
|
49
|
+
end
|
50
|
+
|
52
51
|
end
|
53
52
|
|
54
53
|
describe 'help' do
|
55
54
|
it 'should output info for this command' do
|
56
55
|
output = Fission::Command::SnapshotList.help
|
57
56
|
|
58
|
-
output.should match /snapshot list/
|
57
|
+
output.should match /snapshot list vm_name/
|
59
58
|
end
|
60
59
|
end
|
61
60
|
end
|
@@ -1,90 +1,64 @@
|
|
1
1
|
require File.expand_path('../../../spec_helper.rb', __FILE__)
|
2
2
|
|
3
3
|
describe Fission::Command::SnapshotRevert do
|
4
|
+
include_context 'command_setup'
|
5
|
+
|
4
6
|
before do
|
5
7
|
@target_vm = ['foo']
|
6
|
-
@vm_mock = mock('vm_mock')
|
7
8
|
Fission::VM.stub!(:new).and_return(@vm_mock)
|
8
|
-
|
9
|
-
|
9
|
+
|
10
|
+
@snap_revert_response_mock = mock('snap_revert_response')
|
11
|
+
|
12
|
+
@vm_mock.stub(:name).and_return(@target_vm.first)
|
10
13
|
end
|
11
14
|
|
12
15
|
describe 'execute' do
|
13
|
-
|
14
|
-
Fission::Command::SnapshotRevert.should_receive(:help)
|
15
|
-
|
16
|
-
lambda {
|
17
|
-
command = Fission::Command::SnapshotRevert.new
|
18
|
-
command.execute
|
19
|
-
}.should raise_error SystemExit
|
16
|
+
subject { Fission::Command::SnapshotRevert }
|
20
17
|
|
21
|
-
|
22
|
-
end
|
18
|
+
it_should_not_accept_arguments_of [], 'snapshot revert'
|
23
19
|
|
24
20
|
it "should output an error and the help when no snapshot name is passed in" do
|
25
21
|
Fission::Command::SnapshotRevert.should_receive(:help)
|
26
22
|
|
27
|
-
|
28
|
-
|
29
|
-
command.execute
|
30
|
-
}.should raise_error SystemExit
|
23
|
+
command = Fission::Command::SnapshotRevert.new @target_vm
|
24
|
+
lambda { command.execute }.should raise_error SystemExit
|
31
25
|
|
32
26
|
@string_io.string.should match /Incorrect arguments for snapshot revert command/
|
33
27
|
end
|
34
28
|
|
35
|
-
it
|
36
|
-
|
37
|
-
|
38
|
-
lambda {
|
39
|
-
command = Fission::Command::SnapshotRevert.new @target_vm << 'snap_1'
|
40
|
-
command.execute
|
41
|
-
}.should raise_error SystemExit
|
42
|
-
|
43
|
-
@string_io.string.should match /Unable to find the VM #{@target_vm.first}/
|
44
|
-
end
|
29
|
+
it 'should revert to the snapshot with the provided name' do
|
30
|
+
@snap_revert_response_mock.stub_as_successful
|
45
31
|
|
46
|
-
|
47
|
-
|
48
|
-
Fission::Fusion.should_receive(:is_running?).and_return(false)
|
49
|
-
@vm_mock.should_receive(:snapshots).and_return([])
|
32
|
+
@vm_mock.should_receive(:revert_to_snapshot).with('snap_1').
|
33
|
+
and_return(@snap_revert_response_mock)
|
50
34
|
|
51
|
-
|
52
|
-
|
53
|
-
command.execute
|
54
|
-
}.should raise_error SystemExit
|
35
|
+
command = Fission::Command::SnapshotRevert.new @target_vm << 'snap_1'
|
36
|
+
command.execute
|
55
37
|
|
56
|
-
@string_io.string.should match /
|
38
|
+
@string_io.string.should match /Reverting to snapshot 'snap_1'/
|
39
|
+
@string_io.string.should match /Reverted to snapshot 'snap_1'/
|
57
40
|
end
|
58
41
|
|
59
|
-
it 'should output an error and exit if
|
60
|
-
|
61
|
-
Fission::Fusion.should_receive(:is_running?).and_return(true)
|
62
|
-
|
63
|
-
lambda {
|
64
|
-
command = Fission::Command::SnapshotRevert.new @target_vm << 'snap_1'
|
65
|
-
command.execute
|
66
|
-
}.should raise_error SystemExit
|
42
|
+
it 'should output an error and exit if there was an error reverting to the snapshot' do
|
43
|
+
@snap_revert_response_mock.stub_as_unsuccessful
|
67
44
|
|
68
|
-
@
|
69
|
-
|
70
|
-
end
|
45
|
+
@vm_mock.should_receive(:revert_to_snapshot).with('snap_1').
|
46
|
+
and_return(@snap_revert_response_mock)
|
71
47
|
|
72
|
-
it 'should revert to the snapshot with the provided name' do
|
73
|
-
Fission::VM.should_receive(:exists?).with(@target_vm.first).and_return(true)
|
74
|
-
Fission::Fusion.should_receive(:is_running?).and_return(false)
|
75
|
-
@vm_mock.should_receive(:snapshots).and_return(['snap_1', 'snap_2'])
|
76
|
-
@vm_mock.should_receive(:revert_to_snapshot).with('snap_1')
|
77
48
|
command = Fission::Command::SnapshotRevert.new @target_vm << 'snap_1'
|
78
|
-
command.execute
|
49
|
+
lambda { command.execute }.should raise_error SystemExit
|
50
|
+
|
79
51
|
@string_io.string.should match /Reverting to snapshot 'snap_1'/
|
52
|
+
@string_io.string.should match /There was an error reverting to the snapshot.+it blew up.+/m
|
80
53
|
end
|
54
|
+
|
81
55
|
end
|
82
56
|
|
83
57
|
describe 'help' do
|
84
58
|
it 'should output info for this command' do
|
85
59
|
output = Fission::Command::SnapshotRevert.help
|
86
60
|
|
87
|
-
output.should match /snapshot revert
|
61
|
+
output.should match /snapshot revert vm_name snapshot_1/
|
88
62
|
end
|
89
63
|
end
|
90
64
|
end
|
@@ -1,99 +1,55 @@
|
|
1
1
|
require File.expand_path('../../../spec_helper.rb', __FILE__)
|
2
2
|
|
3
3
|
describe Fission::Command::Start do
|
4
|
-
|
5
|
-
@vm_info = ['foo']
|
6
|
-
@string_io = StringIO.new
|
7
|
-
Fission.stub!(:ui).and_return(Fission::UI.new(@string_io))
|
8
|
-
@vm_mock = mock('vm_mock')
|
9
|
-
end
|
10
|
-
|
11
|
-
describe 'execute' do
|
12
|
-
it "should output an error and the help when no VM argument is passed in" do
|
13
|
-
Fission::Command::Start.should_receive(:help)
|
14
|
-
|
15
|
-
lambda {
|
16
|
-
command = Fission::Command::Start.new
|
17
|
-
command.execute
|
18
|
-
}.should raise_error SystemExit
|
19
|
-
|
20
|
-
@string_io.string.should match /Incorrect arguments for start command/
|
21
|
-
end
|
4
|
+
include_context 'command_setup'
|
22
5
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
lambda {
|
27
|
-
command = Fission::Command::Start.new @vm_info
|
28
|
-
command.execute
|
29
|
-
}.should raise_error SystemExit
|
6
|
+
before do
|
7
|
+
@target_vm = ['foo']
|
8
|
+
Fission::VM.stub(:new).and_return(@vm_mock)
|
30
9
|
|
31
|
-
|
32
|
-
end
|
10
|
+
@start_response_mock = mock('start_response')
|
33
11
|
|
12
|
+
@vm_mock.stub(:name).and_return(@target_vm.first)
|
13
|
+
end
|
34
14
|
|
35
|
-
|
36
|
-
|
37
|
-
Fission::VM.should_receive(:all_running).and_return(@vm_info)
|
15
|
+
describe 'execute' do
|
16
|
+
subject { Fission::Command::Start }
|
38
17
|
|
39
|
-
|
40
|
-
command = Fission::Command::Start.new @vm_info
|
41
|
-
command.execute
|
42
|
-
}.should raise_error SystemExit
|
18
|
+
it_should_not_accept_arguments_of [], 'start'
|
43
19
|
|
44
|
-
|
45
|
-
|
20
|
+
it 'should output an error and exit if there was an error starting the vm' do
|
21
|
+
@start_response_mock.stub_as_unsuccessful
|
46
22
|
|
47
|
-
|
48
|
-
Fission::VM.should_receive(:exists?).with(@vm_info.first).and_return(true)
|
49
|
-
Fission::VM.should_receive(:all_running).and_return([])
|
50
|
-
Fission::VM.should_receive(:new).with(@vm_info.first).and_return(@vm_mock)
|
51
|
-
@vm_mock.should_receive(:start)
|
23
|
+
@vm_mock.should_receive(:start).and_return(@start_response_mock)
|
52
24
|
|
53
|
-
command = Fission::Command::Start.new @
|
54
|
-
command.execute
|
25
|
+
command = Fission::Command::Start.new @target_vm
|
26
|
+
lambda { command.execute }.should raise_error SystemExit
|
55
27
|
|
56
|
-
@string_io.string.should match /Starting '#{@
|
28
|
+
@string_io.string.should match /Starting '#{@target_vm.first}'/
|
29
|
+
@string_io.string.should match /There was a problem starting the VM.+it blew up.+/m
|
57
30
|
end
|
58
31
|
|
59
32
|
describe 'with --headless' do
|
60
33
|
it 'should start the vm headless' do
|
61
|
-
|
62
|
-
Fission::VM.should_receive(:exists?).with(@vm_info.first).and_return(true)
|
63
|
-
Fission::VM.should_receive(:all_running).and_return([])
|
64
|
-
Fission::VM.should_receive(:new).with(@vm_info.first).and_return(@vm_mock)
|
65
|
-
@vm_mock.should_receive(:start).with(:headless => true)
|
34
|
+
@start_response_mock.stub_as_successful
|
66
35
|
|
67
|
-
|
68
|
-
command.execute
|
36
|
+
@vm_mock.should_receive(:start).and_return(@start_response_mock)
|
69
37
|
|
70
|
-
|
71
|
-
|
38
|
+
command = Fission::Command::Start.new @target_vm << '--headless'
|
39
|
+
command.execute
|
72
40
|
|
73
|
-
|
74
|
-
|
75
|
-
Fission::VM.should_receive(:exists?).with(@vm_info.first).and_return(true)
|
76
|
-
Fission::VM.should_receive(:all_running).and_return([])
|
77
|
-
Fission::VM.should_receive(:new).with(@vm_info.first).and_return(@vm_mock)
|
78
|
-
@vm_mock.should_not_receive(:start)
|
79
|
-
|
80
|
-
lambda {
|
81
|
-
command = Fission::Command::Start.new @vm_info << '--headless'
|
82
|
-
command.execute
|
83
|
-
}.should raise_error SystemExit
|
84
|
-
|
85
|
-
@string_io.string.should match /Fusion GUI is currently running/
|
86
|
-
@string_io.string.should match /A VM cannot be started in headless mode when the Fusion GUI is running/
|
87
|
-
@string_io.string.should match /Exit the Fusion GUI and try again/
|
41
|
+
@string_io.string.should match /Starting '#{@target_vm.first}'/
|
42
|
+
@string_io.string.should match /VM '#{@target_vm.first}' started/
|
88
43
|
end
|
89
44
|
end
|
45
|
+
|
90
46
|
end
|
91
47
|
|
92
48
|
describe 'help' do
|
93
49
|
it 'should output info for this command' do
|
94
50
|
output = Fission::Command::Start.help
|
95
51
|
|
96
|
-
output.should match /start
|
52
|
+
output.should match /start vm_name \[options\]/
|
97
53
|
output.should match /--headless/
|
98
54
|
end
|
99
55
|
end
|
@@ -1,30 +1,65 @@
|
|
1
1
|
require File.expand_path('../../../spec_helper.rb', __FILE__)
|
2
2
|
|
3
3
|
describe Fission::Command::Status do
|
4
|
+
include_context 'command_setup'
|
5
|
+
|
4
6
|
before do
|
5
|
-
@
|
6
|
-
Fission
|
7
|
+
@all_response_mock = mock('response')
|
8
|
+
@vm_1 = Fission::VM.new 'foo'
|
9
|
+
@vm_2 = Fission::VM.new 'bar'
|
10
|
+
@vm_3 = Fission::VM.new 'baz'
|
11
|
+
@vm_4 = Fission::VM.new 'blah'
|
7
12
|
end
|
8
13
|
|
9
14
|
describe 'execute' do
|
10
15
|
before do
|
11
|
-
|
12
|
-
|
16
|
+
@all_response_mock.stub_as_successful [@vm_1, @vm_2, @vm_3, @vm_4]
|
17
|
+
|
18
|
+
Fission::VM.should_receive(:all).and_return(@all_response_mock)
|
19
|
+
Fission::VM.stub(:all_running).and_return(@all_running_response_mock)
|
13
20
|
end
|
14
21
|
|
15
|
-
|
16
|
-
|
17
|
-
|
22
|
+
describe 'when successful' do
|
23
|
+
before do
|
24
|
+
@all_running_response_mock.stub_as_successful [@vm_1, @vm_3]
|
25
|
+
end
|
26
|
+
|
27
|
+
it 'should output the VMs which are running' do
|
28
|
+
command = Fission::Command::Status.new
|
29
|
+
command.execute
|
30
|
+
|
31
|
+
@string_io.string.should match /foo.+\[running\]/
|
32
|
+
@string_io.string.should match /baz.+\[running\]/
|
33
|
+
end
|
34
|
+
|
35
|
+
it 'should output the VMs which are not running' do
|
36
|
+
command = Fission::Command::Status.new
|
37
|
+
command.execute
|
38
|
+
|
39
|
+
@string_io.string.should match /bar.+\[not running\]/
|
40
|
+
end
|
41
|
+
|
42
|
+
it 'should output the VMs which are suspended' do
|
43
|
+
@vm_4.stub(:suspend_file_exists?).and_return(true)
|
44
|
+
command = Fission::Command::Status.new
|
45
|
+
command.execute
|
46
|
+
|
47
|
+
@string_io.string.should match /blah.+\[suspended\]/
|
48
|
+
end
|
18
49
|
|
19
|
-
@string_io.string.should match /foo.+[running]/
|
20
|
-
@string_io.string.should match /baz.+[running]/
|
21
50
|
end
|
22
51
|
|
23
|
-
|
24
|
-
|
25
|
-
|
52
|
+
describe 'when unsuccessful' do
|
53
|
+
before do
|
54
|
+
@all_running_response_mock.stub_as_unsuccessful
|
55
|
+
end
|
56
|
+
|
57
|
+
it 'should output an error and exit if there was an error getting the list of running VMs' do
|
58
|
+
command = Fission::Command::Status.new
|
59
|
+
lambda { command.execute }.should raise_error SystemExit
|
26
60
|
|
27
|
-
|
61
|
+
@string_io.string.should match /There was an error getting the list of running VMs.+it blew up/m
|
62
|
+
end
|
28
63
|
end
|
29
64
|
end
|
30
65
|
|
@@ -1,68 +1,51 @@
|
|
1
1
|
require File.expand_path('../../../spec_helper.rb', __FILE__)
|
2
2
|
|
3
3
|
describe Fission::Command::Stop do
|
4
|
+
include_context 'command_setup'
|
5
|
+
|
4
6
|
before do
|
5
|
-
@
|
6
|
-
|
7
|
-
|
7
|
+
@target_vm = ['foo']
|
8
|
+
Fission::VM.stub(:new).and_return(@vm_mock)
|
9
|
+
|
10
|
+
@stop_response_mock = mock('stop_response')
|
11
|
+
|
12
|
+
@vm_mock.stub(:name).and_return(@target_vm.first)
|
8
13
|
end
|
9
14
|
|
10
15
|
describe 'execute' do
|
11
|
-
|
12
|
-
Fission::Command::Stop.should_receive(:help)
|
16
|
+
subject { Fission::Command::Stop }
|
13
17
|
|
14
|
-
|
15
|
-
command = Fission::Command::Stop.new
|
16
|
-
command.execute
|
17
|
-
}.should raise_error SystemExit
|
18
|
+
it_should_not_accept_arguments_of [], 'stop'
|
18
19
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
it "should output an error and exit if it can't find the vm" do
|
23
|
-
Fission::VM.should_receive(:exists?).with(@vm_info.first).and_return(false)
|
20
|
+
it 'should stop the vm' do
|
21
|
+
@stop_response_mock.should_receive(:successful?).and_return(true)
|
22
|
+
@vm_mock.should_receive(:stop).and_return(@stop_response_mock)
|
24
23
|
|
25
|
-
|
26
|
-
|
27
|
-
command.execute
|
28
|
-
}.should raise_error SystemExit
|
24
|
+
command = Fission::Command::Stop.new @target_vm
|
25
|
+
command.execute
|
29
26
|
|
30
|
-
@string_io.string.should match /
|
27
|
+
@string_io.string.should match /Stopping '#{@target_vm.first}'/
|
28
|
+
@string_io.string.should match /VM '#{@target_vm.first}' stopped/
|
31
29
|
end
|
32
30
|
|
31
|
+
it 'should output an error and exit if there was an error stopping the vm' do
|
32
|
+
@stop_response_mock.stub_as_unsuccessful
|
33
33
|
|
34
|
-
|
35
|
-
Fission::VM.should_receive(:exists?).with(@vm_info.first).and_return(true)
|
36
|
-
Fission::VM.should_receive(:all_running).and_return([])
|
34
|
+
@vm_mock.should_receive(:stop).and_return(@stop_response_mock)
|
37
35
|
|
38
|
-
|
39
|
-
|
40
|
-
command.execute
|
41
|
-
}.should raise_error SystemExit
|
36
|
+
command = Fission::Command::Stop.new @target_vm
|
37
|
+
lambda { command.execute }.should raise_error SystemExit
|
42
38
|
|
43
|
-
@string_io.string.should match /
|
39
|
+
@string_io.string.should match /Stopping '#{@target_vm.first}'/
|
40
|
+
@string_io.string.should match /There was an error stopping the VM.+it blew up.+/m
|
44
41
|
end
|
45
|
-
|
46
|
-
it 'should try to stop the vm if it is not running' do
|
47
|
-
@vm_mock = mock('vm_mock')
|
48
|
-
Fission::VM.should_receive(:exists?).with(@vm_info.first).and_return(true)
|
49
|
-
Fission::VM.should_receive(:all_running).and_return(@vm_info)
|
50
|
-
Fission::VM.should_receive(:new).with(@vm_info.first).and_return(@vm_mock)
|
51
|
-
@vm_mock.should_receive(:stop)
|
52
|
-
|
53
|
-
command = Fission::Command::Stop.new @vm_info
|
54
|
-
command.execute
|
55
|
-
|
56
|
-
@string_io.string.should match /Stopping '#{@vm_info.first}'/
|
57
|
-
end
|
58
|
-
|
59
42
|
end
|
60
43
|
|
61
44
|
describe 'help' do
|
62
45
|
it 'should output info for this command' do
|
63
46
|
output = Fission::Command::Stop.help
|
64
47
|
|
65
|
-
output.should match /stop
|
48
|
+
output.should match /stop vm_name/
|
66
49
|
end
|
67
50
|
end
|
68
51
|
end
|