Commit 35980e13 authored by Ryan Cobb's avatar Ryan Cobb

Build Project metrics_setting if not present

parent 7d270d47
...@@ -2410,6 +2410,10 @@ class Project < ApplicationRecord ...@@ -2410,6 +2410,10 @@ class Project < ApplicationRecord
touch(:last_activity_at, :last_repository_updated_at) touch(:last_activity_at, :last_repository_updated_at)
end end
def metrics_setting
super || build_metrics_setting
end
private private
def find_service(services, name) def find_service(services, name)
......
...@@ -6064,6 +6064,14 @@ describe Project do ...@@ -6064,6 +6064,14 @@ describe Project do
it { is_expected.not_to include(user) } it { is_expected.not_to include(user) }
end end
describe "#metrics_setting" do
let(:project) { build(:project) }
it 'creates setting if it does not exist' do
expect(project.metrics_setting).to be_an_instance_of(ProjectMetricsSetting)
end
end
def finish_job(export_job) def finish_job(export_job)
export_job.start export_job.start
export_job.finish export_job.finish
......
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