Sha256: ab3b8482a2c0bd8d1fd804f8bf34e448f92426bf8909a540162f62c61fa4d4ae
Contents?: true
Size: 1.71 KB
Versions: 1
Compression:
Stored size: 1.71 KB
Contents
require_relative '../spec_helper' HOST = 'localhost:8080' describe Hawkular::Metrics::Client do context 'client initialization' do it 'should accept no option' do credentials = { username: 'mockuser', password: 'mockpass' } ::RSpec::Mocks.with_temporary_scope do mock_metrics_version Hawkular::Metrics::Client.new(HOST, credentials) end end it 'should accept Hawkular-Tenant option' do credentials = { username: 'mockuser', password: 'mockpass' } ::RSpec::Mocks.with_temporary_scope do mock_metrics_version @client = Hawkular::Metrics::Client.new(HOST, credentials, tenant: 'foo') headers = @client.send(:http_headers) expect(headers[:'Hawkular-Tenant']).to eql('foo') end end it 'should define subcomponents' do ::RSpec::Mocks.with_temporary_scope do mock_metrics_version client = Hawkular::Metrics::Client.new HOST expect(client.tenants).not_to be nil expect(client.counters).not_to be nil expect(client.gauges).not_to be nil end end end context 'http comms' do before(:each) do credentials = { username: 'mockuser', password: 'mockpass' } ::RSpec::Mocks.with_temporary_scope do mock_metrics_version @client = Hawkular::Metrics::Client.new(HOST, credentials) end end it 'should add Accept: headers' do headers = @client.send(:http_headers) expect(headers[:accept]).to eql('application/json') end it 'should keep existing Accept: headers' do value = 'application/json; foo=bar;' headers = @client.send(:http_headers, accept: value) expect(headers[:accept]).to eql(value) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
hawkular-client-2.9.0 | spec/unit/client_spec.rb |