Welcome to mirror list, hosted at ThFree Co, Russian Federation.

_repository_storage.html.haml_spec.rb « application_settings « admin « views « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 244157a3b149798845f7ab2f5bafa6dcc3dde1b7 (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
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe 'admin/application_settings/_repository_storage.html.haml' do
  let(:app_settings) { build(:application_setting, repository_storages_weighted: repository_storages_weighted) }

  before do
    stub_storage_settings({ 'default': {}, 'mepmep': {}, 'foobar': {} })
    assign(:application_setting, app_settings)
  end

  context 'with storage weights configured' do
    let(:repository_storages_weighted) do
      {
        'default' => 100,
        'mepmep' => 50,
        'something_old' => 100
      }
    end

    it 'lists storages with weight', :aggregate_failures do
      render

      expect(rendered).to have_field('default', with: 100)
      expect(rendered).to have_field('mepmep', with: 50)
    end

    it 'lists storages without weight' do
      render

      expect(rendered).to have_field('foobar', with: 0)
    end

    it 'lists only configured storages' do
      render

      expect(rendered).not_to have_field('something_old')
    end
  end
end