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

kas_spec.rb « instance_metadata « models « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: f8cc34fa8d3801ece6e9ba97d24546fd71f83155 (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
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe ::InstanceMetadata::Kas do
  it 'has InstanceMetadataPolicy as declarative policy' do
    expect(described_class.declarative_policy_class).to eq("InstanceMetadataPolicy")
  end

  context 'when KAS is enabled' do
    it 'has the correct properties' do
      allow(Gitlab::Kas).to receive(:enabled?).and_return(true)

      expect(subject).to have_attributes(
        enabled: Gitlab::Kas.enabled?,
        version: Gitlab::Kas.version,
        external_url: Gitlab::Kas.external_url
      )
    end
  end

  context 'when KAS is disabled' do
    it 'has the correct properties' do
      allow(Gitlab::Kas).to receive(:enabled?).and_return(false)

      expect(subject).to have_attributes(
        enabled: Gitlab::Kas.enabled?,
        version: nil,
        external_url: nil
      )
    end
  end
end