test/helper.rb in surface_master-0.2.0 vs test/helper.rb in surface_master-0.2.1
- old
+ new
@@ -1,44 +1,43 @@
-require 'minitest/spec'
-require 'minitest/autorun'
+require "minitest/spec"
+require "minitest/autorun"
+require "minitest/reporters"
-begin
- require 'minitest/reporters'
- MiniTest::Reporters.use!
-rescue LoadError
- # ignore when it's not there - must be ruby 1.8
-end
+MiniTest::Reporters.use!
-require 'mocha/setup'
+require "mocha/setup"
-require 'launchpad'
+require "surface_master"
-# mock Portmidi for tests
+# 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 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(*_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')]
+ [Portmidi::Device.new(opts[:id] || 1, 0, 0, opts[:name] || "Launchpad MK2")]
end