gitlab-org--gitlab-foss/spec/models/instance_metadata/kas_spec.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

34 lines
871 B
Ruby
Raw Normal View History

# 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