Commit b77f2e45 authored by Bryce Johnson's avatar Bryce Johnson

Add integration tests for unapprove.

parent 94399b59
...@@ -161,68 +161,61 @@ feature 'Merge request approvals', js: true, feature: true do ...@@ -161,68 +161,61 @@ feature 'Merge request approvals', js: true, feature: true do
login_as(user) login_as(user)
end end
context 'when group is assigned to a project' do
it 'I am able to approve' do
create :approver_group, group: group, target: project
context 'when group is assigned to a project', js:true, focus: true do
before do
create :approver_group, group: group, target: project
visit namespace_project_merge_request_path(project.namespace, project, merge_request) visit namespace_project_merge_request_path(project.namespace, project, merge_request)
end
page.within '.mr-state-widget' do it 'I am able to approve' do
click_button 'Approve Merge Request' approve_merge_request
end
expect(page).to have_content("Approved by") expect(page).to have_content("Approved by")
end end
it 'I am able to unapprove' do
approve_merge_request
unapprove_merge_request
expect(page).not_to have_content("Approved by")
end
end end
context 'when group is assigned to a merge request' do context 'when group is assigned to a merge request', js:true, focus:true do
it 'I am able to approve' do before do
create :approver_group, group: group, target: merge_request create :approver_group, group: group, target: merge_request
visit namespace_project_merge_request_path(project.namespace, project, merge_request) visit namespace_project_merge_request_path(project.namespace, project, merge_request)
end
it 'I am able to approve' do
approve_merge_request
page.within '.mr-state-widget' do page.within '.mr-state-widget' do
click_button 'Approve Merge Request' click_button 'Approve Merge Request'
end end
wait_for_ajax
expect(page).to have_content("Approved by") expect(page).to have_content("Approved by")
end end
end
end
context 'Unapproving by approvers from groups' do it 'I am able to unapprove' do
let(:other_user) { create(:user) } approve_merge_request
let(:merge_request) { create(:merge_request, source_project: project) } unapprove_merge_request
let(:group) { create :group } expect(page).not_to have_content("Approved by")
before do
project.team << [user, :developer]
group.add_developer(other_user)
group.add_developer(user)
login_as(user)
create :approver_group, group: group, target: project
visit namespace_project_merge_request_path(project.namespace, project, merge_request)
page.within '.mr-state-widget' do
click_button 'Approve Merge Request'
end end
wait_for_ajax
end end
end
end
it 'I am able to unapprove' do def approve_merge_request
page.within '.mr-state-widget' do
page.within '.mr-state-widget' do click_button 'Approve Merge Request'
click_button 'Remove your approval' end
end wait_for_ajax
end
expect(page).not_to have_content("Approved by")
end def unapprove_merge_request
page.within '.mr-state-widget' do
click_button 'Remove your approval'
end end
wait_for_ajax
end end
/* eslint-disable */
//= require jquery
//= require vue
//= require issuable_time_tracker
((gl) => {
describe('Merge Request Approvals API', function() {
describe('Unapprove', function() {
method is defined
calls update state
});
describe('Approve', function() {
method is defined
calls update state
});
describe('Fetch', function() {
method is defined
calls update state
});
});
})(window.gl || (window.gl = {}));
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