Class: Pact::MockService::AppRegistration
- Inherits:
-
Object
- Object
- Pact::MockService::AppRegistration
- Includes:
- Logging
- Defined in:
- lib/pact/mock_service/app_manager.rb
Instance Attribute Summary collapse
-
#app ⇒ Object
Returns the value of attribute app.
-
#port ⇒ Object
Returns the value of attribute port.
Instance Method Summary collapse
-
#initialize(opts) ⇒ AppRegistration
constructor
A new instance of AppRegistration.
- #is_a_mock_service? ⇒ Boolean
- #kill ⇒ Object
- #not_spawned? ⇒ Boolean
- #spawn ⇒ Object
- #spawned? ⇒ Boolean
- #to_s ⇒ Object
Constructor Details
#initialize(opts) ⇒ AppRegistration
Returns a new instance of AppRegistration.
115 116 117 118 119 120 |
# File 'lib/pact/mock_service/app_manager.rb', line 115 def initialize opts @max_wait = 10 @port = opts[:port] @app = opts[:app] @spawned = false end |
Instance Attribute Details
#app ⇒ Object
Returns the value of attribute app.
113 114 115 |
# File 'lib/pact/mock_service/app_manager.rb', line 113 def app @app end |
#port ⇒ Object
Returns the value of attribute port.
112 113 114 |
# File 'lib/pact/mock_service/app_manager.rb', line 112 def port @port end |
Instance Method Details
#is_a_mock_service? ⇒ Boolean
135 136 137 |
# File 'lib/pact/mock_service/app_manager.rb', line 135 def is_a_mock_service? app.is_a? Pact::MockService::App end |
#kill ⇒ Object
122 123 124 125 |
# File 'lib/pact/mock_service/app_manager.rb', line 122 def kill logger.debug "Supposed to be stopping" @spawned = false end |
#not_spawned? ⇒ Boolean
127 128 129 |
# File 'lib/pact/mock_service/app_manager.rb', line 127 def not_spawned? !spawned? end |
#spawn ⇒ Object
143 144 145 146 147 148 |
# File 'lib/pact/mock_service/app_manager.rb', line 143 def spawn logger.info "Starting app #{self}..." @server = Pact::Server.new(app, port).boot @spawned = true logger.info "Started on port #{port}" end |
#spawned? ⇒ Boolean
131 132 133 |
# File 'lib/pact/mock_service/app_manager.rb', line 131 def spawned? @spawned end |
#to_s ⇒ Object
139 140 141 |
# File 'lib/pact/mock_service/app_manager.rb', line 139 def to_s "#{app} on port #{port}" end |