|
1 | | -require 'spec_helper' |
2 | | -require_relative '../client_shared' |
3 | | - |
4 | | -module CloudController |
5 | | - module Blobstore |
6 | | - RSpec.describe StorageCliClient do |
7 | | - describe 'registry build and lookup' do |
8 | | - class DummyClient < StorageCliClient |
9 | | - def initialize(*); end |
10 | | - end |
11 | | - |
12 | | - before { StorageCliClient.register('DummyProvider', DummyClient) } |
13 | | - |
14 | | - it 'builds the correct client' do |
15 | | - client_from_registry = StorageCliClient.build(connection_config: { provider: 'DummyProvider' }, directory_key: 'dummy-key', root_dir: 'dummy-root') |
16 | | - expect(client_from_registry).to be_a(DummyClient) |
17 | | - end |
18 | | - |
19 | | - it 'raises an error for an unregistered provider' do |
20 | | - expect do |
21 | | - StorageCliClient.build(connection_config: { provider: 'UnknownProvider' }, directory_key: 'dummy-key', root_dir: 'dummy-root') |
22 | | - end.to raise_error(RuntimeError, 'No storage CLI client registered for provider UnknownProvider') |
23 | | - end |
24 | | - |
25 | | - it 'raises an error if provider is missing' do |
26 | | - expect do |
27 | | - StorageCliClient.build(connection_config: {}, directory_key: 'dummy-key', root_dir: 'dummy-root') |
28 | | - end.to raise_error(RuntimeError, 'Missing connection_config[:provider]') |
29 | | - end |
30 | | - end |
31 | | - end |
32 | | - end |
33 | | -end |
| 1 | +# require 'spec_helper' |
| 2 | +# require_relative '../client_shared' |
| 3 | +# |
| 4 | +# module CloudController |
| 5 | +# module Blobstore |
| 6 | +# RSpec.describe StorageCliClient do |
| 7 | +# describe 'registry build and lookup' do |
| 8 | +# class DummyClient < StorageCliClient |
| 9 | +# def initialize(*); end |
| 10 | +# end |
| 11 | +# |
| 12 | +# before { StorageCliClient.register('DummyProvider', DummyClient) } |
| 13 | +# |
| 14 | +# after { StorageCliClient.instance_variable_set(:@registry, {}) } |
| 15 | +# |
| 16 | +# it 'builds the correct client' do |
| 17 | +# client_from_registry = StorageCliClient.build(connection_config: { provider: 'DummyProvider' }, directory_key: 'dummy-key', root_dir: 'dummy-root') |
| 18 | +# expect(client_from_registry).to be_a(DummyClient) |
| 19 | +# end |
| 20 | +# |
| 21 | +# it 'raises an error for an unregistered provider' do |
| 22 | +# expect do |
| 23 | +# StorageCliClient.build(connection_config: { provider: 'UnknownProvider' }, directory_key: 'dummy-key', root_dir: 'dummy-root') |
| 24 | +# end.to raise_error(RuntimeError, 'No storage CLI client registered for provider UnknownProvider') |
| 25 | +# end |
| 26 | +# |
| 27 | +# it 'raises an error if provider is missing' do |
| 28 | +# expect do |
| 29 | +# StorageCliClient.build(connection_config: {}, directory_key: 'dummy-key', root_dir: 'dummy-root') |
| 30 | +# end.to raise_error(RuntimeError, 'Missing connection_config[:provider]') |
| 31 | +# end |
| 32 | +# end |
| 33 | +# end |
| 34 | +# end |
| 35 | +# end |
0 commit comments