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-02-19 18:09:09 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-02-19 18:09:09 +0300
commitc7e385e282bcb8505589bce526e692b7bb819ffa (patch)
tree3e64affe1c2eebdcaa18cc6319b603f44b03b07e /spec/lib/gitlab/utils
parentcd3e2c7b9355f8990ab294b34b5e4add4f3985fa (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/lib/gitlab/utils')
-rw-r--r--spec/lib/gitlab/utils/log_limited_array_spec.rb22
1 files changed, 18 insertions, 4 deletions
diff --git a/spec/lib/gitlab/utils/log_limited_array_spec.rb b/spec/lib/gitlab/utils/log_limited_array_spec.rb
index 2729b2c7b6f..a236ab37614 100644
--- a/spec/lib/gitlab/utils/log_limited_array_spec.rb
+++ b/spec/lib/gitlab/utils/log_limited_array_spec.rb
@@ -18,12 +18,26 @@ describe Gitlab::Utils::LogLimitedArray do
end
context 'when the array exceeds the limit' do
- it 'replaces arguments after the limit with an ellipsis string' do
+ let(:long_array) do
half_limit = described_class::MAXIMUM_ARRAY_LENGTH / 2
- long_array = ['a' * half_limit, 'b' * half_limit, 'c']
- expect(described_class.log_limited_array(long_array))
- .to eq(long_array.take(1) + ['...'])
+ ['a' * half_limit, 'b' * half_limit, 'c']
+ end
+
+ context 'when no sentinel value is passed' do
+ it 'replaces arguments after the limit with an ellipsis string' do
+ expect(described_class.log_limited_array(long_array))
+ .to eq(long_array.take(1) + ['...'])
+ end
+ end
+
+ context 'when a sentinel value is passed' do
+ it 'replaces arguments after the limit with the sentinel' do
+ sentinel = { truncated: true }
+
+ expect(described_class.log_limited_array(long_array, sentinel: sentinel))
+ .to eq(long_array.take(1) + [sentinel])
+ end
end
end