Sha256: f177872b994bad0d5389128e053e5dfccea78e1ded1ebfe3be335278560a5a4e

Contents?: true

Size: 848 Bytes

Versions: 6

Compression:

Stored size: 848 Bytes

Contents

require "minitest/spec"
require "minitest/autorun"
require "minitest/reporters"

MiniTest::Reporters.use!

require "mocha/setup"

require "surface_master"

# Mock for tests
module Portmidi
  # Mock for tests
  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

  # Mock for tests
  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 MK2")]
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
surface_master-0.6.0 test/helper.rb
surface_master-0.5.1 test/helper.rb
surface_master-0.5.0 test/helper.rb
surface_master-0.4.1 test/helper.rb
surface_master-0.4.0 test/helper.rb
surface_master-0.2.1 test/helper.rb