Sha256: b02c6b6a2faf6942cc34ce5caf613b644bcaebc407a5e532e95af52ce3b3109a

Contents?: true

Size: 1.24 KB

Versions: 1

Compression:

Stored size: 1.24 KB

Contents

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
usb-detection-sensor-0.2.2 spec/usb-detection-sensor/command-line-handler_spec.rb