1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'projects/merge_requests/show.html.haml', :aggregate_failures do
include_context 'merge request show action'
before do
merge_request.reload
end
context 'when the merge request is open' do
it 'shows the "Mark as draft" button' do
render
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')
end
end
context 'when the merge request is closed' do
before do
merge_request.close!
end
it 'shows the "Reopen" button' do
render
expect(rendered).not_to have_css('a', visible: true, text: 'Mark as draft')
expect(rendered).to have_css('a', visible: true, text: 'Reopen')
expect(rendered).to have_css('a', visible: false, text: 'Close')
end
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)
render
expect(rendered).to have_css('a', visible: false, text: 'Reopen')
expect(rendered).to have_css('a', visible: false, text: 'Close')
end
end
end
end
|