diff options
author | Matija Čupić <matteeyah@gmail.com> | 2017-11-27 18:21:18 +0300 |
---|---|---|
committer | Matija Čupić <matteeyah@gmail.com> | 2017-11-27 18:21:18 +0300 |
commit | d1ba15c76aaa05dafa6683f4e27365451a20bd2e (patch) | |
tree | bb64fe69ce01c2215a90ce75ac71da60d43e889a | |
parent | 554bf24b2a9e2964286272e690be417901cbd6e0 (diff) |
Add specs for ClustersFinder
-rw-r--r-- | spec/finders/clusters_finder_spec.rb | 33 |
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 |