Commit 2fe9ee6a authored by drew cimino's avatar drew cimino

Consolidate stub helpers and use them consistently

parent 5d7fa282
......@@ -44,7 +44,7 @@ RSpec.describe Gitlab::Chat::Command do
let(:pipeline) { command.create_pipeline }
before do
stub_ci_pipeline_yaml_file(gitlab_ci_yaml)
stub_ci_pipeline_to_return_yaml_file
project.add_developer(chat_name.user)
end
......
......@@ -11,7 +11,7 @@ RSpec.describe Ci::CreatePipelineService do
let(:ref_name) { 'refs/heads/master' }
before do
stub_ci_pipeline_yaml_file(gitlab_ci_yaml)
stub_ci_pipeline_to_return_yaml_file
end
describe '#execute' do
......
......@@ -160,7 +160,6 @@ RSpec.configure do |config|
config.include GitlabRoutingHelper
config.include StubExperiments
config.include StubGitlabCalls
config.include StubGitlabData
config.include NextFoundInstanceOf
config.include NextInstanceOf
config.include TestEnv
......
......@@ -18,6 +18,10 @@ module StubGitlabCalls
stub_ci_pipeline_yaml_file(gitlab_ci_yaml)
end
def gitlab_ci_yaml
File.read(Rails.root.join('spec/support/gitlab_stubs/gitlab_ci.yml'))
end
def stub_ci_pipeline_yaml_file(ci_yaml_content)
allow_any_instance_of(Repository)
.to receive(:gitlab_ci_yml_for)
......
# frozen_string_literal: true
module StubGitlabData
def gitlab_ci_yaml
File.read(Rails.root.join('spec/support/gitlab_stubs/gitlab_ci.yml'))
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