Skip to content

Commit

Permalink
Fix specs
Browse files Browse the repository at this point in the history
  • Loading branch information
Kimmo Lehto committed Feb 1, 2017
1 parent 6519e00 commit a8e0a25
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion cli/lib/kontena/cli/stacks/upgrade_command.rb
Expand Up @@ -29,7 +29,7 @@ def execute
update_stack(stack) || spin.fail!
end

Kontena.run("stack deploy #{name}") if deploy?
Kontena.run(['stack', 'deploy', name]) if deploy?
end

def update_stack(stack)
Expand Down
6 changes: 4 additions & 2 deletions cli/spec/kontena/cli/stacks/upgrade_command_spec.rb
Expand Up @@ -72,23 +72,25 @@
end

it 'triggers deploy by default' do
expect(client).to receive(:get).with('stacks/test-grid/stack-a').and_return(stack_response)
allow(subject).to receive(:require_config_file).with('./path/to/kontena.yml').and_return(true)
allow(subject).to receive(:stack_from_yaml).with('./path/to/kontena.yml', name: 'stack-a', values: nil, from_registry: false, defaults: defaults).and_return(stack)
allow(client).to receive(:put).with(
'stacks/test-grid/stack-a', anything
).and_return({})
expect(Kontena).to receive(:run).with("stack deploy stack-a").once
expect(Kontena).to receive(:run).with(['stack', 'deploy', 'stack-a']).once
subject.run(['stack-a', './path/to/kontena.yml'])
end

context '--no-deploy option' do
it 'does not trigger deploy' do
expect(client).to receive(:get).with('stacks/test-grid/stack-a').and_return(stack_response)
allow(subject).to receive(:require_config_file).with('./path/to/kontena.yml').and_return(true)
allow(subject).to receive(:stack_from_yaml).with('./path/to/kontena.yml', name: 'stack-a', values: nil, from_registry: false, defaults: defaults).and_return(stack)
allow(client).to receive(:put).with(
'stacks/test-grid/stack-a', anything
).and_return({})
expect(Kontena).not_to receive(:run).with("stack deploy stack-a")
expect(Kontena).not_to receive(:run).with(['stack', 'deploy', 'stack-a'])
subject.run(['--no-deploy', 'stack-a', './path/to/kontena.yml'])
end
end
Expand Down

0 comments on commit a8e0a25

Please sign in to comment.