debian-mirror-gitlab/spec/views/projects/merge_requests/show.html.haml_spec.rb

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

49 lines
1.3 KiB
Ruby
Raw Normal View History

2019-12-21 20:55:43 +05:30
# frozen_string_literal: true
2016-09-29 09:46:39 +05:30
require 'spec_helper'
2021-04-17 20:07:23 +05:30
RSpec.describe 'projects/merge_requests/show.html.haml', :aggregate_failures do
2021-10-27 15:23:28 +05:30
using RSpec::Parameterized::TableSyntax
2021-04-17 20:07:23 +05:30
include_context 'merge request show action'
2021-02-22 17:27:13 +05:30
2020-06-23 00:09:42 +05:30
before do
2021-04-17 20:07:23 +05:30
merge_request.reload
2020-06-23 00:09:42 +05:30
end
2021-02-22 17:27:13 +05:30
context 'when the merge request is open' do
it 'shows the "Mark as draft" button' do
render
2019-02-15 15:39:39 +05:30
2021-02-22 17:27:13 +05:30
expect(rendered).to have_css('a', visible: true, text: 'Mark as draft')
expect(rendered).to have_css('a', visible: false, text: 'Reopen')
expect(rendered).to have_css('a', visible: true, text: 'Close')
2019-02-15 15:39:39 +05:30
end
end
2016-09-29 09:46:39 +05:30
context 'when the merge request is closed' do
2021-04-17 20:07:23 +05:30
before do
merge_request.close!
2021-02-22 17:27:13 +05:30
end
2016-09-29 09:46:39 +05:30
it 'shows the "Reopen" button' do
render
2021-02-22 17:27:13 +05:30
expect(rendered).not_to have_css('a', visible: true, text: 'Mark as draft')
2016-09-29 09:46:39 +05:30
expect(rendered).to have_css('a', visible: true, text: 'Reopen')
expect(rendered).to have_css('a', visible: false, text: 'Close')
end
2021-04-17 20:07:23 +05:30
context 'when source project does not exist' do
it 'does not show the "Reopen" button' do
allow(merge_request).to receive(:source_project).and_return(nil)
2016-09-29 09:46:39 +05:30
2021-04-17 20:07:23 +05:30
render
2016-09-29 09:46:39 +05:30
2021-04-17 20:07:23 +05:30
expect(rendered).to have_css('a', visible: false, text: 'Reopen')
expect(rendered).to have_css('a', visible: false, text: 'Close')
end
2016-09-29 09:46:39 +05:30
end
end
end