Sha256: c8a26ee0717e955ef62698d9e4603d0e737d035053c2842a83d06d1a2ddd5d07

Contents?: true

Size: 923 Bytes

Versions: 1

Compression:

Stored size: 923 Bytes

Contents

require 'minitest/spec'
require 'minitest/autorun'

begin
  require 'minitest/reporters'
  MiniTest::Reporters.use!
rescue LoadError
  # ignore when it's not there - must be ruby 1.8
end

require 'mocha/setup'

require 'launchpad_mk2'

# mock Portmidi for tests
module Portmidi
  
  class Input
    attr_accessor :device_id
    def initialize(device_id)
      self.device_id = device_id
    end
    def read(*args); nil; end
    def close; nil; end
  end
  
  class Output
    attr_accessor :device_id
    def initialize(device_id)
      self.device_id = device_id
    end
    def write(*args); nil; end
    def write_sysex(*args); nil; end
    def close; nil; end
  end
  
  def self.input_devices; mock_devices; end
  def self.output_devices; mock_devices; end
  def self.start; end
  
end

def mock_devices(opts = {})
  [Portmidi::Device.new(opts[:id] || 1, 0, 0, opts[:name] || Launchpad::Device::MK2_DEVICE_NAME)]
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
launchpad_mk2-0.0.1 test/helper.rb