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:
Diffstat (limited to 'spec/factories/gitlab/jwt_token.rb')
-rw-r--r--spec/factories/gitlab/jwt_token.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/spec/factories/gitlab/jwt_token.rb b/spec/factories/gitlab/jwt_token.rb
new file mode 100644
index 00000000000..bc00c6a5ff4
--- /dev/null
+++ b/spec/factories/gitlab/jwt_token.rb
@@ -0,0 +1,21 @@
+# frozen_string_literal: true
+
+FactoryBot.define do
+ factory :jwt_token, class: 'Gitlab::JWTToken' do
+ skip_create
+
+ initialize_with { new }
+
+ trait :with_custom_payload do
+ transient do
+ custom_payload { {} }
+ end
+
+ after(:build) do |jwt, evaluator|
+ evaluator.custom_payload.each do |key, value|
+ jwt[key] = value
+ end
+ end
+ end
+ end
+end