From 95b296f8ac8578e142efd6a60a582be4da5b09be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matija=20=C4=8Cupi=C4=87?= Date: Fri, 7 Sep 2018 21:18:26 +0200 Subject: Change ExternalFile to retrieve local file from repository instead of GitLab project CE mirror of 03c6094997023d9c8875ced421a6c9ef39a4af44 --- spec/lib/gitlab/ci/config_spec.rb | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'spec/lib/gitlab/ci/config_spec.rb') diff --git a/spec/lib/gitlab/ci/config_spec.rb b/spec/lib/gitlab/ci/config_spec.rb index 57354e12aa3..b1c801ff052 100644 --- a/spec/lib/gitlab/ci/config_spec.rb +++ b/spec/lib/gitlab/ci/config_spec.rb @@ -127,6 +127,17 @@ describe Gitlab::Ci::Config do end context "when yml has valid 'includes' defined" do + let(:http_file_content) do + <<~HEREDOC + variables: + AUTO_DEVOPS_DOMAIN: domain.example.com + POSTGRES_USER: user + POSTGRES_PASSWORD: testing-password + POSTGRES_ENABLED: "true" + POSTGRES_DB: $CI_ENVIRONMENT_SLUG + HEREDOC + end + let(:local_file_content) { File.read("#{Rails.root}/spec/ee/fixtures/gitlab/ci/external_files/.gitlab-ci-template-1.yml") } let(:yml) do <<-EOS includes: @@ -139,7 +150,8 @@ describe Gitlab::Ci::Config do end before do - allow_any_instance_of(Kernel).to receive_message_chain(:open, :read).and_return(yml) + allow_any_instance_of(::Gitlab::Ci::ExternalFiles::ExternalFile).to receive(:local_file_content).and_return(local_file_content) + allow_any_instance_of(Kernel).to receive_message_chain(:open, :read).and_return(http_file_content) end it 'should return a composed hash' do @@ -167,7 +179,7 @@ describe Gitlab::Ci::Config do end end - context "when config has invalid 'includes' defined" do + context "when yml has invalid 'includes' defined" do let(:yml) do <<-EOS includes: invalid -- cgit v1.2.1