blob: 7e375c7ff3943b2688d0cefcadb3fa3bed007e42 (
plain)
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
47
48
49
50
51
52
|
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe MergeRequest::ApprovalRemovalSettings, :with_license do
describe 'validations' do
let(:reset_approvals_on_push) {}
let(:selective_code_owner_removals) {}
subject { described_class.new(project, reset_approvals_on_push, selective_code_owner_removals) }
context 'when enabling selective_code_owner_removals and reset_approvals_on_push is disabled' do
let(:project) { create(:project, reset_approvals_on_push: false) }
let(:selective_code_owner_removals) { true }
it { is_expected.to be_valid }
end
context 'when enabling selective_code_owner_removals and reset_approvals_on_push is enabled' do
let(:project) { create(:project) }
let(:selective_code_owner_removals) { true }
it { is_expected.not_to be_valid }
end
context 'when enabling reset_approvals_on_push and selective_code_owner_removals is disabled' do
let(:project) { create(:project) }
let(:reset_approvals_on_push) { true }
it { is_expected.to be_valid }
end
context 'when enabling reset_approvals_on_push and selective_code_owner_removals is enabled' do
let(:project) { create(:project) }
let(:reset_approvals_on_push) { true }
before do
project.project_setting.update!(selective_code_owner_removals: true)
end
it { is_expected.not_to be_valid }
end
context 'when enabling reset_approvals_on_push and selective_code_owner_removals' do
let(:project) { create(:project) }
let(:reset_approvals_on_push) { true }
let(:selective_code_owner_removals) { true }
it { is_expected.not_to be_valid }
end
end
end
|