blob: 549fd862d2dad46e24428c9c2c0d6da3b3d5536f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
# frozen_string_literal: true
require 'fast_spec_helper'
RSpec.describe Gitlab::Kubernetes::Kubeconfig::Entry::Cluster do
describe '#to_h' do
let(:name) { 'name' }
let(:url) { 'url' }
subject { described_class.new(name: name, url: url).to_h }
it { is_expected.to eq({ name: name, cluster: { server: url } }) }
context 'with a certificate' do
let(:cert) { 'certificate' }
let(:cert_encoded) { Base64.strict_encode64(cert) }
subject { described_class.new(name: name, url: url, ca_pem: cert).to_h }
it { is_expected.to eq({ name: name, cluster: { server: url, 'certificate-authority-data': cert_encoded } }) }
end
end
end
|