summaryrefslogtreecommitdiff
path: root/spec/models
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2018-03-03 05:59:40 -0800
committerStan Hu <stanhu@gmail.com>2018-03-05 19:11:50 -0800
commit9cb7e93f09b1ff0c1c889a004479a8ef21abbae2 (patch)
tree00a0c5f114a481b19de02767ebba16fb9521c474 /spec/models
parent8a0052c037f025b64159ca8cfe0d3451261c1edb (diff)
downloadgitlab-ce-9cb7e93f09b1ff0c1c889a004479a8ef21abbae2.tar.gz
Fix project dashboard showing the wrong timestampssh-dashboard-sort-fix
Use the max of the `last_activity_at` and `last_repository_updated_at` columns. The latter is updated only when a push happens, but the former is updated whenever any activity (e.g. issue creation) happens. Closes #27181
Diffstat (limited to 'spec/models')
-rw-r--r--spec/models/project_spec.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb
index f4faec9e52a..27bb1a2e3bd 100644
--- a/spec/models/project_spec.rb
+++ b/spec/models/project_spec.rb
@@ -517,6 +517,20 @@ describe Project do
it 'returns the project\'s last update date if it has no events' do
expect(project.last_activity_date).to eq(project.updated_at)
end
+
+ it 'returns the most recent timestamp' do
+ project.update_attributes(updated_at: nil,
+ last_activity_at: timestamp,
+ last_repository_updated_at: timestamp - 1.hour)
+
+ expect(project.last_activity_date).to eq(timestamp)
+
+ project.update_attributes(updated_at: timestamp,
+ last_activity_at: timestamp - 1.hour,
+ last_repository_updated_at: nil)
+
+ expect(project.last_activity_date).to eq(timestamp)
+ end
end
end