diff options
author | Douwe Maan <douwe@gitlab.com> | 2018-05-10 10:12:37 +0000 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2018-05-10 10:12:37 +0000 |
commit | 227814076399e63efde43ae36ee89504f52165c5 (patch) | |
tree | 661f9ccb6c714c9af82d1ff741e96f47b9faa377 /spec/models | |
parent | 3713867bfa1be1c5ce179a40f030228c29acd142 (diff) | |
parent | 890dc39ee0c92adb10a3221c2a564533e038a72c (diff) | |
download | gitlab-ce-227814076399e63efde43ae36ee89504f52165c5.tar.gz |
Merge branch '45442-updates-updated-at-to-issue-on-time-spent' into 'master'
Resolve "Update `updated_at` on an issue when label or time spent was added"
Closes #45442
See merge request gitlab-org/gitlab-ce!18757
Diffstat (limited to 'spec/models')
-rw-r--r-- | spec/models/concerns/issuable_spec.rb | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/spec/models/concerns/issuable_spec.rb b/spec/models/concerns/issuable_spec.rb index 05693f067e1..3d3092b8ac9 100644 --- a/spec/models/concerns/issuable_spec.rb +++ b/spec/models/concerns/issuable_spec.rb @@ -495,6 +495,14 @@ describe Issuable do expect(issue.total_time_spent).to eq(1800) end + + it 'updates issues updated_at' do + issue + + Timecop.travel(1.minute.from_now) do + expect { spend_time(1800) }.to change { issue.updated_at } + end + end end context 'substracting time' do @@ -510,9 +518,13 @@ describe Issuable do context 'when time to substract exceeds the total time spent' do it 'raise a validation error' do - expect do - spend_time(-3600) - end.to raise_error(ActiveRecord::RecordInvalid) + Timecop.travel(1.minute.from_now) do + expect do + expect do + spend_time(-3600) + end.to raise_error(ActiveRecord::RecordInvalid) + end.not_to change { issue.updated_at } + end end end end |