diff options
author | Gabriel Mazetto <brodock@gmail.com> | 2017-05-03 05:36:13 +0300 |
---|---|---|
committer | Gabriel Mazetto <brodock@gmail.com> | 2017-05-13 01:26:48 +0300 |
commit | f661980904f718440cc700b7d1f38ea8bf0e5480 (patch) | |
tree | 7933eee3b85e6af5da9db8223b6d870d8395926f /spec/workers/post_receive_spec.rb | |
parent | 8b17fb61b61b1f9707428c2333db2de29c4d3bcf (diff) |
Added repository_update hook
Diffstat (limited to 'spec/workers/post_receive_spec.rb')
-rw-r--r-- | spec/workers/post_receive_spec.rb | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/spec/workers/post_receive_spec.rb b/spec/workers/post_receive_spec.rb index 0260416dbe2..3289c2df1fb 100644 --- a/spec/workers/post_receive_spec.rb +++ b/spec/workers/post_receive_spec.rb @@ -9,7 +9,7 @@ describe PostReceive do let(:key) { create(:key, user: project.owner) } let(:key_id) { key.shell_id } - context "as a resque worker" do + context "as a sidekiq worker" do it "reponds to #perform" do expect(described_class.new).to respond_to(:perform) end @@ -93,6 +93,27 @@ describe PostReceive do end end + describe '#process_repository_update' do + let(:changes) {'123456 789012 refs/heads/tést'} + let(:fake_hook_data) do + { event_name: 'repository_update' } + end + + before do + allow_any_instance_of(Gitlab::GitPostReceive).to receive(:identify).and_return(project.owner) + allow_any_instance_of(Gitlab::DataBuilder::Repository).to receive(:update).and_return(fake_hook_data) + # silence hooks so we can isolate + allow_any_instance_of(Key).to receive(:post_create_hook).and_return(true) + allow(subject).to receive(:process_project_changes).and_return(true) + end + + it 'calls SystemHooksService' do + expect_any_instance_of(SystemHooksService).to receive(:execute_hooks).with(fake_hook_data, :repository_update_hooks).and_return(true) + + subject.perform(pwd(project), key_id, base64_changes) + end + end + context "webhook" do it "fetches the correct project" do expect(Project).to receive(:find_by).with(id: project.id.to_s) |