Commit a7fd4947 authored by Douglas Barbosa Alexandre's avatar Douglas Barbosa Alexandre Committed by Robert Speicher

Set last_repository_updated_at to created_at upon project creation

parent 5ffc8ffc
......@@ -56,6 +56,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
......
......@@ -2340,4 +2340,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
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment