Sha256: 70ebdea69d55ffde409668ace4907efd1c9467907c1c0a624c10d2dc09c4f766
Contents?: true
Size: 1.5 KB
Versions: 1
Compression:
Stored size: 1.5 KB
Contents
require_relative 'spec_helper.rb' describe 'Services' do describe '::Connection' do it 'should setup' do Services::Connection.new host: 'localhost' end it 'should fail without something to connect too' do expect { Services::Connection.new }.to raise_error end # chef functions in chef-spec specs ? # it "should accept a chef run_context" do # Services::Connection.new( # run_context: Chef::RunContext.new( # Chef::Node.new, # Chef::CookbookCollection.new, # Chef::EventDispatch::Dispatcher.new # ) # ) # end end before(:each) do Services::Connection.new host: 'localhost' end it 'can set' do s = Services.set('/test/1', value: 1) s.node.key.should eql '/test/1' s.node.value.should eql '1' end it 'can get' do Services.get('/test/1').value.should eql '1' end it 'handles unknown keys on get' do Services.get('/BLARGH!@#@!').should eql nil end it 'gets all services' do a = Services.all a.count.should eql 2 a[0].members.map(&:name).sort.should eql %w(test_member test_member2) end it 'lists subscribed services' do Services.subscribed('test').should eql [] Services.subscribed('test_member').should eql ['test'] end describe '::Entity' do before(:each) do Services::Connection.new host: 'localhost' end it 'should raise when directly instanced' do expect { Services::Entity.new('foo') }.to raise_error(RuntimeError) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
jn_services-1.0.8 | spec/services_spec.rb |