Commit d375e3f1 authored by Kamil Trzcinski's avatar Kamil Trzcinski

Fix specs and improve code readability

parent a36d5561
......@@ -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
......
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