2019-10-12 21:52:04 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2019-12-04 20:38:33 +05:30
|
|
|
require 'spec_helper'
|
2018-11-18 11:00:15 +05:30
|
|
|
|
2023-03-04 22:38:38 +05:30
|
|
|
RSpec.describe 'Merge request > User sees revert modal', :js, :sidekiq_might_not_need_inline,
|
|
|
|
feature_category: :code_review do
|
2018-11-18 11:00:15 +05:30
|
|
|
let(:project) { create(:project, :public, :repository) }
|
|
|
|
let(:user) { project.creator }
|
|
|
|
let(:merge_request) { create(:merge_request, source_project: project) }
|
|
|
|
|
2021-03-11 19:13:27 +05:30
|
|
|
shared_examples 'showing the revert modal' do
|
|
|
|
it 'shows the revert modal' do
|
|
|
|
click_button('Revert')
|
|
|
|
|
|
|
|
page.within('[data-testid="modal-commit"]') do
|
|
|
|
expect(page).to have_content 'Revert this merge request'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2018-11-18 11:00:15 +05:30
|
|
|
before do
|
|
|
|
sign_in(user)
|
|
|
|
visit(project_merge_request_path(project, merge_request))
|
|
|
|
click_button('Merge')
|
|
|
|
|
|
|
|
wait_for_requests
|
|
|
|
end
|
|
|
|
|
2021-03-11 19:13:27 +05:30
|
|
|
context 'without page reload after merge validates js correctly loaded' do
|
|
|
|
it_behaves_like 'showing the revert modal'
|
2018-11-18 11:00:15 +05:30
|
|
|
end
|
|
|
|
|
2021-03-11 19:13:27 +05:30
|
|
|
context 'with page reload validates js correctly loaded' do
|
|
|
|
before do
|
|
|
|
visit(merge_request_path(merge_request))
|
|
|
|
end
|
2018-11-18 11:00:15 +05:30
|
|
|
|
2021-03-11 19:13:27 +05:30
|
|
|
it_behaves_like 'showing the revert modal'
|
2018-11-18 11:00:15 +05:30
|
|
|
end
|
|
|
|
end
|