diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2018-04-06 12:10:30 +0200 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2018-04-06 12:10:30 +0200 |
commit | 8fc9ff7f131aa850ce4b1a8cb86ab4fa9b46410d (patch) | |
tree | 95c22b6ac9ac55566eb12b5aee39ae6b020f8445 /spec/models/environment_spec.rb | |
parent | 2faf991f31aceb1c34a3855695d25fab19203e36 (diff) | |
download | gitlab-ce-8fc9ff7f131aa850ce4b1a8cb86ab4fa9b46410d.tar.gz |
Fix environment deployment platform filter method
Diffstat (limited to 'spec/models/environment_spec.rb')
-rw-r--r-- | spec/models/environment_spec.rb | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/spec/models/environment_spec.rb b/spec/models/environment_spec.rb index 412eca4a56b..56161bfcc28 100644 --- a/spec/models/environment_spec.rb +++ b/spec/models/environment_spec.rb @@ -368,6 +368,32 @@ describe Environment do end end + describe '#deployment_platform' do + context 'when there is a deployment platform for environment' do + let!(:cluster) do + create(:cluster, :provided_by_gcp, + environment_scope: '*', projects: [project]) + end + + it 'finds a deployment platform' do + expect(environment.deployment_platform).to eq cluster.platform + end + end + + context 'when there is no deployment platform for environment' do + it 'returns nil' do + expect(environment.deployment_platform).to be_nil + end + end + + it 'checks deployment platforms associated with a project' do + expect(project).to receive(:deployment_platform) + .with(environment: environment.name) + + environment.deployment_platform + end + end + describe '#terminals' do subject { environment.terminals } |