Skip to content
Snippets Groups Projects
Commit 26c7d04c authored by João Alexandre Cunha's avatar João Alexandre Cunha :rocket:
Browse files

Refactor .available spec into a shared_example

- Uses shared_exampels to DRY up duplicated specs
parent 24ee46d6
No related branches found
No related tags found
Loading
Pipeline #47548847 passed with warnings
This commit is part of merge request !25067. Comments created here will be created in the context of that merge request.
......@@ -8,19 +8,6 @@
include_examples 'cluster application version specs', :clusters_applications_cert_managers
include_examples 'cluster application initial status specs'
describe '.available' do
subject { described_class.available }
let!(:installed_cluster) { create(:clusters_applications_cert_managers, :installed) }
let!(:updated_cluster) { create(:clusters_applications_cert_managers, :updated) }
before do
create(:clusters_applications_cert_managers, :errored)
end
it { is_expected.to contain_exactly(installed_cluster, updated_cluster) }
end
describe '#install_command' do
let(:cluster_issuer_file) { { "cluster_issuer.yaml": "---\napiVersion: certmanager.k8s.io/v1alpha1\nkind: ClusterIssuer\nmetadata:\n name: letsencrypt-prod\nspec:\n acme:\n server: https://acme-v02.api.letsencrypt.org/directory\n email: admin@example.com\n privateKeySecretRef:\n name: letsencrypt-prod\n http01: {}\n" } }
subject { cert_manager.install_command }
......
......@@ -16,19 +16,6 @@
allow(ClusterWaitForIngressIpAddressWorker).to receive(:perform_async)
end
describe '.available' do
subject { described_class.available }
let!(:installed_cluster) { create(:clusters_applications_ingress, :installed) }
let!(:updated_cluster) { create(:clusters_applications_ingress, :updated) }
before do
create(:clusters_applications_ingress, :errored)
end
it { is_expected.to contain_exactly(installed_cluster, updated_cluster) }
end
describe '#make_installed!' do
before do
application.make_installed!
......
......@@ -24,19 +24,6 @@
it { expect(knative_no_rbac).to be_not_installable }
end
describe '.installed' do
subject { described_class.available }
let!(:installed_cluster) { create(:clusters_applications_knative, :installed) }
let!(:updated_cluster) { create(:clusters_applications_knative, :updated) }
before do
create(:clusters_applications_knative, :errored)
end
it { is_expected.to contain_exactly(installed_cluster, updated_cluster) }
end
describe 'make_installed with external_ip' do
before do
application.make_installed!
......
......@@ -9,19 +9,6 @@
include_examples 'cluster application helm specs', :clusters_applications_prometheus
include_examples 'cluster application initial status specs'
describe '.available' do
subject { described_class.available }
let!(:installed_cluster) { create(:clusters_applications_prometheus, :installed) }
let!(:updated_cluster) { create(:clusters_applications_prometheus, :updated) }
before do
create(:clusters_applications_prometheus, :errored)
end
it { is_expected.to contain_exactly(installed_cluster, updated_cluster) }
end
describe 'transition to installed' do
let(:project) { create(:project) }
let(:cluster) { create(:cluster, :with_installed_helm, projects: [project]) }
......
......@@ -11,19 +11,6 @@
it { is_expected.to belong_to(:runner) }
describe '.available' do
subject { described_class.available }
let!(:installed_cluster) { create(:clusters_applications_runner, :installed) }
let!(:updated_cluster) { create(:clusters_applications_runner, :updated) }
before do
create(:clusters_applications_runner, :errored)
end
it { is_expected.to contain_exactly(installed_cluster, updated_cluster) }
end
describe '#install_command' do
let(:kubeclient) { double('kubernetes client') }
let(:gitlab_runner) { create(:clusters_applications_runner, runner: ci_runner) }
......
......@@ -9,6 +9,19 @@
end
end
describe '.available' do
subject { described_class.available }
let!(:installed_cluster) { create(application_name, :installed) }
let!(:updated_cluster) { create(application_name, :updated) }
before do
create(application_name, :errored)
end
it { is_expected.to contain_exactly(installed_cluster, updated_cluster) }
end
describe 'status state machine' do
describe '#make_installing' do
subject { create(application_name, :scheduled) }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment