summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorRobert Speicher <robert@gitlab.com>2017-06-27 17:04:02 +0000
committerRobert Speicher <robert@gitlab.com>2017-06-27 17:04:02 +0000
commitb790506144e91eed158b782bc0247b1acca7f9d4 (patch)
tree10c651a26b68490214484a646de94a9f0cccebf5 /spec
parentcc50decab5b22628eafb6636b3e57f99094c7926 (diff)
parenta89c1bf645e4ca0ccc5df9d26c196652a247e82a (diff)
downloadgitlab-ce-b790506144e91eed158b782bc0247b1acca7f9d4.tar.gz
Merge branch '34276-fix-dashboard-page-when-last-activity-at-is-nil' into 'master'
Fix application error when Project#last_activity_at is nil Closes #34276 See merge request !12443
Diffstat (limited to 'spec')
-rw-r--r--spec/features/dashboard/projects_spec.rb22
1 files changed, 17 insertions, 5 deletions
diff --git a/spec/features/dashboard/projects_spec.rb b/spec/features/dashboard/projects_spec.rb
index 2a8185ca669..f29186f368d 100644
--- a/spec/features/dashboard/projects_spec.rb
+++ b/spec/features/dashboard/projects_spec.rb
@@ -15,13 +15,25 @@ RSpec.describe 'Dashboard Projects', feature: true do
expect(page).to have_content('awesome stuff')
end
- it 'shows the last_activity_at attribute as the update date' do
- now = Time.now
- project.update_column(:last_activity_at, now)
+ context 'when last_repository_updated_at, last_activity_at and update_at are present' do
+ it 'shows the last_repository_updated_at attribute as the update date' do
+ project.update_attributes!(last_repository_updated_at: Time.now, last_activity_at: 1.hour.ago)
- visit dashboard_projects_path
+ visit dashboard_projects_path
+
+ expect(page).to have_xpath("//time[@datetime='#{project.last_repository_updated_at.getutc.iso8601}']")
+ end
+ end
- expect(page).to have_xpath("//time[@datetime='#{now.getutc.iso8601}']")
+ context 'when last_repository_updated_at and last_activity_at are missing' do
+ it 'shows the updated_at attribute as the update date' do
+ project.update_attributes!(last_repository_updated_at: nil, last_activity_at: nil)
+ project.touch
+
+ visit dashboard_projects_path
+
+ expect(page).to have_xpath("//time[@datetime='#{project.updated_at.getutc.iso8601}']")
+ end
end
context 'when on Starred projects tab' do