Class: NEC::MockServerStarter

Inherits:
Object
  • Object
show all
Defined in:
lib/nec_mock_server/mock_server_starter.rb

Constant Summary collapse

RUN_SCRIPT_NAME =
'run.rb'

Instance Method Summary collapse

Constructor Details

#initialize(sub_app_dir_path, opts = {}) ⇒ MockServerStarter

Create new instance of SubAppUnitTestHelper

Parameters:

  • sub_app_dir_path (String)
  • opts (Hash) (defaults to: {})

Options Hash (opts):

  • :run_scrip_name (String)

    Default is #RUN_SCRIPT_NAME

  • :port (Fixnum)


13
14
15
16
17
# File 'lib/nec_mock_server/mock_server_starter.rb', line 13

def initialize(sub_app_dir_path, opts = {})
  @path = File.expand_path(sub_app_dir_path, File.dirname(__FILE__))
  @run_scrip_name = opts.fetch(:run_scrip_name) {RUN_SCRIPT_NAME}
  @port = opts[:port]
end

Instance Method Details

#run!Object

The method start another sub application by defined path Sub app will be started in new command line with irb



22
23
24
25
26
# File 'lib/nec_mock_server/mock_server_starter.rb', line 22

def run!
  return if @port && already_run?

  create_threat
end