Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-06-24 18:07:28 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-06-24 18:07:28 +0300
commit8a37720edff0c74579bba2f8f985f37ed49ffa49 (patch)
tree5939d623b38cad881b10da15d8ecf9a7879d4b5d /spec/graphql
parentb4e7d9d8392d80b20acd29959c51e488220fd1e2 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/graphql')
-rw-r--r--spec/graphql/resolvers/ci/config_resolver_spec.rb20
1 files changed, 17 insertions, 3 deletions
diff --git a/spec/graphql/resolvers/ci/config_resolver_spec.rb b/spec/graphql/resolvers/ci/config_resolver_spec.rb
index 73e9fab9f99..97eee749290 100644
--- a/spec/graphql/resolvers/ci/config_resolver_spec.rb
+++ b/spec/graphql/resolvers/ci/config_resolver_spec.rb
@@ -15,14 +15,15 @@ RSpec.describe Resolvers::Ci::ConfigResolver do
let_it_be(:user) { create(:user) }
let_it_be(:project) { create(:project, :repository, creator: user, namespace: user.namespace) }
+ let_it_be(:sha) { nil }
subject(:response) do
resolve(described_class,
- args: { project_path: project.full_path, content: content },
+ args: { project_path: project.full_path, content: content, sha: sha },
ctx: { current_user: user })
end
- context 'with a valid .gitlab-ci.yml' do
+ shared_examples 'a valid config file' do
let(:fake_result) do
::Gitlab::Ci::Lint::Result.new(
merged_yaml: content,
@@ -37,9 +38,22 @@ RSpec.describe Resolvers::Ci::ConfigResolver do
end
it 'lints the ci config file and returns the merged yaml file' do
- expect(response[:merged_yaml]).to eq(content)
expect(response[:status]).to eq(:valid)
+ expect(response[:merged_yaml]).to eq(content)
expect(response[:errors]).to be_empty
+ expect(::Gitlab::Ci::Lint).to have_received(:new).with(current_user: user, project: project, sha: sha)
+ end
+ end
+
+ context 'with a valid .gitlab-ci.yml' do
+ context 'with a sha' do
+ let(:sha) { '1231231' }
+
+ it_behaves_like 'a valid config file'
+ end
+
+ context 'without a sha' do
+ it_behaves_like 'a valid config file'
end
end