class GroongaClientModel::Test::GroongaServerRunner
Public Class Methods
new(parallel_test: false)
click to toggle source
Calls superclass method
# File lib/groonga_client_model/test/groonga_server_runner.rb, line 29 def initialize(parallel_test: false) super() if parallel_test host = "127.0.0.1" port = TCPServer.open(host, 0) do |server| server.addr[1] end Client.url = "http://#{host}:#{port}" end @client = Client.new end
Public Instance Methods
run()
click to toggle source
Calls superclass method
# File lib/groonga_client_model/test/groonga_server_runner.rb, line 41 def run super return if using_running_server? if defined?(Rails) base_dir = Rails.root else base_dir = Pathname.pwd end schema_path = base_dir + SchemaLoader.default_path migrate_path = base_dir + Migrator.default_search_path if schema_path.exist? schema_path.open do |schema_file| schema_loader = SchemaLoader.new(schema_file) schema_loader.load end elsif migrate_path.exist? output = StringIO.new migrator = Migrator.new(migrate_path) migrator.output = output migrator.migrate end end
url()
click to toggle source
# File lib/groonga_client_model/test/groonga_server_runner.rb, line 66 def url URI.parse(@client.url) end
Private Instance Methods
open_client(&block)
click to toggle source
# File lib/groonga_client_model/test/groonga_server_runner.rb, line 71 def open_client(&block) @client.open(&block) end