summaryrefslogtreecommitdiff
path: root/spec/models/concerns
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-02-20 12:12:47 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2023-02-20 12:12:47 +0000
commitc984b0faf409dbe91a7998260fe4b8299cf21ad4 (patch)
treeb1e434732c9d94ecaab0727f56a811b80a61a371 /spec/models/concerns
parentbd28d0fa02dc73794e013159512900f8d10fa10b (diff)
downloadgitlab-ce-c984b0faf409dbe91a7998260fe4b8299cf21ad4.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/models/concerns')
-rw-r--r--spec/models/concerns/uniquify_spec.rb44
1 files changed, 0 insertions, 44 deletions
diff --git a/spec/models/concerns/uniquify_spec.rb b/spec/models/concerns/uniquify_spec.rb
deleted file mode 100644
index 9b79e4d4154..00000000000
--- a/spec/models/concerns/uniquify_spec.rb
+++ /dev/null
@@ -1,44 +0,0 @@
-# frozen_string_literal: true
-
-require 'spec_helper'
-
-RSpec.describe Uniquify do
- let(:uniquify) { described_class.new }
-
- describe "#string" do
- it 'returns the given string if it does not exist' do
- result = uniquify.string('test_string') { |s| false }
-
- expect(result).to eq('test_string')
- end
-
- it 'returns the given string with a counter attached if the string exists' do
- result = uniquify.string('test_string') { |s| s == 'test_string' }
-
- expect(result).to eq('test_string1')
- end
-
- it 'increments the counter for each candidate string that also exists' do
- result = uniquify.string('test_string') { |s| s == 'test_string' || s == 'test_string1' }
-
- expect(result).to eq('test_string2')
- end
-
- it 'allows to pass an initial value for the counter' do
- start_counting_from = 2
- uniquify = described_class.new(start_counting_from)
-
- result = uniquify.string('test_string') { |s| s == 'test_string' }
-
- expect(result).to eq('test_string2')
- end
-
- it 'allows passing in a base function that defines the location of the counter' do
- result = uniquify.string(-> (counter) { "test_#{counter}_string" }) do |s|
- s == 'test__string'
- end
-
- expect(result).to eq('test_1_string')
- end
- end
-end