summaryrefslogtreecommitdiff
path: root/spec/models
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzegorz@gitlab.com>2017-12-06 09:07:52 +0000
committerGrzegorz Bizon <grzegorz@gitlab.com>2017-12-06 09:07:52 +0000
commit29c243b08d91194d46203a085f6857fe966bcdff (patch)
treeee2f443ce026ce271fc579a6933d0f572a64ac87 /spec/models
parent67a94b2ff3b0d714549c7d30b3c6212f3046a3c2 (diff)
parent0ef16b272002013bbdb44517e62f0a1d15046cf5 (diff)
downloadgitlab-ce-29c243b08d91194d46203a085f6857fe966bcdff.tar.gz
Merge branch 'list-multiple-clusters' into 'master'
List multiple clusters See merge request gitlab-org/gitlab-ce!15403
Diffstat (limited to 'spec/models')
-rw-r--r--spec/models/clusters/cluster_spec.rb22
-rw-r--r--spec/models/project_spec.rb2
2 files changed, 23 insertions, 1 deletions
diff --git a/spec/models/clusters/cluster_spec.rb b/spec/models/clusters/cluster_spec.rb
index 7f43e747000..2683d21ddbe 100644
--- a/spec/models/clusters/cluster_spec.rb
+++ b/spec/models/clusters/cluster_spec.rb
@@ -198,4 +198,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
diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb
index 6bda1eb15a8..bda1d1cb612 100644
--- a/spec/models/project_spec.rb
+++ b/spec/models/project_spec.rb
@@ -78,7 +78,7 @@ describe Project do
it { is_expected.to have_many(:uploads).dependent(:destroy) }
it { is_expected.to have_many(:pipeline_schedules) }
it { is_expected.to have_many(:members_and_requesters) }
- it { is_expected.to have_one(:cluster) }
+ it { is_expected.to have_many(:clusters) }
it { is_expected.to have_many(:custom_attributes).class_name('ProjectCustomAttribute') }
context 'after initialized' do