Set last_repository_updated_at to created_at upon project creation
This commit is contained in:
parent
341964da45
commit
56db54d3e5
|
@ -53,6 +53,11 @@ class Project < ActiveRecord::Base
|
|||
update_column(:last_activity_at, self.created_at)
|
||||
end
|
||||
|
||||
after_create :set_last_repository_updated_at
|
||||
def set_last_repository_updated_at
|
||||
update_column(:last_repository_updated_at, self.created_at)
|
||||
end
|
||||
|
||||
after_destroy :remove_pages
|
||||
|
||||
# update visibility_level of forks
|
||||
|
|
|
@ -1925,4 +1925,12 @@ describe Project, models: true do
|
|||
not_to raise_error
|
||||
end
|
||||
end
|
||||
|
||||
describe '#last_repository_updated_at' do
|
||||
it 'sets to created_at upon creation' do
|
||||
project = create(:empty_project, created_at: 2.hours.ago)
|
||||
|
||||
expect(project.last_repository_updated_at.to_i).to eq(project.created_at.to_i)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue