diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-09-20 14:18:08 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-09-20 14:18:08 +0300 |
commit | 5afcbe03ead9ada87621888a31a62652b10a7e4f (patch) | |
tree | 9918b67a0d0f0bafa6542e839a8be37adf73102d /gems/click_house-client/spec/click_house/client/bind_index_manager_spec.rb | |
parent | c97c0201564848c1f53226fe19d71fdcc472f7d0 (diff) |
Add latest changes from gitlab-org/gitlab@16-4-stable-eev16.4.0-rc42
Diffstat (limited to 'gems/click_house-client/spec/click_house/client/bind_index_manager_spec.rb')
-rw-r--r-- | gems/click_house-client/spec/click_house/client/bind_index_manager_spec.rb | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/gems/click_house-client/spec/click_house/client/bind_index_manager_spec.rb b/gems/click_house-client/spec/click_house/client/bind_index_manager_spec.rb new file mode 100644 index 00000000000..38e0865676a --- /dev/null +++ b/gems/click_house-client/spec/click_house/client/bind_index_manager_spec.rb @@ -0,0 +1,33 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe ClickHouse::Client::BindIndexManager do + describe '#next_bind_str' do + context 'when initialized without a start index' do + let(:bind_manager) { described_class.new } + + it 'starts from index 1 by default' do + expect(bind_manager.next_bind_str).to eq('$1') + end + + it 'increments the bind string on subsequent calls' do + bind_manager.next_bind_str + expect(bind_manager.next_bind_str).to eq('$2') + end + end + + context 'when initialized with a start index' do + let(:bind_manager) { described_class.new(2) } + + it 'starts from the given index' do + expect(bind_manager.next_bind_str).to eq('$2') + end + + it 'increments the bind string on subsequent calls' do + bind_manager.next_bind_str + expect(bind_manager.next_bind_str).to eq('$3') + end + end + end +end |