From 12d519ad102b19310d9a7296673380280f344418 Mon Sep 17 00:00:00 2001 From: onyx-and-iris Date: Tue, 18 Jul 2023 07:35:33 +0100 Subject: [PATCH] refactor Test class --- test/minitest_helper.rb | 32 ++++++++++++++------------------ 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/test/minitest_helper.rb b/test/minitest_helper.rb index da08840..c7c5fff 100644 --- a/test/minitest_helper.rb +++ b/test/minitest_helper.rb @@ -3,30 +3,26 @@ require "minitest/autorun" require_relative "../lib/voicemeeter" class Test - @vm = Voicemeeter::Remote.new([:basic, :banana, :potato].sample) - @vm.login - puts "Running #{@vm.kind.name} tests" - - def self.vm - @vm + class << self + attr_reader :vm, :data 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) @data = TestMap.new( - @vm.kind.name, - @vm.kind.phys_in - 1, - @vm.kind.virt_in - 1, - @vm.kind.phys_out - 1, - @vm.kind.virt_out - 1, + vm.kind.name, + vm.kind.phys_in - 1, + vm.kind.virt_in - 1, + vm.kind.phys_out - 1, + vm.kind.virt_out - 1, 0, 79, - @vm.kind.vban[0] - 1, - @vm.kind.vban[1] - 1 + vm.kind.vban[0] - 1, + vm.kind.vban[1] - 1 ) - def self.data - @data - end - - Minitest.after_run { @vm.logout } + Minitest.after_run { vm.logout } end