Welcome to mirror list, hosted at ThFree Co, Russian Federation.

database_spec.rb « client « click_house « spec « click_house-client « gems - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 112b2ee12b17482d5481ab5f436140748d5888b2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe ClickHouse::Client::Database do
  subject(:database) do
    described_class.new(
      database: 'test_db',
      url: 'http://localhost:3333',
      username: 'user',
      password: 'pass',
      variables: {
        join_use_nulls: 1
      }
    )
  end

  describe '#uri' do
    it 'builds the correct URL' do
      expect(database.uri.to_s).to eq('http://localhost:3333?database=test_db&join_use_nulls=1')
    end
  end

  describe '#headers' do
    it 'returns the correct headers' do
      expect(database.headers).to eq({
        'X-ClickHouse-User' => 'user',
        'X-ClickHouse-Key' => 'pass'
      })
    end
  end
end