diff options
author | Douwe Maan <douwe@gitlab.com> | 2018-03-06 16:21:17 +0000 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2018-03-06 16:21:17 +0000 |
commit | 76658d06b4dcc48497a604b00e8870359790d1bc (patch) | |
tree | 1326f0c4ec3064131e430fc7fcfc261f5a0e1dd3 /spec | |
parent | 12bc2d8df0890fad3296b47395fb7279a11e43c1 (diff) | |
parent | 9cb7e93f09b1ff0c1c889a004479a8ef21abbae2 (diff) | |
download | gitlab-ce-76658d06b4dcc48497a604b00e8870359790d1bc.tar.gz |
Merge branch 'sh-dashboard-sort-fix' into 'master'
Fix project dashboard showing the wrong timestamps
Closes #27181
See merge request gitlab-org/gitlab-ce!17504
Diffstat (limited to 'spec')
-rw-r--r-- | spec/features/dashboard/projects_spec.rb | 8 | ||||
-rw-r--r-- | spec/models/project_spec.rb | 14 |
2 files changed, 22 insertions, 0 deletions
diff --git a/spec/features/dashboard/projects_spec.rb b/spec/features/dashboard/projects_spec.rb index 586c7b48d0b..986f864f0b5 100644 --- a/spec/features/dashboard/projects_spec.rb +++ b/spec/features/dashboard/projects_spec.rb @@ -37,6 +37,14 @@ feature 'Dashboard Projects' do expect(page).to have_xpath("//time[@datetime='#{project.last_repository_updated_at.getutc.iso8601}']") end + + it 'shows the last_activity_at attribute as the update date' do + project.update_attributes!(last_repository_updated_at: 1.hour.ago, last_activity_at: Time.now) + + visit dashboard_projects_path + + expect(page).to have_xpath("//time[@datetime='#{project.last_activity_at.getutc.iso8601}']") + end end context 'when last_repository_updated_at and last_activity_at are missing' do diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb index 92ea8841123..b1c9e6754b9 100644 --- a/spec/models/project_spec.rb +++ b/spec/models/project_spec.rb @@ -518,6 +518,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 |