refactor Test class

This commit is contained in:
onyx-and-iris 2023-07-18 07:35:33 +01:00
parent fdac727ee7
commit 12d519ad10

View File

@ -3,30 +3,26 @@ require "minitest/autorun"
require_relative "../lib/voicemeeter" require_relative "../lib/voicemeeter"
class Test class Test
@vm = Voicemeeter::Remote.new([:basic, :banana, :potato].sample) class << self
@vm.login attr_reader :vm, :data
puts "Running #{@vm.kind.name} tests"
def self.vm
@vm
end end
@vm = Voicemeeter::Remote.new([:basic, :banana, :potato].sample)
vm.login
puts "Running #{vm.kind.name} tests"
TestMap = Data.define(:name, :phys_in, :virt_in, :phys_out, :virt_out, :button_lower, :button_higher, :vban_in, :vban_out) TestMap = Data.define(:name, :phys_in, :virt_in, :phys_out, :virt_out, :button_lower, :button_higher, :vban_in, :vban_out)
@data = TestMap.new( @data = TestMap.new(
@vm.kind.name, vm.kind.name,
@vm.kind.phys_in - 1, vm.kind.phys_in - 1,
@vm.kind.virt_in - 1, vm.kind.virt_in - 1,
@vm.kind.phys_out - 1, vm.kind.phys_out - 1,
@vm.kind.virt_out - 1, vm.kind.virt_out - 1,
0, 79, 0, 79,
@vm.kind.vban[0] - 1, vm.kind.vban[0] - 1,
@vm.kind.vban[1] - 1 vm.kind.vban[1] - 1
) )
def self.data Minitest.after_run { vm.logout }
@data
end
Minitest.after_run { @vm.logout }
end end