Commit 4b348452 authored by Thong Kuah's avatar Thong Kuah

Add test for updating default branch in projects API

parent 3621b7dc
...@@ -53,7 +53,7 @@ RSpec.describe API::Projects do ...@@ -53,7 +53,7 @@ RSpec.describe API::Projects do
let_it_be(:user2) { create(:user) } let_it_be(:user2) { create(:user) }
let_it_be(:user3) { create(:user) } let_it_be(:user3) { create(:user) }
let_it_be(:admin) { create(:admin) } let_it_be(:admin) { create(:admin) }
let_it_be(:project, reload: true) { create(:project, :repository, namespace: user.namespace) } let_it_be(:project, reload: true) { create(:project, :repository, create_branch: 'something_else', namespace: user.namespace) }
let_it_be(:project2, reload: true) { create(:project, namespace: user.namespace) } let_it_be(:project2, reload: true) { create(:project, namespace: user.namespace) }
let_it_be(:project_member) { create(:project_member, :developer, user: user3, project: project) } let_it_be(:project_member) { create(:project_member, :developer, user: user3, project: project) }
let_it_be(:user4) { create(:user, username: 'user.with.dot') } let_it_be(:user4) { create(:user, username: 'user.with.dot') }
...@@ -2895,6 +2895,18 @@ RSpec.describe API::Projects do ...@@ -2895,6 +2895,18 @@ RSpec.describe API::Projects do
end end
end end
it 'updates default_branch' do
project_param = { default_branch: 'something_else' }
put api("/projects/#{project.id}", user), params: project_param
expect(response).to have_gitlab_http_status(:ok)
project_param.each_pair do |k, v|
expect(json_response[k.to_s]).to eq(v)
end
end
it 'updates jobs_enabled' do it 'updates jobs_enabled' do
project_param = { jobs_enabled: true } project_param = { jobs_enabled: true }
......
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