diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-01-31 12:08:53 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-01-31 12:08:53 +0300 |
commit | fd3a95f07ae9cd78fecffcfa5de4494f933a7808 (patch) | |
tree | a38a8abb0afb14aa396edd30137ddf45e71d2713 /spec/lib/gitlab/batch_worker_context_spec.rb | |
parent | 6a7005feed2e88568f42627e7190ff5c4f2aa8d3 (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.rb | 28 |
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 |