File: application_setting_spec.rb

package info (click to toggle)
gitlab 17.6.5-19
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 629,368 kB
  • sloc: ruby: 1,915,304; javascript: 557,307; sql: 60,639; xml: 6,509; sh: 4,567; makefile: 1,239; python: 406
file content (49 lines) | stat: -rw-r--r-- 1,615 bytes parent folder | download
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
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe API::Entities::ApplicationSetting do
  let_it_be(:application_setting, reload: true) { create(:application_setting) }

  subject(:output) { described_class.new(application_setting).as_json }

  context 'housekeeping_bitmaps_enabled usage is deprecated and always enabled' do
    before do
      application_setting.housekeeping_bitmaps_enabled = housekeeping_bitmaps_enabled
    end

    context 'when housekeeping_bitmaps_enabled db column is false' do
      let(:housekeeping_bitmaps_enabled) { false }

      it 'returns true' do
        expect(subject[:housekeeping_bitmaps_enabled]).to eq(true)
      end
    end

    context 'when housekeeping_bitmaps_enabled db column is true' do
      let(:housekeeping_bitmaps_enabled) { false }

      it 'returns true' do
        expect(subject[:housekeeping_bitmaps_enabled]).to eq(true)
      end
    end
  end

  context 'for container registry migration-related fields' do
    it 'returns the static value assigned' do
      {
        container_registry_import_max_tags_count: 0,
        container_registry_import_max_retries: 0,
        container_registry_import_start_max_retries: 0,
        container_registry_import_max_step_duration: 0,
        container_registry_pre_import_tags_rate: 0,
        container_registry_pre_import_timeout: 0,
        container_registry_import_timeout: 0,
        container_registry_import_target_plan: '',
        container_registry_import_created_before: ''
      }.each do |field, value|
        expect(subject[field]).to eq(value)
      end
    end
  end
end