diff options
author | Robert Speicher <robert@gitlab.com> | 2017-06-08 22:39:28 +0000 |
---|---|---|
committer | Robert Speicher <robert@gitlab.com> | 2017-06-08 22:39:28 +0000 |
commit | c28ba5aa72e52182ae002ba3941e25869f69f561 (patch) | |
tree | 2214670eea08fe6c87ee69c46f3ae7b5aea3b11c /spec | |
parent | edd8d91194ce79cb5d77973c40436b98eb4d97fc (diff) | |
parent | 3fd02428d42546bbfc753130e1bc7d1c1f0fa83a (diff) | |
download | gitlab-ce-c28ba5aa72e52182ae002ba3941e25869f69f561.tar.gz |
Merge branch 'port-post-receive-changes' into 'master'
Refactor PostReceive worker to limit merge conflicts
See merge request !11916
Diffstat (limited to 'spec')
-rw-r--r-- | spec/workers/post_receive_spec.rb | 29 |
1 files changed, 13 insertions, 16 deletions
diff --git a/spec/workers/post_receive_spec.rb b/spec/workers/post_receive_spec.rb index f4bc63bcc6a..44163c735ba 100644 --- a/spec/workers/post_receive_spec.rb +++ b/spec/workers/post_receive_spec.rb @@ -94,26 +94,23 @@ describe PostReceive do it { expect{ subject }.not_to change{ Ci::Pipeline.count } } end 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 + context 'after project changes hooks' do + let(:changes) { '123456 789012 refs/heads/tést' } + let(:fake_hook_data) { Hash.new(event_name: 'repository_update') } - 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 + before do + 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_any_instance_of(GitPushService).to receive(:execute).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) + 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) + described_class.new.perform(project_identifier, key_id, base64_changes) + end end end |