Fix tests for initial status
This commit is contained in:
parent
55d098c94b
commit
760a154a03
|
|
@ -18,6 +18,8 @@ module Clusters
|
|||
end
|
||||
|
||||
def set_initial_status
|
||||
return unless not_installable?
|
||||
|
||||
self.status = 'installable' if cluster&.platform_kubernetes_active?
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,10 @@ FactoryGirl.define do
|
|||
factory :cluster_applications_helm, class: Clusters::Applications::Helm do
|
||||
cluster factory: %i(cluster provided_by_gcp)
|
||||
|
||||
trait :not_installable do
|
||||
status -2
|
||||
end
|
||||
|
||||
trait :installable do
|
||||
status 0
|
||||
end
|
||||
|
|
|
|||
|
|
@ -21,8 +21,20 @@ describe Clusters::Applications::Helm do
|
|||
end
|
||||
|
||||
describe '#status' do
|
||||
it 'defaults to :installable' do
|
||||
expect(subject.status_name).to be(:installable)
|
||||
let(:cluster) { create(:cluster) }
|
||||
|
||||
subject { described_class.new(cluster: cluster) }
|
||||
|
||||
it 'defaults to :not_installable' do
|
||||
expect(subject.status_name).to be(:not_installable)
|
||||
end
|
||||
|
||||
context 'when platform kubernetes is defined' do
|
||||
let(:cluster) { create(:cluster, :provided_by_gcp) }
|
||||
|
||||
it 'defaults to :installable' do
|
||||
expect(subject.status_name).to be(:installable)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue