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

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

35 lines
902 B
Ruby
Raw Normal View History

# frozen_string_literal: true
2017-11-27 10:21:18 -05:00
require 'spec_helper'
RSpec.describe ClustersFinder do
2017-11-27 10:21:18 -05:00
let(:project) { create(:project) }
let_it_be(:user) { create(:user) }
2017-11-27 10:21:18 -05:00
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