summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorKamil Trzciński <ayufan@ayufan.eu>2018-04-06 13:38:29 +0000
committerKamil Trzciński <ayufan@ayufan.eu>2018-04-06 13:38:29 +0000
commit80e04c3c47ca600fa6dab31540dbe96bf423387b (patch)
tree03f7364799ef7f98b239ff9b0ac58bcd23b8d0db /spec
parent788941616b8f65069db0e4a2c07bbebb4739b2ee (diff)
parent8fc9ff7f131aa850ce4b1a8cb86ab4fa9b46410d (diff)
downloadgitlab-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.rb26
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 }