fission 0.4.0 → 0.5.0.beta.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (79) hide show
  1. data/.ruby-gemset +1 -0
  2. data/.ruby-version +1 -0
  3. data/.travis.yml +7 -0
  4. data/CHANGELOG.md +12 -3
  5. data/README.md +45 -19
  6. data/bin/fission +1 -1
  7. data/fission.gemspec +3 -2
  8. data/lib/fission.rb +15 -0
  9. data/lib/fission/action/shell_executor.rb +37 -0
  10. data/lib/fission/action/snapshot/creator.rb +81 -0
  11. data/lib/fission/action/snapshot/deleter.rb +85 -0
  12. data/lib/fission/action/snapshot/lister.rb +90 -0
  13. data/lib/fission/action/snapshot/reverter.rb +81 -0
  14. data/lib/fission/action/vm/cloner.rb +191 -0
  15. data/lib/fission/action/vm/deleter.rb +73 -0
  16. data/lib/fission/action/vm/lister.rb +138 -0
  17. data/lib/fission/action/vm/starter.rb +88 -0
  18. data/lib/fission/action/vm/stopper.rb +79 -0
  19. data/lib/fission/action/vm/suspender.rb +68 -0
  20. data/lib/fission/cli.rb +21 -117
  21. data/lib/fission/command.rb +39 -0
  22. data/lib/fission/command/clone.rb +11 -6
  23. data/lib/fission/command/delete.rb +11 -6
  24. data/lib/fission/command/info.rb +62 -0
  25. data/lib/fission/command/snapshot_create.rb +9 -3
  26. data/lib/fission/command/snapshot_delete.rb +38 -0
  27. data/lib/fission/command/snapshot_list.rb +9 -3
  28. data/lib/fission/command/snapshot_revert.rb +9 -3
  29. data/lib/fission/command/start.rb +11 -6
  30. data/lib/fission/command/status.rb +9 -1
  31. data/lib/fission/command/stop.rb +9 -3
  32. data/lib/fission/command/suspend.rb +11 -6
  33. data/lib/fission/command_helpers.rb +18 -4
  34. data/lib/fission/command_line_parser.rb +189 -0
  35. data/lib/fission/config.rb +1 -1
  36. data/lib/fission/fusion.rb +3 -4
  37. data/lib/fission/lease.rb +2 -1
  38. data/lib/fission/metadata.rb +6 -1
  39. data/lib/fission/response.rb +17 -9
  40. data/lib/fission/version.rb +1 -1
  41. data/lib/fission/vm.rb +142 -382
  42. data/lib/fission/vm_configuration.rb +79 -0
  43. data/spec/fission/action/execute_shell_command_spec.rb +25 -0
  44. data/spec/fission/action/snapshot/creator_spec.rb +77 -0
  45. data/spec/fission/action/snapshot/deleter_spec.rb +84 -0
  46. data/spec/fission/action/snapshot/lister_spec.rb +67 -0
  47. data/spec/fission/action/snapshot/reverter_spec.rb +76 -0
  48. data/spec/fission/action/vm/cloner_spec.rb +198 -0
  49. data/spec/fission/action/vm/deleter_spec.rb +79 -0
  50. data/spec/fission/action/vm/lister_spec.rb +164 -0
  51. data/spec/fission/action/vm/starter_spec.rb +88 -0
  52. data/spec/fission/action/vm/stopper_spec.rb +71 -0
  53. data/spec/fission/action/vm/suspender_spec.rb +59 -0
  54. data/spec/fission/cli_spec.rb +32 -157
  55. data/spec/fission/command/clone_spec.rb +9 -3
  56. data/spec/fission/command/delete_spec.rb +11 -3
  57. data/spec/fission/command/info_spec.rb +130 -0
  58. data/spec/fission/command/snapshot_create_spec.rb +11 -3
  59. data/spec/fission/command/snapshot_delete_spec.rb +74 -0
  60. data/spec/fission/command/snapshot_list_spec.rb +11 -3
  61. data/spec/fission/command/snapshot_revert_spec.rb +11 -3
  62. data/spec/fission/command/start_spec.rb +11 -3
  63. data/spec/fission/command/status_spec.rb +16 -5
  64. data/spec/fission/command/stop_spec.rb +11 -3
  65. data/spec/fission/command/suspend_spec.rb +11 -3
  66. data/spec/fission/command_helpers_spec.rb +27 -5
  67. data/spec/fission/command_line_parser_spec.rb +267 -0
  68. data/spec/fission/command_spec.rb +16 -1
  69. data/spec/fission/config_spec.rb +3 -3
  70. data/spec/fission/fusion_spec.rb +11 -6
  71. data/spec/fission/lease_spec.rb +81 -45
  72. data/spec/fission/metadata_spec.rb +29 -6
  73. data/spec/fission/response_spec.rb +20 -9
  74. data/spec/fission/ui_spec.rb +1 -1
  75. data/spec/fission/vm_configuration_spec.rb +132 -0
  76. data/spec/fission/vm_spec.rb +393 -750
  77. data/spec/helpers/command_helpers.rb +1 -1
  78. metadata +93 -15
  79. data/.rvmrc +0 -1
@@ -1,4 +1,4 @@
1
- require File.expand_path('../../../spec_helper.rb', __FILE__)
1
+ require 'spec_helper'
2
2
 
3
3
  describe Fission::Command::SnapshotList do
4
4
  include_context 'command_setup'
@@ -12,6 +12,12 @@ describe Fission::Command::SnapshotList do
12
12
  @vm_mock.stub(:name).and_return(@target_vm.first)
13
13
  end
14
14
 
15
+ describe 'command_name' do
16
+ it 'should return the pretty command name' do
17
+ Fission::Command::SnapshotList.new.command_name.should == 'snapshot list'
18
+ end
19
+ end
20
+
15
21
  describe 'execute' do
16
22
  before do
17
23
  @vm_mock.stub(:snapshots).and_return(@snap_list_response_mock)
@@ -19,7 +25,9 @@ describe Fission::Command::SnapshotList do
19
25
 
20
26
  subject { Fission::Command::SnapshotList }
21
27
 
22
- it_should_not_accept_arguments_of [], 'snapshot list'
28
+ [ [], ['--bar'] ].each do |args|
29
+ it_should_not_accept_arguments_of args, 'snapshot list'
30
+ end
23
31
 
24
32
  it 'should output the list of snapshots if any exist' do
25
33
  @snap_list_response_mock.stub_as_successful ['snap 1', 'snap 2', 'snap 3']
@@ -54,7 +62,7 @@ describe Fission::Command::SnapshotList do
54
62
  it 'should output info for this command' do
55
63
  output = Fission::Command::SnapshotList.help
56
64
 
57
- output.should match /snapshot list vm_name/
65
+ output.should match /fission snapshot list TARGET_VM/
58
66
  end
59
67
  end
60
68
  end
@@ -1,4 +1,4 @@
1
- require File.expand_path('../../../spec_helper.rb', __FILE__)
1
+ require 'spec_helper'
2
2
 
3
3
  describe Fission::Command::SnapshotRevert do
4
4
  include_context 'command_setup'
@@ -12,10 +12,18 @@ describe Fission::Command::SnapshotRevert do
12
12
  @vm_mock.stub(:name).and_return(@target_vm.first)
13
13
  end
14
14
 
15
+ describe 'command_name' do
16
+ it 'should return the pretty command name' do
17
+ Fission::Command::SnapshotRevert.new.command_name.should == 'snapshot revert'
18
+ end
19
+ end
20
+
15
21
  describe 'execute' do
16
22
  subject { Fission::Command::SnapshotRevert }
17
23
 
18
- it_should_not_accept_arguments_of [], 'snapshot revert'
24
+ [ [], ['foo'], ['--bar'] ].each do |args|
25
+ it_should_not_accept_arguments_of args, 'snapshot revert'
26
+ end
19
27
 
20
28
  it "should output an error and the help when no snapshot name is passed in" do
21
29
  Fission::Command::SnapshotRevert.should_receive(:help)
@@ -58,7 +66,7 @@ describe Fission::Command::SnapshotRevert do
58
66
  it 'should output info for this command' do
59
67
  output = Fission::Command::SnapshotRevert.help
60
68
 
61
- output.should match /snapshot revert vm_name snapshot_1/
69
+ output.should match /fission snapshot revert TARGET_VM TARGET_SNAPSHOT/
62
70
  end
63
71
  end
64
72
  end
@@ -1,4 +1,4 @@
1
- require File.expand_path('../../../spec_helper.rb', __FILE__)
1
+ require 'spec_helper'
2
2
 
3
3
  describe Fission::Command::Start do
4
4
  include_context 'command_setup'
@@ -12,10 +12,18 @@ describe Fission::Command::Start do
12
12
  @vm_mock.stub(:name).and_return(@target_vm.first)
13
13
  end
14
14
 
15
+ describe 'command_name' do
16
+ it 'should return the pretty command name' do
17
+ Fission::Command::Start.new.command_name.should == 'start'
18
+ end
19
+ end
20
+
15
21
  describe 'execute' do
16
22
  subject { Fission::Command::Start }
17
23
 
18
- it_should_not_accept_arguments_of [], 'start'
24
+ [ [], ['--bar'] ].each do |args|
25
+ it_should_not_accept_arguments_of args, 'start'
26
+ end
19
27
 
20
28
  it 'should output an error and exit if there was an error starting the vm' do
21
29
  @start_response_mock.stub_as_unsuccessful
@@ -49,7 +57,7 @@ describe Fission::Command::Start do
49
57
  it 'should output info for this command' do
50
58
  output = Fission::Command::Start.help
51
59
 
52
- output.should match /start vm_name \[options\]/
60
+ output.should match /fission start TARGET_VM \[OPTIONS\]/
53
61
  output.should match /--headless/
54
62
  end
55
63
  end
@@ -1,4 +1,4 @@
1
- require File.expand_path('../../../spec_helper.rb', __FILE__)
1
+ require 'spec_helper'
2
2
 
3
3
  describe Fission::Command::Status do
4
4
  include_context 'command_setup'
@@ -10,15 +10,24 @@ describe Fission::Command::Status do
10
10
  @all_status_response_mock = mock('response')
11
11
  end
12
12
 
13
+ describe 'command_name' do
14
+ it 'should return the pretty command name' do
15
+ Fission::Command::Status.new.command_name.should == 'status'
16
+ end
17
+ end
18
+
13
19
  describe 'execute' do
14
- before do
15
- Fission::VM.should_receive(:all_with_status).
16
- and_return(@all_status_response_mock)
20
+ subject { Fission::Command::Status }
21
+
22
+ [ ['--bar'] ].each do |args|
23
+ it_should_not_accept_arguments_of args, 'status'
17
24
  end
18
25
 
19
26
  describe 'when successful' do
20
27
  before do
21
28
  @all_status_response_mock.stub_as_successful @vms_status
29
+ Fission::VM.should_receive(:all_with_status).
30
+ and_return(@all_status_response_mock)
22
31
  end
23
32
 
24
33
  it 'should output the VMs and their status' do
@@ -34,6 +43,8 @@ describe Fission::Command::Status do
34
43
  describe 'when unsuccessful' do
35
44
  before do
36
45
  @all_status_response_mock.stub_as_unsuccessful
46
+ Fission::VM.should_receive(:all_with_status).
47
+ and_return(@all_status_response_mock)
37
48
  end
38
49
 
39
50
  it 'should output an error and exit if there was an error getting the list of running VMs' do
@@ -49,7 +60,7 @@ describe Fission::Command::Status do
49
60
  it 'should output info for this command' do
50
61
  output = Fission::Command::Status.help
51
62
 
52
- output.should match /status/
63
+ output.should match /fission status/
53
64
  end
54
65
  end
55
66
  end
@@ -1,4 +1,4 @@
1
- require File.expand_path('../../../spec_helper.rb', __FILE__)
1
+ require 'spec_helper'
2
2
 
3
3
  describe Fission::Command::Stop do
4
4
  include_context 'command_setup'
@@ -12,10 +12,18 @@ describe Fission::Command::Stop do
12
12
  @vm_mock.stub(:name).and_return(@target_vm.first)
13
13
  end
14
14
 
15
+ describe 'command_name' do
16
+ it 'should return the pretty command name' do
17
+ Fission::Command::Stop.new.command_name.should == 'stop'
18
+ end
19
+ end
20
+
15
21
  describe 'execute' do
16
22
  subject { Fission::Command::Stop }
17
23
 
18
- it_should_not_accept_arguments_of [], 'stop'
24
+ [ [], ['--bar'] ].each do |args|
25
+ it_should_not_accept_arguments_of args, 'stop'
26
+ end
19
27
 
20
28
  it 'should stop the vm' do
21
29
  @stop_response_mock.should_receive(:successful?).and_return(true)
@@ -45,7 +53,7 @@ describe Fission::Command::Stop do
45
53
  it 'should output info for this command' do
46
54
  output = Fission::Command::Stop.help
47
55
 
48
- output.should match /stop vm_name/
56
+ output.should match /fission stop TARGET_VM/
49
57
  end
50
58
  end
51
59
  end
@@ -1,4 +1,4 @@
1
- require File.expand_path('../../../spec_helper.rb', __FILE__)
1
+ require 'spec_helper'
2
2
 
3
3
  describe Fission::Command::Suspend do
4
4
  include_context 'command_setup'
@@ -12,10 +12,18 @@ describe Fission::Command::Suspend do
12
12
  @vm_mock.stub(:name).and_return(@target_vm.first)
13
13
  end
14
14
 
15
+ describe 'command_name' do
16
+ it 'should return the pretty command name' do
17
+ Fission::Command::Suspend.new.command_name.should == 'suspend'
18
+ end
19
+ end
20
+
15
21
  describe 'execute' do
16
22
  subject { Fission::Command::Suspend }
17
23
 
18
- it_should_not_accept_arguments_of [], 'suspend'
24
+ [ [], ['--bar'] ].each do |args|
25
+ it_should_not_accept_arguments_of args, 'suspend'
26
+ end
19
27
 
20
28
  it 'should suspend the vm' do
21
29
  @suspend_response_mock.stub_as_successful
@@ -91,7 +99,7 @@ describe Fission::Command::Suspend do
91
99
  it 'should output info for this command' do
92
100
  output = Fission::Command::Suspend.help
93
101
 
94
- output.should match /suspend \[vm_name \| --all\]/
102
+ output.should match /fission suspend \[TARGET_VM \| --all\]/
95
103
  end
96
104
  end
97
105
  end
@@ -1,4 +1,4 @@
1
- require File.expand_path('../../spec_helper.rb', __FILE__)
1
+ require 'spec_helper'
2
2
 
3
3
  describe Fission::CommandHelpers do
4
4
  include_context 'command_setup'
@@ -6,24 +6,46 @@ describe Fission::CommandHelpers do
6
6
  before do
7
7
  @object = Object.new
8
8
  @object.extend Fission::CommandHelpers
9
+ @object.class.stub(:help).and_return('foo help')
9
10
  end
10
11
 
11
12
  describe 'incorrect_arguments' do
12
13
  before do
13
- @object.class.should_receive(:help).and_return('foo help')
14
+ @object.stub(:command_name)
14
15
  @object.stub(:output)
15
16
  @object.stub(:output_and_exit)
16
17
  end
17
18
 
18
19
  it "should output the command's help text" do
19
- @object.should_receive(:output).with("foo help\n")
20
- @object.incorrect_arguments 'delete'
20
+ @object.stub(:command_name)
21
+ @object.should_receive(:output).with(/foo help/)
22
+ @object.incorrect_arguments
21
23
  end
22
24
 
23
25
  it 'should output that the argumets are incorrect and exit' do
26
+ @object.stub(:command_name).and_return('delete')
24
27
  @object.should_receive(:output_and_exit).
25
28
  with('Incorrect arguments for delete command', 1)
26
- @object.incorrect_arguments 'delete'
29
+ @object.incorrect_arguments
30
+ end
31
+ end
32
+
33
+ describe 'parse arguments' do
34
+ before do
35
+ @object.stub(:option_parser).and_return(@object)
36
+ end
37
+
38
+ it 'should parse the arguments' do
39
+ @object.stub :parse!
40
+ @object.parse_arguments
41
+ end
42
+
43
+ it 'should output the error with help' do
44
+ error = OptionParser::InvalidOption.new 'bar is invalid'
45
+ @object.should_receive(:output).with(error)
46
+ @object.should_receive(:output_and_exit).with(/foo help/, 1)
47
+ @object.stub(:parse!).and_raise(error)
48
+ @object.parse_arguments
27
49
  end
28
50
  end
29
51
 
@@ -0,0 +1,267 @@
1
+ require 'spec_helper'
2
+
3
+ describe Fission::CommandLineParser do
4
+ before do
5
+ @string_io = StringIO.new
6
+ Fission::CommandLineParser.any_instance.
7
+ stub(:ui).
8
+ and_return(Fission::UI.new(@string_io))
9
+ end
10
+
11
+ describe 'initialize' do
12
+ it 'should set command to nil' do
13
+ Fission::CommandLineParser.new.command.should be_nil
14
+ end
15
+ end
16
+
17
+ describe 'parse' do
18
+ context 'with no initial arguments' do
19
+ it 'should output the usage info' do
20
+ lambda {
21
+ Fission::CommandLineParser.new([]).parse
22
+ }.should raise_error SystemExit
23
+ @string_io.string.should match /Usage/
24
+ end
25
+ end
26
+
27
+ context 'with -v or --version initial arguments' do
28
+ ['-v', '--version'].each do |arg|
29
+ it "should output the version with #{arg}" do
30
+ lambda {
31
+ Fission::CommandLineParser.new([arg]).parse
32
+ }.should raise_error SystemExit
33
+
34
+ @string_io.string.should match /#{Fission::VERSION}/
35
+ end
36
+ end
37
+ end
38
+
39
+ context 'with -h or --help initial arguments' do
40
+ ['-h', '--help'].each do |arg|
41
+ it "should output the usage info with #{arg}" do
42
+ lambda {
43
+ Fission::CommandLineParser.new([arg]).parse
44
+ }.should raise_error SystemExit
45
+
46
+ @string_io.string.should match /Usage/
47
+ end
48
+ end
49
+ end
50
+
51
+ context 'with an invalid sub command' do
52
+ it 'should display the help' do
53
+ lambda {
54
+ Fission::CommandLineParser.new(['foo', 'bar']).parse
55
+ }.should raise_error SystemExit
56
+
57
+ @string_io.string.should match /Usage/
58
+ end
59
+ end
60
+
61
+ context 'with a valid sub command' do
62
+ before do
63
+ @cmd_mock = mock 'command', :summary => ''
64
+ end
65
+
66
+ [ ['clone'],
67
+ ['delete'],
68
+ ['snapshot', 'create'],
69
+ ['snapshot', 'delete'],
70
+ ['snapshot', 'list'],
71
+ ['snapshot', 'revert'],
72
+ ['start'],
73
+ ['status'],
74
+ ['stop'],
75
+ ['suspend']
76
+ ].each do |command|
77
+ it "should accept #{command}" do
78
+ Fission::CommandLineParser.new(command).parse
79
+ end
80
+
81
+ it "should populate @command with an instance of the '#{command.join(' ')}' class" do
82
+ klass = command.map { |c| c.capitalize }.join('')
83
+ parser = Fission::CommandLineParser.new(command).parse
84
+ parser.command.should be_an_instance_of Fission::Command.const_get klass
85
+ end
86
+ end
87
+
88
+ context 'clone' do
89
+ before do
90
+ @cmd_mock.stub(:command_name).and_return('clone')
91
+ Fission::Command::Clone.should_receive(:new).and_return(@cmd_mock)
92
+ end
93
+
94
+ it 'should create the command' do
95
+ Fission::Command::Clone.should_receive(:new).
96
+ with(['foo', 'bar'])
97
+ Fission::CommandLineParser.new(['clone', 'foo', 'bar']).parse
98
+ end
99
+
100
+ context 'with --start' do
101
+ it 'should create the command with the start option' do
102
+ Fission::Command::Clone.should_receive(:new).
103
+ with(['foo', 'bar', '--start'])
104
+ Fission::CommandLineParser.new(['clone', 'foo', 'bar', '--start']).parse
105
+ end
106
+ end
107
+
108
+ end
109
+
110
+ context 'delete' do
111
+ before do
112
+ @cmd_mock.stub(:command_name).and_return('delete')
113
+ Fission::Command::Delete.should_receive(:new).and_return(@cmd_mock)
114
+ end
115
+
116
+ it 'should create the command' do
117
+ Fission::Command::Delete.should_receive(:new).
118
+ with(['foo'])
119
+ Fission::CommandLineParser.new(['delete', 'foo']).parse
120
+ end
121
+
122
+ context 'with --force' do
123
+ it 'should create the command with the force option' do
124
+ Fission::Command::Delete.should_receive(:new).
125
+ with(['foo', '--force'])
126
+ Fission::CommandLineParser.new(['delete', 'foo', '--force']).parse
127
+ end
128
+ end
129
+
130
+ end
131
+
132
+ context 'snapshot create' do
133
+ before do
134
+ @cmd_mock.stub(:command_name).and_return('snapshot create')
135
+ Fission::Command::SnapshotCreate.should_receive(:new).and_return(@cmd_mock)
136
+ end
137
+
138
+ it 'should create the command' do
139
+ Fission::Command::SnapshotCreate.should_receive(:new).
140
+ with(['foo', 'bar'])
141
+ Fission::CommandLineParser.new(['snapshot', 'create', 'foo', 'bar']).parse
142
+ end
143
+ end
144
+
145
+ context 'snapshot delete' do
146
+ before do
147
+ @cmd_mock.stub(:command_name).and_return('snapshot delete')
148
+ Fission::Command::SnapshotDelete.should_receive(:new).and_return(@cmd_mock)
149
+ end
150
+
151
+ it 'should create the command' do
152
+ Fission::Command::SnapshotDelete.should_receive(:new).
153
+ with(['foo', 'bar'])
154
+ Fission::CommandLineParser.new(['snapshot', 'delete', 'foo', 'bar']).parse
155
+ end
156
+ end
157
+
158
+ context 'snapshot list' do
159
+ before do
160
+ @cmd_mock.stub(:command_name).and_return('snapshot list')
161
+ Fission::Command::SnapshotList.should_receive(:new).and_return(@cmd_mock)
162
+ end
163
+
164
+ it 'should create the command' do
165
+ Fission::Command::SnapshotList.should_receive(:new).
166
+ with(['foo'])
167
+ Fission::CommandLineParser.new(['snapshot', 'list', 'foo']).parse
168
+ end
169
+ end
170
+
171
+ context 'snapshot revert' do
172
+ before do
173
+ @cmd_mock.stub(:command_name).and_return('snapshot revert')
174
+ Fission::Command::SnapshotRevert.should_receive(:new).and_return(@cmd_mock)
175
+ end
176
+
177
+ it 'should create the command' do
178
+ Fission::Command::SnapshotRevert.should_receive(:new).
179
+ with(['foo', 'bar'])
180
+ Fission::CommandLineParser.new(['snapshot', 'revert', 'foo', 'bar']).parse
181
+ end
182
+ end
183
+
184
+ context 'start' do
185
+ before do
186
+ @cmd_mock.stub(:command_name).and_return('start')
187
+ Fission::Command::Start.should_receive(:new).and_return(@cmd_mock)
188
+ end
189
+
190
+ it 'should create the command' do
191
+ Fission::Command::Start.should_receive(:new).
192
+ with(['foo'])
193
+ Fission::CommandLineParser.new(['start', 'foo']).parse
194
+ end
195
+
196
+ context 'with --headless' do
197
+ it 'should create the command with the force option' do
198
+ Fission::Command::Start.should_receive(:new).
199
+ with(['foo', '--headless'])
200
+ Fission::CommandLineParser.new(['start', 'foo', '--headless']).parse
201
+ end
202
+ end
203
+
204
+ end
205
+
206
+ context 'status' do
207
+ before do
208
+ @cmd_mock.stub(:command_name).and_return('status')
209
+ Fission::Command::Status.should_receive(:new).and_return(@cmd_mock)
210
+ end
211
+
212
+ it 'should create the command' do
213
+ Fission::Command::Status.should_receive(:new).
214
+ with([])
215
+ Fission::CommandLineParser.new(['status']).parse
216
+ end
217
+ end
218
+
219
+ context 'stop' do
220
+ before do
221
+ @cmd_mock.stub(:command_name).and_return('stop')
222
+ Fission::Command::Stop.should_receive(:new).and_return(@cmd_mock)
223
+ end
224
+
225
+ it 'should create the command' do
226
+ Fission::Command::Stop.should_receive(:new).
227
+ with(['foo'])
228
+ Fission::CommandLineParser.new(['stop', 'foo']).parse
229
+ end
230
+
231
+ context 'with --force' do
232
+ it 'should create the command with the force option' do
233
+ Fission::Command::Stop.should_receive(:new).
234
+ with(['foo', '--force'])
235
+ Fission::CommandLineParser.new(['stop', 'foo', '--force']).parse
236
+ end
237
+ end
238
+
239
+ end
240
+
241
+ context 'suspend' do
242
+ before do
243
+ @cmd_mock.stub(:command_name).and_return('suspend')
244
+ Fission::Command::Suspend.should_receive(:new).and_return(@cmd_mock)
245
+ end
246
+
247
+ it 'should create the command' do
248
+ Fission::Command::Suspend.should_receive(:new).
249
+ with(['foo'])
250
+ Fission::CommandLineParser.new(['suspend', 'foo']).parse
251
+ end
252
+
253
+ context 'with --all' do
254
+ it 'should create the command with the all option' do
255
+ Fission::Command::Suspend.should_receive(:new).
256
+ with(['--all'])
257
+ Fission::CommandLineParser.new(['suspend', '--all']).parse
258
+ end
259
+ end
260
+
261
+ end
262
+
263
+ end
264
+
265
+ end
266
+
267
+ end