spec/services_spec.rb in jn_services-1.0.1 vs spec/services_spec.rb in jn_services-1.0.2
- old
+ new
@@ -25,14 +25,31 @@
before(:each) do
Services::Connection.new host: 'localhost'
end
it 'can set' do
- Services.set '/test/1', 1
+ s = Services.set('/test/1', 1)
+ s.node.key.should eql '/test/1'
+ s.node.value.should eql '1'
end
it 'can get' do
- Services.get '/_etcd/machines'
+ 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 { |m| m.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'