Commit 25dd1712 authored by Kamil Trzcinski's avatar Kamil Trzcinski

Add specs to test on_stop and action on environments

parent 50d97527
...@@ -64,6 +64,10 @@ module Gitlab ...@@ -64,6 +64,10 @@ module Gitlab
value[:action] || 'start' value[:action] || 'start'
end end
def on_stop
value[:on_stop]
end
def value def value
case @config case @config
when String then { name: @config, action: 'start' } when String then { name: @config, action: 'start' }
......
...@@ -101,7 +101,7 @@ describe Gitlab::Ci::Config::Node::Environment do ...@@ -101,7 +101,7 @@ describe Gitlab::Ci::Config::Node::Environment do
context 'when invalid action is used' do context 'when invalid action is used' do
let(:config) do let(:config) do
{ name: 'production', { name: 'production',
action: false } action: 'invalid' }
end end
describe '#valid?' do describe '#valid?' do
...@@ -144,7 +144,7 @@ describe Gitlab::Ci::Config::Node::Environment do ...@@ -144,7 +144,7 @@ describe Gitlab::Ci::Config::Node::Environment do
describe '#errors' do describe '#errors' do
it 'contains error about invalid action' do it 'contains error about invalid action' do
expect(entry.errors) expect(entry.errors)
.to include 'environment action should be start or stop' .to include 'environment on stop should be a string'
end end
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment