2020-03-13 15:44:24 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require 'spec_helper'
|
|
|
|
|
2020-07-28 23:09:34 +05:30
|
|
|
RSpec.describe DeploymentCluster do
|
2020-03-13 15:44:24 +05:30
|
|
|
let(:cluster) { create(:cluster) }
|
|
|
|
let(:deployment) { create(:deployment) }
|
|
|
|
let(:kubernetes_namespace) { 'an-example-namespace' }
|
|
|
|
|
|
|
|
subject { described_class.new(deployment: deployment, cluster: cluster, kubernetes_namespace: kubernetes_namespace) }
|
|
|
|
|
|
|
|
it { is_expected.to belong_to(:deployment).required }
|
|
|
|
it { is_expected.to belong_to(:cluster).required }
|
|
|
|
|
|
|
|
it do
|
|
|
|
is_expected.to have_attributes(
|
|
|
|
cluster_id: cluster.id,
|
|
|
|
deployment_id: deployment.id,
|
|
|
|
kubernetes_namespace: kubernetes_namespace
|
|
|
|
)
|
|
|
|
end
|
2022-07-23 23:45:48 +05:30
|
|
|
|
|
|
|
context 'loose foreign key on deployment_clusters.cluster_id' do
|
|
|
|
it_behaves_like 'cleanup by a loose foreign key' do
|
|
|
|
let!(:parent) { create(:cluster) }
|
|
|
|
let!(:model) { create(:deployment_cluster, cluster: parent) }
|
|
|
|
end
|
|
|
|
end
|
2020-03-13 15:44:24 +05:30
|
|
|
end
|