Add created? to Cluster model
This commit is contained in:
parent
b7f3536096
commit
ce704a9533
2 changed files with 26 additions and 0 deletions
|
@ -62,6 +62,10 @@ module Clusters
|
|||
end
|
||||
end
|
||||
|
||||
def created?
|
||||
status_name == :created
|
||||
end
|
||||
|
||||
def applications
|
||||
[
|
||||
application_helm || build_application_helm,
|
||||
|
|
|
@ -199,4 +199,26 @@ describe Clusters::Cluster do
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe '#created?' do
|
||||
let(:cluster) { create(:cluster, :provided_by_gcp) }
|
||||
|
||||
subject { cluster.created? }
|
||||
|
||||
context 'when status_name is :created' do
|
||||
before do
|
||||
allow(cluster).to receive_message_chain(:provider, :status_name).and_return(:created)
|
||||
end
|
||||
|
||||
it { is_expected.to eq(true) }
|
||||
end
|
||||
|
||||
context 'when status_name is not :created' do
|
||||
before do
|
||||
allow(cluster).to receive_message_chain(:provider, :status_name).and_return(:creating)
|
||||
end
|
||||
|
||||
it { is_expected.to eq(false) }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue