Skip to content
Snippets Groups Projects
Commit 655821f3 authored by Lee Tickett's avatar Lee Tickett Committed by Stan Hu
Browse files

Set spent time when using timelogs API

parent 4831b598
No related branches found
No related tags found
1 merge request!76400Set spent time when using timelogs API
# frozen_string_literal: true
class UpdateTimelogsSpentAtDefault < Gitlab::Database::Migration[1.0]
def change
change_column_default(:timelogs, :spent_at, from: nil, to: -> { 'NOW()' })
end
end
2267855b2f12747b1f31f392677fac4d4f82ee234d7c54fd209b8bad417c8c75
\ No newline at end of file
......@@ -19916,7 +19916,7 @@ CREATE TABLE timelogs (
updated_at timestamp without time zone NOT NULL,
issue_id integer,
merge_request_id integer,
spent_at timestamp without time zone,
spent_at timestamp without time zone DEFAULT now(),
note_id integer,
project_id integer,
summary text,
......@@ -21,7 +21,7 @@
it { expect(subject.project_id).not_to be_nil }
describe 'Issuable validation' do
describe 'validation' do
it 'is invalid if issue_id and merge_request_id are missing' do
subject.attributes = { issue: nil, merge_request: nil }
......@@ -139,4 +139,14 @@ def just_after(time)
time + 1.day
end
end
describe 'hooks' do
describe '.set_project' do
it 'populates project with issuable project' do
timelog = create(:issue_timelog, issue: issue)
expect(timelog.project_id).to be(timelog.issue.project_id)
end
end
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment