gitlab-org--gitlab-foss/spec/finders/clusters_finder_spec.rb

34 lines
889 B
Ruby
Raw Normal View History

# frozen_string_literal: true
2017-11-27 10:21:18 -05:00
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, :production_environment, projects: [project]) }
2017-11-27 10:21:18 -05:00
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]) }
2017-11-27 10:21:18 -05:00
end
context 'when scope is active' do
2017-11-28 08:22:29 -05:00
let(:scope) { :active }
2017-11-27 10:21:18 -05:00
it { is_expected.to match_array([enabled_cluster]) }
2017-11-27 10:21:18 -05:00
end
context 'when scope is inactive' do
2017-11-28 08:22:29 -05:00
let(:scope) { :inactive }
2017-11-27 10:21:18 -05:00
it { is_expected.to match_array([disabled_cluster]) }
2017-11-27 10:21:18 -05:00
end
end
end