Update project activity when pushing to a wiki repository

This commit is contained in:
Douglas Barbosa Alexandre 2018-03-07 17:16:14 -03:00
parent 8033da7ae7
commit c0c3170381
No known key found for this signature in database
GPG key ID: F1E98EF6393565A0
2 changed files with 13 additions and 1 deletions

View file

@ -55,7 +55,7 @@ class PostReceive
end
def process_wiki_changes(post_received)
# Nothing defined here yet.
post_received.project.touch(:last_activity_at, :last_repository_updated_at)
end
def log(message)

View file

@ -114,6 +114,18 @@ describe PostReceive do
end
end
describe '#process_wiki_changes' do
let(:gl_repository) { "wiki-#{project.id}" }
it 'updates project activity' do
described_class.new.perform(gl_repository, key_id, base64_changes)
expect { project.reload }
.to change(project, :last_activity_at)
.and change(project, :last_repository_updated_at)
end
end
context "webhook" do
it "fetches the correct project" do
expect(Project).to receive(:find_by).with(id: project.id.to_s)