Fix specs and improve code readability
This commit is contained in:
parent
a36d556137
commit
d375e3f15b
2 changed files with 5 additions and 4 deletions
|
@ -30,9 +30,9 @@ module Mattermost
|
|||
if subject.is_a?(Gitlab::ChatCommands::Result)
|
||||
show_result(subject)
|
||||
elsif subject.respond_to?(:count)
|
||||
if subject.try(:many?)
|
||||
if subject.many?
|
||||
multiple_resources(subject)
|
||||
elsif subject.count == 0
|
||||
elsif subject.none?
|
||||
not_found
|
||||
else
|
||||
single_resource(subject)
|
||||
|
|
|
@ -52,12 +52,13 @@ describe Gitlab::ChatCommands::Deploy, service: true do
|
|||
|
||||
context 'when teardown action exists' do
|
||||
let!(:teardown) do
|
||||
create(:ci_build, :manual, :teardown_environment, project: project, pipeline: build.pipeline,
|
||||
create(:ci_build, :manual, :teardown_environment,
|
||||
project: project, pipeline: build.pipeline,
|
||||
name: 'teardown', environment: 'production')
|
||||
end
|
||||
|
||||
it 'returns error' do
|
||||
expect(subject).to eq(action)
|
||||
expect(subject).to eq(manual1)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue