Commit 750a3160 authored by Nikola Milojevic's avatar Nikola Milojevic

Merge branch '336970-improve-add-spent-time-error' into 'master'

Imrpove model validation when adding spent time

See merge request gitlab-org/gitlab!66973
parents 07c969c1 4d8f719c
......@@ -20,7 +20,7 @@ module TimeTrackable
validates :time_estimate, numericality: { message: 'has an invalid format' }, allow_nil: false
validate :check_negative_time_spent
has_many :timelogs, dependent: :destroy # rubocop:disable Cop/ActiveRecordDependent
has_many :timelogs, dependent: :destroy, autosave: true # rubocop:disable Cop/ActiveRecordDependent
end
# rubocop:disable Gitlab/ModuleWithInstanceVariables
......
......@@ -31,6 +31,7 @@ RSpec.describe Issue do
it { is_expected.to have_and_belong_to_many(:self_managed_prometheus_alert_events) }
it { is_expected.to have_many(:prometheus_alerts) }
it { is_expected.to have_many(:issue_email_participants) }
it { is_expected.to have_many(:timelogs).autosave(true) }
describe 'versions.most_recent' do
it 'returns the most recent version' do
......
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