require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') include UsbDetectionSensor describe "UsbConnectGomSensor::CommandLineHandler" do it "should find class & module" do CommandLineHandler.should_not == nil end describe "with a fake connection" do before :each do $gom = Gom::Remote.connection = Object.new (Gom::Remote::Connection.stub! :init).and_return($gom, '/') end it "should should switch on overlays" do @clh = CommandLineHandler.new :overlay_path => '/some:overlay-2' $gom.should_receive(:write).with("/some:overlay-2", "grabber") (@clh.switch_horizon_overlay :grabber) end it "should should switch off overlays" do @clh = CommandLineHandler.new :overlay_path => '/some:overlay-1' $gom.should_receive(:write).with("/some:overlay-1", "off") (@clh.switch_horizon_overlay :off) end describe "with a default handler" do before :each do @clh = CommandLineHandler.new end it "should respond to remove requests" do (@clh.respond_to? :info).should == true end it "should should not switch overlays" do $gom.should_not_receive(:write) (@clh.switch_horizon_overlay :grabber) end end end end