Sha256: c9405987dd0dae13628ca6391f0ccee808a0b504a9257bc8cf1b6d533c2b2e28

Contents?: true

Size: 964 Bytes

Versions: 8

Compression:

Stored size: 964 Bytes

Contents

require File.expand_path(File.dirname(__FILE__) + "/../test_helper")
require 'artoo/drivers/driver'

class Awesome < Artoo::Drivers::Driver
  COMMANDS = [:awesome].freeze
end

describe Artoo::Drivers::Driver do
  before do
    @device = mock('device')
    @driver = Artoo::Drivers::Driver.new(:parent => @device)
  end

  it 'Driver#connection' do
    @connection = mock('connection')
    @device.expects(:connection).returns(@connection)
    @driver.connection.must_equal @connection
  end

  it 'Driver#pin' do
    @pin = 13
    @device.expects(:pin).returns(@pin)
    @driver.pin.must_equal @pin
  end

  it 'Driver#commands' do
    @awesome_driver = Awesome.new(:parent => @device)
    @awesome_driver.commands.first.must_equal :awesome
  end

  it 'Driver#known_command?' do
    @awesome_driver = Awesome.new(:parent => @device)
    @awesome_driver.known_command?(:awesome).must_equal true
    @awesome_driver.known_command?(:crazy).must_equal false
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
artoo-1.0.0 test/drivers/driver_test.rb
artoo-1.0.0.rc4 test/drivers/driver_test.rb
artoo-1.0.0.rc3 test/drivers/driver_test.rb
artoo-1.0.0.rc2 test/drivers/driver_test.rb
artoo-1.0.0.rc1 test/drivers/driver_test.rb
artoo-1.0.0.pre test/drivers/driver_test.rb
artoo-0.5.0 test/drivers/driver_test.rb
artoo-0.4.1 test/drivers/driver_test.rb