Commit d375e3f1 authored by Kamil Trzcinski's avatar Kamil Trzcinski
Browse files

Fix specs and improve code readability

parent 0b78aa4e5f2d
......@@ -30,9 +30,9 @@ def present(subject)
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 @@
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