Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKamil Trzcinski <ayufan@ayufan.eu>2017-12-04 00:00:25 +0300
committerKamil Trzcinski <ayufan@ayufan.eu>2017-12-04 00:00:25 +0300
commitf1cce0cba88089442194b53833b6b5a0ca96e8e4 (patch)
treea62185a58ff201741dbfee7f7914f1ffe038b60c /spec/finders
parent5ea53d2e8179e3a1e3d4b991a91d506ce13c3fca (diff)
parent363c57468dc6f656c6c345f0b9eda32029571201 (diff)
Merge remote-tracking branch 'origin/list-multiple-clusters' into cluster-page-with-list-clusters
Diffstat (limited to 'spec/finders')
-rw-r--r--spec/finders/clusters_finder_spec.rb31
1 files changed, 31 insertions, 0 deletions
diff --git a/spec/finders/clusters_finder_spec.rb b/spec/finders/clusters_finder_spec.rb
new file mode 100644
index 00000000000..c10efac2432
--- /dev/null
+++ b/spec/finders/clusters_finder_spec.rb
@@ -0,0 +1,31 @@
+require 'spec_helper'
+
+describe ClustersFinder do
+ let(:project) { create(:project) }
+ set(:user) { create(:user) }
+
+ describe '#execute' do
+ let(:enabled_cluster) { create(:cluster, :provided_by_gcp, projects: [project]) }
+ let(:disabled_cluster) { create(:cluster, :disabled, :provided_by_gcp, projects: [project]) }
+
+ subject { described_class.new(project, user, scope).execute }
+
+ context 'when scope is all' do
+ let(:scope) { :all }
+
+ it { is_expected.to match_array([enabled_cluster, disabled_cluster]) }
+ end
+
+ context 'when scope is active' do
+ let(:scope) { :active }
+
+ it { is_expected.to match_array([enabled_cluster]) }
+ end
+
+ context 'when scope is inactive' do
+ let(:scope) { :inactive }
+
+ it { is_expected.to match_array([disabled_cluster]) }
+ end
+ end
+end