debian-mirror-gitlab/spec/features/merge_request/user_approves_spec.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

42 lines
1.1 KiB
Ruby
Raw Normal View History

2020-07-28 23:09:34 +05:30
# frozen_string_literal: true
require 'spec_helper'
2023-03-17 16:20:25 +05:30
RSpec.describe 'Merge request > User approves', :js, feature_category: :code_review_workflow do
2020-07-28 23:09:34 +05:30
let(:user) { create(:user) }
let(:project) { create(:project, :public, :repository) }
let(:merge_request) { create(:merge_request, source_project: project) }
before do
project.add_developer(user)
sign_in(user)
visit project_merge_request_path(project, merge_request)
end
it 'approves merge request' do
click_approval_button('Approve')
2021-12-11 22:18:48 +05:30
expect(page).to have_content('Approved by you')
2020-07-28 23:09:34 +05:30
verify_approvals_count_on_index!
click_approval_button('Revoke approval')
2020-10-24 23:57:45 +05:30
expect(page).to have_content('Approval is optional')
2020-07-28 23:09:34 +05:30
end
def verify_approvals_count_on_index!
visit(project_merge_requests_path(project, state: :all))
2022-08-27 11:52:29 +05:30
expect(page.all('li').any? { |item| item["title"] == "1 approver (you've approved)" }).to be true
2020-07-28 23:09:34 +05:30
visit project_merge_request_path(project, merge_request)
end
def click_approval_button(action)
page.within('.mr-state-widget') do
click_button(action)
end
wait_for_requests
end
end