Commit 7f778b7a authored by Sean McGivern's avatar Sean McGivern

Tidy up projects API specs

parent e8f29569
...@@ -479,31 +479,39 @@ describe API::Projects do ...@@ -479,31 +479,39 @@ describe API::Projects do
end end
it 'sets a project as allowing outdated diff discussions to automatically resolve' do it 'sets a project as allowing outdated diff discussions to automatically resolve' do
project = attributes_for(:project, { resolve_outdated_diff_discussions: false }) project = attributes_for(:project, resolve_outdated_diff_discussions: false)
post api('/projects', user), project post api('/projects', user), project
expect(json_response['resolve_outdated_diff_discussions']).to be_falsey expect(json_response['resolve_outdated_diff_discussions']).to be_falsey
end end
it 'sets a project as allowing outdated diff discussions to automatically resolve if resolve_outdated_diff_discussions' do it 'sets a project as allowing outdated diff discussions to automatically resolve if resolve_outdated_diff_discussions' do
project = attributes_for(:project, { resolve_outdated_diff_discussions: true }) project = attributes_for(:project, resolve_outdated_diff_discussions: true)
post api('/projects', user), project post api('/projects', user), project
expect(json_response['resolve_outdated_diff_discussions']).to be_truthy expect(json_response['resolve_outdated_diff_discussions']).to be_truthy
end end
it 'sets a project as allowing merge even if build fails' do it 'sets a project as allowing merge even if build fails' do
project = attributes_for(:project, { only_allow_merge_if_pipeline_succeeds: false }) project = attributes_for(:project, only_allow_merge_if_pipeline_succeeds: false)
post api('/projects', user), project post api('/projects', user), project
expect(json_response['only_allow_merge_if_pipeline_succeeds']).to be_falsey expect(json_response['only_allow_merge_if_pipeline_succeeds']).to be_falsey
end end
it 'sets a project as allowing merge only if merge_when_pipeline_succeeds' do it 'sets a project as allowing merge only if merge_when_pipeline_succeeds' do
project = attributes_for(:project, { only_allow_merge_if_pipeline_succeeds: true }) project = attributes_for(:project, only_allow_merge_if_pipeline_succeeds: true)
post api('/projects', user), project post api('/projects', user), project
expect(json_response['only_allow_merge_if_pipeline_succeeds']).to be_truthy expect(json_response['only_allow_merge_if_pipeline_succeeds']).to be_truthy
end end
it 'sets a project as allowing merge even if discussions are unresolved' do it 'sets a project as allowing merge even if discussions are unresolved' do
project = attributes_for(:project, { only_allow_merge_if_all_discussions_are_resolved: false }) project = attributes_for(:project, only_allow_merge_if_all_discussions_are_resolved: false)
post api('/projects', user), project post api('/projects', user), project
...@@ -519,7 +527,7 @@ describe API::Projects do ...@@ -519,7 +527,7 @@ describe API::Projects do
end end
it 'sets a project as allowing merge only if all discussions are resolved' do it 'sets a project as allowing merge only if all discussions are resolved' do
project = attributes_for(:project, { only_allow_merge_if_all_discussions_are_resolved: true }) project = attributes_for(:project, only_allow_merge_if_all_discussions_are_resolved: true)
post api('/projects', user), project post api('/projects', user), project
...@@ -527,7 +535,7 @@ describe API::Projects do ...@@ -527,7 +535,7 @@ describe API::Projects do
end end
it 'ignores import_url when it is nil' do it 'ignores import_url when it is nil' do
project = attributes_for(:project, { import_url: nil }) project = attributes_for(:project, import_url: nil)
post api('/projects', user), project post api('/projects', user), project
...@@ -656,15 +664,15 @@ describe API::Projects do ...@@ -656,15 +664,15 @@ describe API::Projects do
end end
it 'sets a project as allowing outdated diff discussions to automatically resolve' do it 'sets a project as allowing outdated diff discussions to automatically resolve' do
project = attributes_for(:project, { resolve_outdated_diff_discussions: false }) project = attributes_for(:project, resolve_outdated_diff_discussions: false)
post api("/projects/user/#{user.id}", admin), project post api("/projects/user/#{user.id}", admin), project
expect(json_response['resolve_outdated_diff_discussions']).to be_falsey expect(json_response['resolve_outdated_diff_discussions']).to be_falsey
end end
it 'sets a project as allowing outdated diff discussions to automatically resolve only if resolve_outdated_diff_discussions' do it 'sets a project as allowing outdated diff discussions to automatically resolve' do
project = attributes_for(:project, { resolve_outdated_diff_discussions: true }) project = attributes_for(:project, resolve_outdated_diff_discussions: true)
post api("/projects/user/#{user.id}", admin), project post api("/projects/user/#{user.id}", admin), project
...@@ -672,19 +680,19 @@ describe API::Projects do ...@@ -672,19 +680,19 @@ describe API::Projects do
end end
it 'sets a project as allowing merge even if build fails' do it 'sets a project as allowing merge even if build fails' do
project = attributes_for(:project, { only_allow_merge_if_pipeline_succeeds: false }) project = attributes_for(:project, only_allow_merge_if_pipeline_succeeds: false)
post api("/projects/user/#{user.id}", admin), project post api("/projects/user/#{user.id}", admin), project
expect(json_response['only_allow_merge_if_pipeline_succeeds']).to be_falsey expect(json_response['only_allow_merge_if_pipeline_succeeds']).to be_falsey
end end
it 'sets a project as allowing merge only if merge_when_pipeline_succeeds' do it 'sets a project as allowing merge only if pipeline succeeds' do
project = attributes_for(:project, { only_allow_merge_if_pipeline_succeeds: true }) project = attributes_for(:project, only_allow_merge_if_pipeline_succeeds: true)
post api("/projects/user/#{user.id}", admin), project post api("/projects/user/#{user.id}", admin), project
expect(json_response['only_allow_merge_if_pipeline_succeeds']).to be_truthy expect(json_response['only_allow_merge_if_pipeline_succeeds']).to be_truthy
end end
it 'sets a project as allowing merge even if discussions are unresolved' do it 'sets a project as allowing merge even if discussions are unresolved' do
project = attributes_for(:project, { only_allow_merge_if_all_discussions_are_resolved: false }) project = attributes_for(:project, only_allow_merge_if_all_discussions_are_resolved: false)
post api("/projects/user/#{user.id}", admin), project post api("/projects/user/#{user.id}", admin), project
...@@ -692,7 +700,7 @@ describe API::Projects do ...@@ -692,7 +700,7 @@ describe API::Projects do
end end
it 'sets a project as allowing merge only if all discussions are resolved' do it 'sets a project as allowing merge only if all discussions are resolved' do
project = attributes_for(:project, { only_allow_merge_if_all_discussions_are_resolved: true }) project = attributes_for(:project, only_allow_merge_if_all_discussions_are_resolved: true)
post api("/projects/user/#{user.id}", admin), project post api("/projects/user/#{user.id}", admin), project
......
...@@ -394,7 +394,6 @@ describe API::V3::Projects do ...@@ -394,7 +394,6 @@ describe API::V3::Projects do
issues_enabled: false, issues_enabled: false,
merge_requests_enabled: false, merge_requests_enabled: false,
wiki_enabled: false, wiki_enabled: false,
resolve_outdated_diff_discussions: false,
only_allow_merge_if_build_succeeds: false, only_allow_merge_if_build_succeeds: false,
request_access_enabled: true, request_access_enabled: true,
only_allow_merge_if_all_discussions_are_resolved: false only_allow_merge_if_all_discussions_are_resolved: false
...@@ -456,18 +455,6 @@ describe API::V3::Projects do ...@@ -456,18 +455,6 @@ describe API::V3::Projects do
expect(json_response['visibility_level']).to eq(Gitlab::VisibilityLevel::PRIVATE) expect(json_response['visibility_level']).to eq(Gitlab::VisibilityLevel::PRIVATE)
end end
it 'sets a project as allowing outdated diff discussions to automatically resolve' do
project = attributes_for(:project, { resolve_outdated_diff_discussions: false })
post v3_api('/projects', user), project
expect(json_response['resolve_outdated_diff_discussions']).to be_falsey
end
it 'sets a project as allowing outdated diff discussions to automatically resolve if resolve_outdated_diff_discussions' do
project = attributes_for(:project, { resolve_outdated_diff_discussions: true })
post v3_api('/projects', user), project
expect(json_response['resolve_outdated_diff_discussions']).to be_truthy
end
it 'sets a project as allowing merge even if build fails' do it 'sets a project as allowing merge even if build fails' do
project = attributes_for(:project, { only_allow_merge_if_build_succeeds: false }) project = attributes_for(:project, { only_allow_merge_if_build_succeeds: false })
post v3_api('/projects', user), project post v3_api('/projects', user), project
...@@ -612,18 +599,6 @@ describe API::V3::Projects do ...@@ -612,18 +599,6 @@ describe API::V3::Projects do
expect(json_response['visibility_level']).to eq(Gitlab::VisibilityLevel::PRIVATE) expect(json_response['visibility_level']).to eq(Gitlab::VisibilityLevel::PRIVATE)
end end
it 'sets a project as allowing outdated diff discussions to automatically resolve' do
project = attributes_for(:project, { resolve_outdated_diff_discussions: false })
post v3_api("/projects/user/#{user.id}", admin), project
expect(json_response['resolve_outdated_diff_discussions']).to be_falsey
end
it 'sets a project as allowing outdated diff discussions to automatically resolve only if resolve_outdated_diff_discussions' do
project = attributes_for(:project, { resolve_outdated_diff_discussions: true })
post v3_api("/projects/user/#{user.id}", admin), project
expect(json_response['resolve_outdated_diff_discussions']).to be_truthy
end
it 'sets a project as allowing merge even if build fails' do it 'sets a project as allowing merge even if build fails' do
project = attributes_for(:project, { only_allow_merge_if_build_succeeds: false }) project = attributes_for(:project, { only_allow_merge_if_build_succeeds: false })
post v3_api("/projects/user/#{user.id}", admin), project post v3_api("/projects/user/#{user.id}", admin), project
......
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