# frozen_string_literal: truerequire'spec_helper'describeGitlab::Metrics::Dashboard::DynamicDashboardService,:use_clean_rails_memory_store_cachingdoincludeMetricsDashboardHelpersset(:project){build(:project)}set(:environment){create(:environment,project: project)}describe'#get_dashboard'dolet(:service_params){[project,nil,{environment: environment,dashboard_path: nil}]}let(:service_call){described_class.new(*service_params).get_dashboard}it_behaves_like'valid embedded dashboard service response'it'caches the unprocessed dashboard for subsequent calls'doexpect(YAML).toreceive(:safe_load).once.and_call_originaldescribed_class.new(*service_params).get_dashboarddescribed_class.new(*service_params).get_dashboardendcontext'when called with a non-system dashboard'dolet(:dashboard_path){'garbage/dashboard/path'}it_behaves_like'valid embedded dashboard service response'endendend