Module: TinyGate::TestHelper
- Defined in:
- lib/tiny_gate/test_helper.rb,
lib/tiny_gate/test_helper/user.rb,
lib/tiny_gate/test_helper/user_client.rb,
lib/tiny_gate/test_helper/dummy_server.rb,
lib/tiny_gate/test_helper/user_repository.rb,
lib/tiny_gate/test_helper/users_controller.rb,
lib/tiny_gate/test_helper/sessions_controller.rb,
lib/tiny_gate/test_helper/application_controller.rb
Defined Under Namespace
Classes: ApplicationController, SessionsController, User, UserClient, UserRepository, UsersController
Constant Summary
collapse
- DummyServer =
Rack::Builder.new do
use SessionsController
use UsersController
run ApplicationController
end
Class Method Summary
collapse
Class Method Details
.run_server ⇒ Object
24
25
26
27
28
29
30
|
# File 'lib/tiny_gate/test_helper.rb', line 24
def self.run_server
Rack::Handler::WEBrick.run(
DummyServer,
Host: 'localhost',
Port: 31338
)
end
|
.start_server ⇒ Object
32
33
34
35
36
37
|
# File 'lib/tiny_gate/test_helper.rb', line 32
def self.start_server
Daemons.call(multiple: true, shush: true) do
run_server
end
sleep 1
end
|
.stop_server ⇒ Object
39
40
41
42
43
44
45
46
47
48
49
|
# File 'lib/tiny_gate/test_helper.rb', line 39
def self.stop_server
return unless Daemons.group
Daemons.group.applications.each do |application|
begin
Process.kill('KILL', application.pid.pid)
Process.wait(application.pid.pid)
rescue
end
end
end
|