summaryrefslogtreecommitdiff
path: root/spec/finders
diff options
context:
space:
mode:
authorMatija Čupić <matteeyah@gmail.com>2017-12-01 16:27:53 +0100
committerMatija Čupić <matteeyah@gmail.com>2017-12-01 16:27:53 +0100
commit5fb8b2f757e22437028436bb19af87d82c4f8c6c (patch)
tree6b403b7c5269fd32e97e329f723a3d0d1495c879 /spec/finders
parentf6057437dc052431b2fc0485f837931ba0b5044d (diff)
downloadgitlab-ce-5fb8b2f757e22437028436bb19af87d82c4f8c6c.tar.gz
Refactor disabled cluster testing to use trait
Diffstat (limited to 'spec/finders')
-rw-r--r--spec/finders/clusters_finder_spec.rb16
1 files changed, 7 insertions, 9 deletions
diff --git a/spec/finders/clusters_finder_spec.rb b/spec/finders/clusters_finder_spec.rb
index 3e7bbbe39c4..c10efac2432 100644
--- a/spec/finders/clusters_finder_spec.rb
+++ b/spec/finders/clusters_finder_spec.rb
@@ -5,29 +5,27 @@ describe ClustersFinder do
set(:user) { create(:user) }
describe '#execute' do
- before do
- create_list(:cluster, 2, :provided_by_gcp, projects: [project])
- project.clusters.last.enabled = false
- end
+ 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 eq(project.clusters) }
+ it { is_expected.to match_array([enabled_cluster, disabled_cluster]) }
end
- context 'when scope is enabled' do
+ context 'when scope is active' do
let(:scope) { :active }
- it { is_expected.to eq(project.clusters.enabled) }
+ it { is_expected.to match_array([enabled_cluster]) }
end
- context 'when scope is disabled' do
+ context 'when scope is inactive' do
let(:scope) { :inactive }
- it { is_expected.to eq(project.clusters.disabled) }
+ it { is_expected.to match_array([disabled_cluster]) }
end
end
end