summaryrefslogtreecommitdiff
path: root/spec/finders
diff options
context:
space:
mode:
authorMatija Čupić <matteeyah@gmail.com>2017-11-27 16:21:18 +0100
committerMatija Čupić <matteeyah@gmail.com>2017-11-27 16:21:18 +0100
commitd1ba15c76aaa05dafa6683f4e27365451a20bd2e (patch)
treebb64fe69ce01c2215a90ce75ac71da60d43e889a /spec/finders
parent554bf24b2a9e2964286272e690be417901cbd6e0 (diff)
downloadgitlab-ce-d1ba15c76aaa05dafa6683f4e27365451a20bd2e.tar.gz
Add specs for ClustersFinder
Diffstat (limited to 'spec/finders')
-rw-r--r--spec/finders/clusters_finder_spec.rb33
1 files changed, 33 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..29fb3846d03
--- /dev/null
+++ b/spec/finders/clusters_finder_spec.rb
@@ -0,0 +1,33 @@
+require 'spec_helper'
+
+describe ClustersFinder do
+ let(:project) { create(:project) }
+ set(:user) { create(:user) }
+
+ describe '#execute' do
+ before do
+ create_list(:cluster, 2, :provided_by_gcp, projects: [project])
+ project.clusters.last.enabled = false
+ end
+
+ subject { described_class.new(project, user, scope).execute }
+
+ context 'when scope is all' do
+ let(:scope) { :all }
+
+ it { is_expected.to eq(project.clusters.to_a) }
+ end
+
+ context 'when scope is enabled' do
+ let(:scope) { :enabled }
+
+ it { is_expected.to eq(project.clusters.enabled.to_a) }
+ end
+
+ context 'when scope is disabled' do
+ let(:scope) { :disabled }
+
+ it { is_expected.to eq(project.clusters.disabled.to_a) }
+ end
+ end
+end