2019-09-30 21:07:59 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require 'spec_helper'
|
|
|
|
|
2020-07-28 23:09:34 +05:30
|
|
|
RSpec.describe Gitlab::Kubernetes::Role do
|
2019-09-30 21:07:59 +05:30
|
|
|
let(:role) { described_class.new(name: name, namespace: namespace, rules: rules) }
|
|
|
|
let(:name) { 'example-name' }
|
|
|
|
let(:namespace) { 'example-namespace' }
|
|
|
|
|
|
|
|
let(:rules) do
|
|
|
|
[{
|
|
|
|
apiGroups: %w(hello.world),
|
|
|
|
resources: %w(oil diamonds coffee),
|
|
|
|
verbs: %w(say do walk run)
|
|
|
|
}]
|
|
|
|
end
|
|
|
|
|
|
|
|
describe '#generate' do
|
|
|
|
subject { role.generate }
|
|
|
|
|
|
|
|
let(:resource) do
|
|
|
|
::Kubeclient::Resource.new(
|
|
|
|
metadata: { name: name, namespace: namespace },
|
|
|
|
rules: rules
|
|
|
|
)
|
|
|
|
end
|
|
|
|
|
|
|
|
it { is_expected.to eq(resource) }
|
|
|
|
end
|
|
|
|
end
|