debian-mirror-gitlab/spec/finders/clusters_finder_spec.rb

35 lines
902 B
Ruby
Raw Normal View History

2019-12-21 20:55:43 +05:30
# frozen_string_literal: true
2018-03-17 18:26:18 +05:30
require 'spec_helper'
2020-06-23 00:09:42 +05:30
RSpec.describe ClustersFinder do
2018-03-17 18:26:18 +05:30
let(:project) { create(:project) }
2020-01-01 13:55:28 +05:30
2020-03-13 15:44:24 +05:30
let_it_be(:user) { create(:user) }
2018-03-17 18:26:18 +05:30
describe '#execute' do
let(:enabled_cluster) { create(:cluster, :provided_by_gcp, projects: [project]) }
2018-05-01 15:08:00 +05:30
let(:disabled_cluster) { create(:cluster, :disabled, :provided_by_gcp, :production_environment, projects: [project]) }
2018-03-17 18:26:18 +05:30
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