diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-10-28 12:10:15 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-10-28 12:10:15 +0300 |
commit | 25788905108838d95a62d7e3ad3ca16e6f6d0fda (patch) | |
tree | 72f4cb84b9ad509d4bda9aa838a751d123082708 /spec/models | |
parent | 5431dbfffcd7ae1cacc9b68b719b0e8fea29e6a4 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/models')
-rw-r--r-- | spec/models/appearance_spec.rb | 14 | ||||
-rw-r--r-- | spec/models/application_setting_spec.rb | 8 | ||||
-rw-r--r-- | spec/models/broadcast_message_spec.rb | 7 | ||||
-rw-r--r-- | spec/models/dependency_proxy/group_setting_spec.rb | 5 | ||||
-rw-r--r-- | spec/models/work_items/widgets/hierarchy_spec.rb | 32 |
5 files changed, 34 insertions, 32 deletions
diff --git a/spec/models/appearance_spec.rb b/spec/models/appearance_spec.rb index 2817e177d28..9d84279a75e 100644 --- a/spec/models/appearance_spec.rb +++ b/spec/models/appearance_spec.rb @@ -10,6 +10,20 @@ RSpec.describe Appearance do it { is_expected.to have_many(:uploads) } + describe 'default values' do + subject(:appearance) { described_class.new } + + it { expect(appearance.title).to eq('') } + it { expect(appearance.description).to eq('') } + it { expect(appearance.new_project_guidelines).to eq('') } + it { expect(appearance.profile_image_guidelines).to eq('') } + it { expect(appearance.header_message).to eq('') } + it { expect(appearance.footer_message).to eq('') } + it { expect(appearance.message_background_color).to eq('#E75E40') } + it { expect(appearance.message_font_color).to eq('#FFFFFF') } + it { expect(appearance.email_header_and_footer_enabled).to eq(false) } + end + describe '#single_appearance_row' do it 'adds an error when more than 1 row exists' do create(:appearance) diff --git a/spec/models/application_setting_spec.rb b/spec/models/application_setting_spec.rb index 77bb6b502b5..a6341b91a5d 100644 --- a/spec/models/application_setting_spec.rb +++ b/spec/models/application_setting_spec.rb @@ -17,6 +17,14 @@ RSpec.describe ApplicationSetting do it { expect(setting.uuid).to be_present } it { expect(setting).to have_db_column(:auto_devops_enabled) } + describe 'default values' do + subject(:setting) { described_class.new } + + it { expect(setting.id).to eq(1) } + it { expect(setting.repository_storages_weighted).to eq({}) } + it { expect(setting.kroki_formats).to eq({}) } + end + describe 'validations' do let(:http) { 'http://example.com' } let(:https) { 'https://example.com' } diff --git a/spec/models/broadcast_message_spec.rb b/spec/models/broadcast_message_spec.rb index b0bfdabe13c..8fdc9852f6e 100644 --- a/spec/models/broadcast_message_spec.rb +++ b/spec/models/broadcast_message_spec.rb @@ -27,6 +27,13 @@ RSpec.describe BroadcastMessage do it { is_expected.to validate_inclusion_of(:target_access_levels).in_array(described_class::ALLOWED_TARGET_ACCESS_LEVELS) } end + describe 'default values' do + subject(:message) { described_class.new } + + it { expect(message.color).to eq('#E75E40') } + it { expect(message.font).to eq('#FFFFFF') } + end + shared_examples 'time constrainted' do |broadcast_type| it 'returns message if time match' do message = create(:broadcast_message, broadcast_type: broadcast_type) diff --git a/spec/models/dependency_proxy/group_setting_spec.rb b/spec/models/dependency_proxy/group_setting_spec.rb index c4c4a877d50..4da1fe42ff2 100644 --- a/spec/models/dependency_proxy/group_setting_spec.rb +++ b/spec/models/dependency_proxy/group_setting_spec.rb @@ -7,6 +7,11 @@ RSpec.describe DependencyProxy::GroupSetting, type: :model do it { is_expected.to belong_to(:group) } end + describe 'default values' do + it { is_expected.to be_enabled } + it { expect(described_class.new(enabled: false)).not_to be_enabled } + end + describe 'validations' do it { is_expected.to validate_presence_of(:group) } end diff --git a/spec/models/work_items/widgets/hierarchy_spec.rb b/spec/models/work_items/widgets/hierarchy_spec.rb index cd528772710..c847f2694fe 100644 --- a/spec/models/work_items/widgets/hierarchy_spec.rb +++ b/spec/models/work_items/widgets/hierarchy_spec.rb @@ -26,22 +26,6 @@ RSpec.describe WorkItems::Widgets::Hierarchy do subject { described_class.new(parent_link.work_item).parent } it { is_expected.to eq(parent_link.work_item_parent) } - - context 'when work_items flag is disabled' do - before do - stub_feature_flags(work_items: false) - end - - it { is_expected.to be_nil } - end - - context 'when work_items flag is enabled for the parent group' do - before do - stub_feature_flags(work_items: group) - end - - it { is_expected.to eq(parent_link.work_item_parent) } - end end describe '#children' do @@ -51,21 +35,5 @@ RSpec.describe WorkItems::Widgets::Hierarchy do subject { described_class.new(work_item_parent).children } it { is_expected.to contain_exactly(parent_link1.work_item, parent_link2.work_item) } - - context 'when work_items flag is disabled' do - before do - stub_feature_flags(work_items: false) - end - - it { is_expected.to be_empty } - end - - context 'when work_items flag is enabled for the parent group' do - before do - stub_feature_flags(work_items: group) - end - - it { is_expected.to contain_exactly(parent_link1.work_item, parent_link2.work_item) } - end end end |