Commit fa81338f authored by Thong Kuah's avatar Thong Kuah

Fixes a type mismatch when rendering tags with private pipelines

parent 111239ad
......@@ -12,7 +12,7 @@ module Ci
end
def execute
return [] unless Ability.allowed?(@current_user, :read_pipeline, @project)
return {} unless Ability.allowed?(@current_user, :read_pipeline, @project)
commit_statuses
end
......
......@@ -152,8 +152,8 @@ RSpec.describe Ci::CommitStatusesFinder, '#execute' do
project.project_feature.update!(builds_access_level: ProjectFeature::PRIVATE)
end
it 'returns nil' do
expect(subject).to be_empty
it 'returns a blank hash' do
expect(subject).to eq({})
end
end
......@@ -170,8 +170,8 @@ RSpec.describe Ci::CommitStatusesFinder, '#execute' do
status: :running)
end
it 'returns nil' do
expect(private_subject).to be_empty
it 'returns a blank hash' do
expect(private_subject).to eq({})
end
end
end
......
......@@ -81,5 +81,14 @@ RSpec.describe 'projects/tags/index.html.haml' do
expect(page.all('.tags .content-list li')).not_to have_css 'svg.s24'
end
it 'shows no build status or placeholder when pipelines are private' do
project.project_feature.update!(builds_access_level: ProjectFeature::PRIVATE)
assign(:tag_pipeline_statuses, Ci::CommitStatusesFinder.new(project, project.repository, build(:user), tags).execute)
render
expect(page.all('.tags .content-list li')).not_to have_css 'svg.s24'
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