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

storage_settings_spec.rb « gitaly_client « gitlab « lib « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: f2f53982b0978448442667ef8cc6e9956b0ba299 (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
33
34
35
36
37
38
39
40
41
42
43
require 'spec_helper'

describe Gitlab::GitalyClient::StorageSettings do
  describe "#initialize" do
    context 'when the storage contains no path' do
      it 'raises an error' do
        expect do
          described_class.new("foo" => {})
        end.to raise_error(described_class::InvalidConfigurationError)
      end
    end

    context "when the argument isn't a hash" do
      it 'raises an error' do
        expect do
          described_class.new("test")
        end.to raise_error("expected a Hash, got a String")
      end
    end

    context 'when the storage is valid' do
      it 'raises no error' do
        expect do
          described_class.new("path" => Rails.root)
        end.not_to raise_error
      end
    end
  end

  describe '.disk_access_denied?' do
    context 'when Rugged is enabled', :enable_rugged do
      it 'returns false' do
        expect(described_class.disk_access_denied?).to be_falsey
      end
    end

    context 'when Rugged is disabled' do
      it 'returns true' do
        expect(described_class.disk_access_denied?).to be_truthy
      end
    end
  end
end