summaryrefslogtreecommitdiff
path: root/spec/support/helpers/global_id_deprecation_helpers.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-06-16 18:25:58 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2021-06-16 18:25:58 +0000
commita5f4bba440d7f9ea47046a0a561d49adf0a1e6d4 (patch)
treefb69158581673816a8cd895f9d352dcb3c678b1e /spec/support/helpers/global_id_deprecation_helpers.rb
parentd16b2e8639e99961de6ddc93909f3bb5c1445ba1 (diff)
downloadgitlab-ce-a5f4bba440d7f9ea47046a0a561d49adf0a1e6d4.tar.gz
Add latest changes from gitlab-org/gitlab@14-0-stable-eev14.0.0-rc42
Diffstat (limited to 'spec/support/helpers/global_id_deprecation_helpers.rb')
-rw-r--r--spec/support/helpers/global_id_deprecation_helpers.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/spec/support/helpers/global_id_deprecation_helpers.rb b/spec/support/helpers/global_id_deprecation_helpers.rb
new file mode 100644
index 00000000000..37ba1420fb3
--- /dev/null
+++ b/spec/support/helpers/global_id_deprecation_helpers.rb
@@ -0,0 +1,13 @@
+# frozen_string_literal: true
+
+module GlobalIDDeprecationHelpers
+ def stub_global_id_deprecations(*deprecations)
+ old_name_map = deprecations.index_by(&:old_model_name)
+ new_name_map = deprecations.index_by(&:new_model_name)
+ old_graphql_name_map = deprecations.index_by { |d| Types::GlobalIDType.model_name_to_graphql_name(d.old_model_name) }
+
+ stub_const('Gitlab::GlobalId::Deprecations::OLD_NAME_MAP', old_name_map)
+ stub_const('Gitlab::GlobalId::Deprecations::NEW_NAME_MAP', new_name_map)
+ stub_const('Gitlab::GlobalId::Deprecations::OLD_GRAPHQL_NAME_MAP', old_graphql_name_map)
+ end
+end