Sha256: dbabe1e8615c4c805c7a2fc6f1876ee3a72a50e02ab478b8751aa799997a907b

Contents?: true

Size: 1.87 KB

Versions: 28

Compression:

Stored size: 1.87 KB

Contents

module CloudSesame
	module Domain
		describe Client do

			class Searchable; end

			subject { Client.new(Searchable) }

			describe '.configure' do
				context 'when block is given' do
					it 'should yield back global config' do
						global_config = Client.global_config
						expect{ |b| Client.configure(&b) }.to yield_with_args(global_config)
					end
				end
			end

			describe '.global_config' do
				context 'when calling it first time' do
					before { Client.instance_variable_set(:@global_config, nil) }
					it 'should initialize an config object on first call' do
						expect(Config).to receive(:new)
						Client.global_config
					end
				end
				context 'when calling it' do
					before { Client.global_config }
					it 'should not re-initialize an config object' do
						expect(Config).to_not receive(:new)
						Client.global_config
					end
				end
				it 'should return an config object' do
					expect(Client.global_config).to be_kind_of(Config)
				end
			end

			describe '#config' do
				context 'when calling it first time' do
					it 'should initialize an config object from global config' do
						global_config = Client.global_config
						expect(Config).to receive(:new).with(global_config)
						subject.config
					end
				end
				context 'when calling it' do
					before { subject.config }
					it 'should no re-initialize an config object' do
						expect(Config).to_not receive(:new)
						subject.config
					end
				end
				it 'should return an config object' do
					expect(Client.global_config).to be_kind_of(Config)
				end
			end

			describe '#search' do
				let(:aws_client) { OpenStruct.new }
				let(:params) { {} }
				before { allow(subject).to receive(:aws_client).and_return(aws_client) }
				it 'should call fetch on executor' do
					expect(subject.send(:executor)).to receive(:fetch).with(params)
					subject.search params
				end
			end

		end
	end
end






Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
CloudSesame-1.0.1 spec/cloud_sesame/domain/client_spec.rb
CloudSesame-1.0.0 spec/cloud_sesame/domain/client_spec.rb
CloudSesame-0.9.4 spec/cloud_sesame/domain/client_spec.rb
CloudSesame-0.9.3 spec/cloud_sesame/domain/client_spec.rb
CloudSesame-0.9.2 spec/cloud_sesame/domain/client_spec.rb
CloudSesame-0.9.1 spec/cloud_sesame/domain/client_spec.rb
CloudSesame-0.9.0 spec/cloud_sesame/domain/client_spec.rb
CloudSesame-0.8.3 spec/cloud_sesame/domain/client_spec.rb
CloudSesame-0.8.2 spec/cloud_sesame/domain/client_spec.rb
CloudSesame-0.8.1 spec/cloud_sesame/domain/client_spec.rb
CloudSesame-0.8.0 spec/cloud_sesame/domain/client_spec.rb
CloudSesame-0.7.13 spec/cloud_sesame/domain/client_spec.rb
CloudSesame-0.7.12 spec/cloud_sesame/domain/client_spec.rb
CloudSesame-0.7.11 spec/cloud_sesame/domain/client_spec.rb
CloudSesame-0.7.10 spec/cloud_sesame/domain/client_spec.rb
CloudSesame-0.7.9 spec/cloud_sesame/domain/client_spec.rb
CloudSesame-0.7.8 spec/cloud_sesame/domain/client_spec.rb
CloudSesame-0.7.7 spec/cloud_sesame/domain/client_spec.rb
CloudSesame-0.7.5 spec/cloud_sesame/domain/client_spec.rb
CloudSesame-0.7.4 spec/cloud_sesame/domain/client_spec.rb