module Anyt::TestHelpers

Common tests helpers

Public Class Methods

included(base) click to toggle source
# File lib/anyt/ext/minitest.rb, line 10
def self.included(base)
  base.let(:client) { build_client(ignore: %w[ping welcome]) }
  base.after { @clients&.each { |client| client.close(allow_messages: true) } }
end

Public Instance Methods

build_client(**args) click to toggle source
# File lib/anyt/ext/minitest.rb, line 15
def build_client(**args)
  @clients ||= []
  Anyt::Client.new(**args).tap do |client|
    @clients << client
  end
end
remote_client() click to toggle source
# File lib/anyt/ext/minitest.rb, line 30
def remote_client
  @remote_client ||= RemoteControl::Client.connect(Anyt.config.remote_control_port)
end
restart_server!() click to toggle source
# File lib/anyt/ext/minitest.rb, line 22
def restart_server!
  if Anyt.config.use_action_cable
    remote_client.restart_action_cable
  else
    Command.restart
  end
end