spec/hue_spec.rb in hue-lib-0.7.2 vs spec/hue_spec.rb in hue-lib-0.7.3

- old
+ new

@@ -1,9 +1,8 @@ require 'spec_helper.rb' describe Hue do - mock_application_config_path mock_bridge_config_path after(:each) do create_test_bridge_config @@ -19,11 +18,11 @@ it 'should return the default application' do described_class.application.should be_a(described_class::Bridge) end - context 'when discovering new bridges' do + context 'when discovering a bridge on the network' do it 'should return a list discovered bridges' do bridges = Hue.discover bridges.should == {TEST_UDP_BRIDGE_UUID => TEST_UDP_BRIDGE_URI} end @@ -34,10 +33,21 @@ new_bridge.id.should == TEST_UDP_BRIDGE_UUID new_bridge.uri.should == TEST_UDP_BRIDGE_URI end end + context 'when attempting discover without a bridge on the network' do + before(:each) do + mock_udp_no_reply + end + + it 'should return an empty list of bridges' do + bridges = Hue.discover + bridges.should == {} + end + end + context 'after discovering bridges' do before(:each) do mock_udp_replies(TEST_BRIDGE_UUID, 'new_host') end @@ -62,18 +72,18 @@ it 'should allow a new default if one doesn\'t exist' do with_temp_config_path do with_fake_post(nil, {}, 'post_success', TEST_UDP_BRIDGE_URI) with_stdout(/Registering app...(.*)$/) do - instance = described_class.register_default + described_class.register_default end end end it 'should allow un-registering the default' do with_temp_config_path(true) do with_fake_delete("config/whitelist/#{TEST_APPLICATION_UUID}") - instance = described_class.remove_default + described_class.remove_default end end end context 'contains some utility methods' do