Commit ce704a95 authored by Matija Čupić's avatar Matija Čupić

Add created? to Cluster model

parent b7f35360
......@@ -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
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment