summaryrefslogtreecommitdiff
path: root/spec/requests/api/graphql/ci/config_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/requests/api/graphql/ci/config_spec.rb')
-rw-r--r--spec/requests/api/graphql/ci/config_spec.rb62
1 files changed, 38 insertions, 24 deletions
diff --git a/spec/requests/api/graphql/ci/config_spec.rb b/spec/requests/api/graphql/ci/config_spec.rb
index 8154f132430..5f43a0806f3 100644
--- a/spec/requests/api/graphql/ci/config_spec.rb
+++ b/spec/requests/api/graphql/ci/config_spec.rb
@@ -5,6 +5,7 @@ require 'spec_helper'
RSpec.describe 'Query.ciConfig', feature_category: :continuous_integration do
include GraphqlHelpers
include StubRequests
+ include RepoHelpers
subject(:post_graphql_query) { post_graphql(query, current_user: user) }
@@ -245,17 +246,22 @@ RSpec.describe 'Query.ciConfig', feature_category: :continuous_integration do
)
end
- before do
- allow_next_instance_of(Repository) do |repository|
- allow(repository).to receive(:blob_data_at).with(an_instance_of(String), 'other_file.yml') do
- YAML.dump(
- build: {
- script: 'build'
- }
- )
- end
+ let(:project_files) do
+ {
+ 'other_file.yml' => <<~YAML
+ build:
+ script: build
+ YAML
+ }
+ end
+
+ around do |example|
+ create_and_delete_files(project, project_files) do
+ example.run
end
+ end
+ before do
post_graphql_query
end
@@ -370,25 +376,33 @@ RSpec.describe 'Query.ciConfig', feature_category: :continuous_integration do
)
end
- before do
- allow_next_instance_of(Repository) do |repository|
- allow(repository).to receive(:blob_data_at).with(an_instance_of(String), 'other_file.yml') do
- YAML.dump(
- build: {
- script: 'build'
- }
- )
- end
+ let(:project_files) do
+ {
+ 'other_file.yml' => <<~YAML
+ build:
+ script: build
+ YAML
+ }
+ end
- allow(repository).to receive(:blob_data_at).with(an_instance_of(String), 'other_project_file.yml') do
- YAML.dump(
- other_project_test: {
- script: 'other_project_test'
- }
- )
+ let(:other_project_files) do
+ {
+ 'other_project_file.yml' => <<~YAML
+ other_project_test:
+ script: other_project_test
+ YAML
+ }
+ end
+
+ around do |example|
+ create_and_delete_files(project, project_files) do
+ create_and_delete_files(other_project, other_project_files) do
+ example.run
end
end
+ end
+ before do
stub_full_request('https://gitlab.com/gitlab-org/gitlab/raw/1234/.hello.yml').to_return(body: remote_file_content)
post_graphql_query