Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2016-10-07 01:50:29 +0300
committerStan Hu <stanhu@gmail.com>2016-10-07 08:56:07 +0300
commit1662640985b56390a4d22dab1fee7fd04ccd5bc8 (patch)
tree82f19f1a7071d29a69f51c2f75e1acb3074dd0aa /spec/models
parenta625757cb469612409d47326241818ddf4fca982 (diff)
Fix Event#reset_project_activity updates
!6678 removed the lease from Event#reset_project_activity, but it wasn't actually updating the project's last_activity_at timestamp properly. The WHERE clause would always return no matching projects. The spec passed occasionally because the created_at timestamp was automatically set to last_activity_at.
Diffstat (limited to 'spec/models')
-rw-r--r--spec/models/project_spec.rb5
1 files changed, 4 insertions, 1 deletions
diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb
index e52d4aaf884..67a968aaf11 100644
--- a/spec/models/project_spec.rb
+++ b/spec/models/project_spec.rb
@@ -308,7 +308,9 @@ describe Project, models: true do
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
@@ -322,6 +324,7 @@ describe Project, models: true do
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