BigW Consortium Gitlab

Commit c47b947a by Jacob Vosmaer

Move GitHooksService tests

parent dc7c6bed
require 'spec_helper' require 'spec_helper'
describe Gitlab::Git::HooksService do describe Gitlab::Git::HooksService, seed_helper: true do
include RepoHelpers let(:committer) { Gitlab::Git::Committer.new('Jane Doe', 'janedoe@example.com', 'user-456') }
let(:repository) { Gitlab::Git::Repository.new('default', TEST_REPO_PATH, 'project-123') }
let(:user) { create(:user) }
let(:project) { create(:project, :repository) }
let(:service) { described_class.new } let(:service) { described_class.new }
before do before do
@blankrev = Gitlab::Git::BLANK_SHA @blankrev = Gitlab::Git::BLANK_SHA
@oldrev = sample_commit.parent_id @oldrev = SeedRepo::Commit::PARENT_ID
@newrev = sample_commit.id @newrev = SeedRepo::Commit::ID
@ref = 'refs/heads/feature' @ref = 'refs/heads/feature'
end end
...@@ -20,7 +18,7 @@ describe Gitlab::Git::HooksService do ...@@ -20,7 +18,7 @@ describe Gitlab::Git::HooksService do
hook = double(trigger: [true, nil]) hook = double(trigger: [true, nil])
expect(Gitlab::Git::Hook).to receive(:new).exactly(3).times.and_return(hook) expect(Gitlab::Git::Hook).to receive(:new).exactly(3).times.and_return(hook)
service.execute(user, project, @blankrev, @newrev, @ref) { } service.execute(committer, repository, @blankrev, @newrev, @ref) { }
end end
end end
...@@ -30,7 +28,7 @@ describe Gitlab::Git::HooksService do ...@@ -30,7 +28,7 @@ describe Gitlab::Git::HooksService do
expect(service).not_to receive(:run_hook).with('post-receive') expect(service).not_to receive(:run_hook).with('post-receive')
expect do expect do
service.execute(user, project, @blankrev, @newrev, @ref) service.execute(committer, repository, @blankrev, @newrev, @ref)
end.to raise_error(Gitlab::Git::HooksService::PreReceiveError) end.to raise_error(Gitlab::Git::HooksService::PreReceiveError)
end end
end end
...@@ -42,7 +40,7 @@ describe Gitlab::Git::HooksService do ...@@ -42,7 +40,7 @@ describe Gitlab::Git::HooksService do
expect(service).not_to receive(:run_hook).with('post-receive') expect(service).not_to receive(:run_hook).with('post-receive')
expect do expect do
service.execute(user, project, @blankrev, @newrev, @ref) service.execute(committer, repository, @blankrev, @newrev, @ref)
end.to raise_error(Gitlab::Git::HooksService::PreReceiveError) end.to raise_error(Gitlab::Git::HooksService::PreReceiveError)
end 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