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>2020-01-31 12:08:53 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-01-31 12:08:53 +0300
commitfd3a95f07ae9cd78fecffcfa5de4494f933a7808 (patch)
treea38a8abb0afb14aa396edd30137ddf45e71d2713 /spec/lib/gitlab/batch_worker_context_spec.rb
parent6a7005feed2e88568f42627e7190ff5c4f2aa8d3 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/lib/gitlab/batch_worker_context_spec.rb')
-rw-r--r--spec/lib/gitlab/batch_worker_context_spec.rb28
1 files changed, 28 insertions, 0 deletions
diff --git a/spec/lib/gitlab/batch_worker_context_spec.rb b/spec/lib/gitlab/batch_worker_context_spec.rb
new file mode 100644
index 00000000000..0ba30287ae5
--- /dev/null
+++ b/spec/lib/gitlab/batch_worker_context_spec.rb
@@ -0,0 +1,28 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+describe Gitlab::BatchWorkerContext do
+ subject(:batch_context) do
+ described_class.new(
+ %w(hello world),
+ arguments_proc: -> (word) { word },
+ context_proc: -> (word) { { user: build_stubbed(:user, username: word) } }
+ )
+ end
+
+ describe "#arguments" do
+ it "returns all the expected arguments in arrays" do
+ expect(batch_context.arguments).to eq([%w(hello), %w(world)])
+ end
+ end
+
+ describe "#context_for" do
+ it "returns the correct application context for the arguments" do
+ context = batch_context.context_for(%w(world))
+
+ expect(context).to be_a(Gitlab::ApplicationContext)
+ expect(context.to_lazy_hash[:user].call).to eq("world")
+ end
+ end
+end