diff options
Diffstat (limited to 'spec/serializers/environment_entity_spec.rb')
-rw-r--r-- | spec/serializers/environment_entity_spec.rb | 44 |
1 files changed, 28 insertions, 16 deletions
diff --git a/spec/serializers/environment_entity_spec.rb b/spec/serializers/environment_entity_spec.rb index cbe32600941..c60bead12c2 100644 --- a/spec/serializers/environment_entity_spec.rb +++ b/spec/serializers/environment_entity_spec.rb @@ -83,37 +83,49 @@ RSpec.describe EnvironmentEntity do end end - context 'metrics disabled' do + context 'when metrics dashboard feature is available' do before do - allow(environment).to receive(:has_metrics?).and_return(false) + stub_feature_flags(remove_monitor_metrics: false) end - it "doesn't expose metrics path" do - expect(subject).not_to include(:metrics_path) - end - end + context 'metrics disabled' do + before do + allow(environment).to receive(:has_metrics?).and_return(false) + end - context 'metrics enabled' do - before do - allow(environment).to receive(:has_metrics?).and_return(true) + it "doesn't expose metrics path" do + expect(subject).not_to include(:metrics_path) + end end - it 'exposes metrics path' do - expect(subject).to include(:metrics_path) + context 'metrics enabled' do + before do + allow(environment).to receive(:has_metrics?).and_return(true) + end + + it 'exposes metrics path' do + expect(subject).to include(:metrics_path) + end end end + it "doesn't expose metrics path" do + expect(subject).not_to include(:metrics_path) + end + context 'with deployment platform' do let(:project) { create(:project, :repository) } let(:environment) { create(:environment, project: project) } context 'when deployment platform is a cluster' do before do - create(:cluster, - :provided_by_gcp, - :project, - environment_scope: '*', - projects: [project]) + create( + :cluster, + :provided_by_gcp, + :project, + environment_scope: '*', + projects: [project] + ) end it 'includes cluster_type' do |