Add created? to Cluster model

This commit is contained in:
Matija Čupić 2017-12-01 16:49:56 +01:00
parent b7f3536096
commit ce704a9533
No known key found for this signature in database
GPG key ID: 4BAF84FFACD2E5DE
2 changed files with 26 additions and 0 deletions

View file

@ -62,6 +62,10 @@ module Clusters
end
end
def created?
status_name == :created
end
def applications
[
application_helm || build_application_helm,

View file

@ -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