Skip to content
Snippets Groups Projects
Commit 8581df3b authored by Yorick Peterse's avatar Yorick Peterse
Browse files

Merge branch 'sh-fix-events-update-spec' into 'master'

Fix Event#reset_project_activity updates

See merge request !6729
parents 0876b460 16626409
No related branches found
No related tags found
1 merge request!789Merge CacheMarkdownField to EE
Loading
Loading
@@ -335,7 +335,7 @@ def reset_project_activity
# update the project. Only one query should actually perform the update,
# hence we add the extra WHERE clause for last_activity_at.
Project.unscoped.where(id: project_id).
where('last_activity_at > ?', RESET_PROJECT_ACTIVITY_INTERVAL.ago).
where('last_activity_at <= ?', RESET_PROJECT_ACTIVITY_INTERVAL.ago).
update_all(last_activity_at: created_at)
end
 
Loading
Loading
Loading
Loading
@@ -308,7 +308,9 @@
end
 
describe 'last_activity methods' do
let(:project) { create(:project, last_activity_at: 2.hours.ago) }
let(:timestamp) { 2.hours.ago }
# last_activity_at gets set to created_at upon creation
let(:project) { create(:project, created_at: timestamp, updated_at: timestamp) }
 
describe 'last_activity' do
it 'alias last_activity to last_event' do
Loading
Loading
@@ -322,6 +324,7 @@
it 'returns the creation date of the project\'s last event if present' do
new_event = create(:event, project: project, created_at: Time.now)
 
project.reload
expect(project.last_activity_at.to_i).to eq(new_event.created_at.to_i)
end
 
Loading
Loading
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