diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2017-10-10 10:11:19 +0200 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2017-10-10 10:11:19 +0200 |
commit | 20fc42e99a5e8c917feaa0c7a2d34aceba4a8eb9 (patch) | |
tree | 7a8490f54abbf60df0f9f7e699b12db586f0c1a6 /spec/workers | |
parent | 9ad48a7438048ca19ff847e5fa7f2ccd7c6d59af (diff) | |
download | gitlab-ce-20fc42e99a5e8c917feaa0c7a2d34aceba4a8eb9.tar.gz |
Improve post_receive spec by not stubbing private methods
Diffstat (limited to 'spec/workers')
-rw-r--r-- | spec/workers/post_receive_spec.rb | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/spec/workers/post_receive_spec.rb b/spec/workers/post_receive_spec.rb index 05eecf5f0bb..5d9b0679796 100644 --- a/spec/workers/post_receive_spec.rb +++ b/spec/workers/post_receive_spec.rb @@ -66,19 +66,21 @@ describe PostReceive do end context "gitlab-ci.yml" do + let(:changes) { "123456 789012 refs/heads/feature\n654321 210987 refs/tags/tag" } + subject { described_class.new.perform(gl_repository, key_id, base64_changes) } context "creates a Ci::Pipeline for every change" do before do stub_ci_pipeline_to_return_yaml_file - # TODO, don't stub private methods - # - allow_any_instance_of(Ci::CreatePipelineService) - .to receive(:commit).and_return(OpenStruct.new(id: '123456')) + allow_any_instance_of(Project) + .to receive(:commit) + .and_return(project.commit) allow_any_instance_of(Repository) - .to receive(:branch_exists?).and_return(true) + .to receive(:branch_exists?) + .and_return(true) end it { expect { subject }.to change { Ci::Pipeline.count }.by(2) } |