Commit 1ad139e9 authored by Doug Stull's avatar Doug Stull Committed by Jan Provaznik

Improve tests for ci config path permission checks

- needed to qualify the spec
parent 77d12c4a
......@@ -95,8 +95,7 @@ class MergeRequestWidgetEntity < Grape::Entity
merge_request.all_pipelines.none? &&
merge_request.commits_count.positive? &&
can?(current_user, :read_build, merge_request.source_project) &&
can?(current_user, :create_pipeline, merge_request.source_project) &&
can?(current_user, :push_code, merge_request.source_project)
can?(current_user, :create_pipeline, merge_request.source_project)
end
end
......
......@@ -124,9 +124,19 @@ describe MergeRequestWidgetEntity do
end
end
context 'when feature is disabled' do
context 'when build feature is disabled' do
before do
project.project_feature.update(repository_access_level: ProjectFeature::DISABLED)
project.project_feature.update(builds_access_level: ProjectFeature::DISABLED)
end
it 'has no path' do
expect(subject[:merge_request_add_ci_config_path]).to be_nil
end
end
context 'when creating the pipeline is not allowed' do
before do
user.state = 'blocked'
end
it 'has no path' do
......
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