diff options
author | Kamil Trzcinski <ayufan@ayufan.eu> | 2016-11-21 18:22:03 +0100 |
---|---|---|
committer | Kamil Trzcinski <ayufan@ayufan.eu> | 2016-11-21 18:22:03 +0100 |
commit | d375e3f15b6f0340addb9a20e0c03a1f1fca413a (patch) | |
tree | 3e567f06bcefbd67315eaaa1894b9b102f9281ae | |
parent | a36d556137116385e84eca592ec62e46ecb97e03 (diff) | |
download | gitlab-ce-d375e3f15b6f0340addb9a20e0c03a1f1fca413a.tar.gz |
Fix specs and improve code readability
-rw-r--r-- | lib/mattermost/presenter.rb | 4 | ||||
-rw-r--r-- | spec/lib/gitlab/chat_commands/deploy_spec.rb | 5 |
2 files changed, 5 insertions, 4 deletions
diff --git a/lib/mattermost/presenter.rb b/lib/mattermost/presenter.rb index 8ecab01a359..6b12081575d 100644 --- a/lib/mattermost/presenter.rb +++ b/lib/mattermost/presenter.rb @@ -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) diff --git a/spec/lib/gitlab/chat_commands/deploy_spec.rb b/spec/lib/gitlab/chat_commands/deploy_spec.rb index bdbaa41dd14..26741367e63 100644 --- a/spec/lib/gitlab/chat_commands/deploy_spec.rb +++ b/spec/lib/gitlab/chat_commands/deploy_spec.rb @@ -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 |