diff options
author | Kamil Trzciński <ayufan@ayufan.eu> | 2018-04-06 13:38:29 +0000 |
---|---|---|
committer | Kamil Trzciński <ayufan@ayufan.eu> | 2018-04-06 13:38:29 +0000 |
commit | 80e04c3c47ca600fa6dab31540dbe96bf423387b (patch) | |
tree | 03f7364799ef7f98b239ff9b0ac58bcd23b8d0db /spec | |
parent | 788941616b8f65069db0e4a2c07bbebb4739b2ee (diff) | |
parent | 8fc9ff7f131aa850ce4b1a8cb86ab4fa9b46410d (diff) | |
download | gitlab-ce-80e04c3c47ca600fa6dab31540dbe96bf423387b.tar.gz |
Merge branch 'fix/gb/fix-deployment-platform-for-environment' into 'master'
Fix environment deployment platform filter method
See merge request gitlab-org/gitlab-ce!18216
Diffstat (limited to 'spec')
-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 } |