blob: 59b7510051f65d4622349936ae657981f9f91a2f (
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe NamespaceSetting, type: :model do
# Relationships
#
describe "Associations" do
it { is_expected.to belong_to(:namespace) }
end
describe "validations" do
describe "#default_branch_name_content" do
let_it_be(:group) { create(:group) }
let(:namespace_settings) { group.namespace_settings }
shared_examples "doesn't return an error" do
it "doesn't return an error" do
expect(namespace_settings.valid?).to be_truthy
expect(namespace_settings.errors.full_messages).to be_empty
end
end
context "when not set" do
it_behaves_like "doesn't return an error"
end
context "when set" do
before do
namespace_settings.default_branch_name = "example_branch_name"
end
it_behaves_like "doesn't return an error"
end
context "when an empty string" do
before do
namespace_settings.default_branch_name = ""
end
it_behaves_like "doesn't return an error"
end
end
describe '#allow_mfa_for_group' do
let(:settings) { group.namespace_settings }
context 'group is top-level group' do
let(:group) { create(:group) }
it 'is valid' do
settings.allow_mfa_for_subgroups = false
expect(settings).to be_valid
end
end
context 'group is a subgroup' do
let(:group) { create(:group, parent: create(:group)) }
it 'is invalid' do
settings.allow_mfa_for_subgroups = false
expect(settings).to be_invalid
end
end
end
end
end
|