Commit c28e97a7 authored by Heinrich Lee Yu's avatar Heinrich Lee Yu

Merge branch 'id-remove-some-repeated-examples' into 'master'

Fix repeated examples for merge requests API specs

See merge request gitlab-org/gitlab!28403
parents 43982770 5794cf4c
...@@ -416,13 +416,11 @@ RSpec/RepeatedExample: ...@@ -416,13 +416,11 @@ RSpec/RepeatedExample:
- 'spec/models/project_services/chat_message/pipeline_message_spec.rb' - 'spec/models/project_services/chat_message/pipeline_message_spec.rb'
- 'spec/models/user_spec.rb' - 'spec/models/user_spec.rb'
- 'spec/models/wiki_page_spec.rb' - 'spec/models/wiki_page_spec.rb'
- 'spec/requests/api/merge_requests_spec.rb'
- 'spec/routing/admin_routing_spec.rb' - 'spec/routing/admin_routing_spec.rb'
- 'spec/rubocop/cop/migration/update_large_table_spec.rb' - 'spec/rubocop/cop/migration/update_large_table_spec.rb'
- 'spec/services/notification_service_spec.rb' - 'spec/services/notification_service_spec.rb'
- 'spec/services/web_hook_service_spec.rb' - 'spec/services/web_hook_service_spec.rb'
- 'ee/spec/models/group_spec.rb' - 'ee/spec/models/group_spec.rb'
- 'ee/spec/requests/api/merge_request_approvals_spec.rb'
- 'ee/spec/services/boards/lists/update_service_spec.rb' - 'ee/spec/services/boards/lists/update_service_spec.rb'
- 'ee/spec/services/geo/repository_verification_primary_service_spec.rb' - 'ee/spec/services/geo/repository_verification_primary_service_spec.rb'
- 'ee/spec/workers/geo/file_download_dispatch_worker_spec.rb' - 'ee/spec/workers/geo/file_download_dispatch_worker_spec.rb'
...@@ -481,28 +481,23 @@ describe API::MergeRequestApprovals do ...@@ -481,28 +481,23 @@ describe API::MergeRequestApprovals do
approver.update(password: 'password') approver.update(password: 'password')
end end
it 'returns a 401 with no password' do
approve
expect(response).to have_gitlab_http_status(:unauthorized)
end
it 'does not approve the merge request with no password' do it 'does not approve the merge request with no password' do
approve approve
expect(merge_request.reload.approvals_left).to eq(2)
end
it 'returns a 401 with incorrect password' do
approve
expect(response).to have_gitlab_http_status(:unauthorized) expect(response).to have_gitlab_http_status(:unauthorized)
expect(merge_request.reload.approvals_left).to eq(2)
end end
it 'does not approve the merge request with incorrect password' do it 'does not approve the merge request with incorrect password' do
approve approve(approval_password: 'incorrect')
expect(response).to have_gitlab_http_status(:unauthorized)
expect(merge_request.reload.approvals_left).to eq(2) expect(merge_request.reload.approvals_left).to eq(2)
end end
it 'approves the merge request with correct password' do it 'approves the merge request with correct password' do
approve(approval_password: 'password') approve(approval_password: 'password')
expect(response).to have_gitlab_http_status(:created) expect(response).to have_gitlab_http_status(:created)
expect(merge_request.reload.approvals_left).to eq(1) expect(merge_request.reload.approvals_left).to eq(1)
end end
......
...@@ -1525,7 +1525,7 @@ describe API::MergeRequests do ...@@ -1525,7 +1525,7 @@ describe API::MergeRequests do
it "returns 400 when target_branch is missing" do it "returns 400 when target_branch is missing" do
post api("/projects/#{forked_project.id}/merge_requests", user2), post api("/projects/#{forked_project.id}/merge_requests", user2),
params: { title: 'Test merge_request', target_branch: "master", author: user2, target_project_id: project.id } params: { title: 'Test merge_request', source_branch: "master", author: user2, target_project_id: project.id }
expect(response).to have_gitlab_http_status(:bad_request) expect(response).to have_gitlab_http_status(:bad_request)
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