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>2019-09-13 16:26:31 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2019-09-13 16:26:31 +0300
commitb7dfe2ae4054aa40e15182fd3c6cb7dd39f131db (patch)
tree5ab080ca9cadeb6cd9578bf301e4e9e8810bed9e /spec/support
parent25cb337cf12438169f1b14bc5dace8a06a7356e3 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/support')
-rw-r--r--spec/support/db_cleaner.rb2
-rw-r--r--spec/support/helpers/graphql_helpers.rb25
-rw-r--r--spec/support/helpers/ldap_helpers.rb2
-rw-r--r--spec/support/helpers/license_helper.rb2
-rw-r--r--spec/support/helpers/login_helpers.rb2
-rw-r--r--spec/support/helpers/migrations_helpers.rb2
-rw-r--r--spec/support/helpers/stub_configuration.rb2
-rw-r--r--spec/support/helpers/stub_gitlab_calls.rb2
-rw-r--r--spec/support/helpers/stub_object_storage.rb2
-rw-r--r--spec/support/helpers/test_env.rb5
-rw-r--r--spec/support/helpers/workhorse_helpers.rb3
-rw-r--r--spec/support/matchers/markdown_matchers.rb2
12 files changed, 50 insertions, 1 deletions
diff --git a/spec/support/db_cleaner.rb b/spec/support/db_cleaner.rb
index 041ffa25535..5da707b11f9 100644
--- a/spec/support/db_cleaner.rb
+++ b/spec/support/db_cleaner.rb
@@ -13,3 +13,5 @@ module DbCleaner
DatabaseCleaner[:active_record, { connection: ActiveRecord::Base }]
end
end
+
+DbCleaner.prepend_if_ee('EE::DbCleaner')
diff --git a/spec/support/helpers/graphql_helpers.rb b/spec/support/helpers/graphql_helpers.rb
index beb346b2855..4d2ad165fd6 100644
--- a/spec/support/helpers/graphql_helpers.rb
+++ b/spec/support/helpers/graphql_helpers.rb
@@ -172,6 +172,31 @@ module GraphqlHelpers
post_graphql(mutation.query, current_user: current_user, variables: mutation.variables)
end
+ # this implements GraphQL multipart request v2
+ # https://github.com/jaydenseric/graphql-multipart-request-spec/tree/v2.0.0-alpha.2
+ # this is simplified and do not support file deduplication
+ def mutation_to_apollo_uploads_param(mutation, files: [])
+ operations = { 'query' => mutation.query, 'variables' => mutation.variables }
+ map = {}
+ extracted_files = {}
+
+ files.each_with_index do |file_path, idx|
+ apollo_idx = (idx + 1).to_s
+ parent_dig_path = file_path[0..-2]
+ file_key = file_path[-1]
+
+ parent = operations['variables']
+ parent = parent.dig(*parent_dig_path) unless parent_dig_path.empty?
+
+ extracted_files[apollo_idx] = parent[file_key]
+ parent[file_key] = nil
+
+ map[apollo_idx] = ["variables.#{file_path.join('.')}"]
+ end
+
+ { operations: operations.to_json, map: map.to_json }.merge(extracted_files)
+ end
+
# Raises an error if no data is found
def graphql_data
json_response['data'] || (raise NoData, graphql_errors)
diff --git a/spec/support/helpers/ldap_helpers.rb b/spec/support/helpers/ldap_helpers.rb
index dce8a3803f5..0549c56c753 100644
--- a/spec/support/helpers/ldap_helpers.rb
+++ b/spec/support/helpers/ldap_helpers.rb
@@ -70,3 +70,5 @@ module LdapHelpers
.to receive(:ldap_search).and_raise(Gitlab::Auth::LDAP::LDAPConnectionError)
end
end
+
+LdapHelpers.include_if_ee('EE::LdapHelpers')
diff --git a/spec/support/helpers/license_helper.rb b/spec/support/helpers/license_helper.rb
index 4aaad55a8ef..a1defba9ccb 100644
--- a/spec/support/helpers/license_helper.rb
+++ b/spec/support/helpers/license_helper.rb
@@ -6,3 +6,5 @@ module LicenseHelpers
# do nothing
end
end
+
+LicenseHelpers.prepend_if_ee('EE::LicenseHelpers')
diff --git a/spec/support/helpers/login_helpers.rb b/spec/support/helpers/login_helpers.rb
index 2b508ee6f2c..140ad173d38 100644
--- a/spec/support/helpers/login_helpers.rb
+++ b/spec/support/helpers/login_helpers.rb
@@ -211,3 +211,5 @@ module LoginHelpers
allow(Gitlab::Auth::Saml::Config).to receive_messages({ options: { name: 'saml', groups_attribute: 'groups', external_groups: groups, args: {} } })
end
end
+
+LoginHelpers.prepend_if_ee('EE::LoginHelpers')
diff --git a/spec/support/helpers/migrations_helpers.rb b/spec/support/helpers/migrations_helpers.rb
index 2727ab7fb1e..a3145ed91bd 100644
--- a/spec/support/helpers/migrations_helpers.rb
+++ b/spec/support/helpers/migrations_helpers.rb
@@ -133,3 +133,5 @@ module MigrationsHelpers
end
end
end
+
+MigrationsHelpers.prepend_if_ee('EE::MigrationsHelpers')
diff --git a/spec/support/helpers/stub_configuration.rb b/spec/support/helpers/stub_configuration.rb
index f364e4fd158..0dc6e851190 100644
--- a/spec/support/helpers/stub_configuration.rb
+++ b/spec/support/helpers/stub_configuration.rb
@@ -149,3 +149,5 @@ end
require_relative '../../../ee/spec/support/helpers/ee/stub_configuration' if
Dir.exist?("#{__dir__}/../../../ee")
+
+StubConfiguration.prepend_if_ee('EE::StubConfiguration')
diff --git a/spec/support/helpers/stub_gitlab_calls.rb b/spec/support/helpers/stub_gitlab_calls.rb
index 7d10cffe920..e3dde888277 100644
--- a/spec/support/helpers/stub_gitlab_calls.rb
+++ b/spec/support/helpers/stub_gitlab_calls.rb
@@ -139,3 +139,5 @@ module StubGitlabCalls
JSON.parse f
end
end
+
+StubGitlabCalls.prepend_if_ee('EE::StubGitlabCalls')
diff --git a/spec/support/helpers/stub_object_storage.rb b/spec/support/helpers/stub_object_storage.rb
index e5b8bb712bb..3f7002b8768 100644
--- a/spec/support/helpers/stub_object_storage.rb
+++ b/spec/support/helpers/stub_object_storage.rb
@@ -78,3 +78,5 @@ end
require_relative '../../../ee/spec/support/helpers/ee/stub_object_storage' if
Dir.exist?("#{__dir__}/../../../ee")
+
+StubObjectStorage.prepend_if_ee('EE::StubObjectStorage')
diff --git a/spec/support/helpers/test_env.rb b/spec/support/helpers/test_env.rb
index 8ca362ce2df..3274651ef19 100644
--- a/spec/support/helpers/test_env.rb
+++ b/spec/support/helpers/test_env.rb
@@ -418,3 +418,8 @@ module TestEnv
true
end
end
+
+require_relative('../../../ee/spec/support/helpers/ee/test_env') if Gitlab.ee?
+
+::TestEnv.prepend_if_ee('::EE::TestEnv')
+::TestEnv.extend_if_ee('::EE::TestEnv')
diff --git a/spec/support/helpers/workhorse_helpers.rb b/spec/support/helpers/workhorse_helpers.rb
index fdbfe53fa39..40007a14b85 100644
--- a/spec/support/helpers/workhorse_helpers.rb
+++ b/spec/support/helpers/workhorse_helpers.rb
@@ -29,7 +29,8 @@ module WorkhorseHelpers
post(url,
params: workhorse_params,
- headers: workhorse_rewritten_fields_header('file' => file.path)
+ headers: workhorse_rewritten_fields_header(file_key => file.path),
+ env: { 'CONTENT_TYPE' => 'multipart/form-data' }
)
end
diff --git a/spec/support/matchers/markdown_matchers.rb b/spec/support/matchers/markdown_matchers.rb
index 12e8fa83a60..3245f8418b1 100644
--- a/spec/support/matchers/markdown_matchers.rb
+++ b/spec/support/matchers/markdown_matchers.rb
@@ -230,3 +230,5 @@ module RSpec::Matchers::DSL::Macros
end
end
end
+
+MarkdownMatchers.prepend_if_ee('EE::MarkdownMatchers')