Commit b7f7c49f authored by Grzegorz Bizon's avatar Grzegorz Bizon

Fix environment deployment platform filter method / EE

parent 9e2184bd
...@@ -4,6 +4,7 @@ module DeploymentPlatform ...@@ -4,6 +4,7 @@ module DeploymentPlatform
def deployment_platform(environment: nil) def deployment_platform(environment: nil)
@deployment_platform ||= {} @deployment_platform ||= {}
return find_deployment_platform(environment)
@deployment_platform[environment] ||= find_deployment_platform(environment) @deployment_platform[environment] ||= find_deployment_platform(environment)
end end
......
...@@ -228,7 +228,7 @@ class Environment < ActiveRecord::Base ...@@ -228,7 +228,7 @@ class Environment < ActiveRecord::Base
end end
def deployment_platform def deployment_platform
project.deployment_platform(environment: self) project.deployment_platform(environment: self.name)
end end
private private
......
...@@ -368,6 +368,29 @@ describe Environment do ...@@ -368,6 +368,29 @@ describe Environment do
end end
end end
describe '#deployment_platform' do
before do
stub_licensed_features(multiple_clusters: true)
end
context 'when there is a deployment platform for environment' do
let!(:cluster) do
create(:cluster, :provided_by_gcp,
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
end
describe '#terminals' do describe '#terminals' do
subject { environment.terminals } subject { environment.terminals }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment