Permalink
Browse files

Merge pull request #221 from scoreloop/setup-api

set up the API before running the server
  • Loading branch information...
2 parents 34ac587 + 79edd2f commit e832599bf1976895c4f45354624e6aff790ba3f8 @igrigorik igrigorik committed Jan 9, 2013
Showing with 11 additions and 0 deletions.
  1. +1 −0 lib/goliath/runner.rb
  2. +10 −0 spec/unit/runner_spec.rb
View
@@ -293,6 +293,7 @@ def run_server
log.info("Starting server on #{@address}:#{@port} in #{Goliath.env} mode. Watch out for stones.")
server = setup_server(log)
+ server.api.setup if server.api.respond_to?(:setup)
server.start
end
View
@@ -108,6 +108,16 @@
end
end
+ it 'sets up the api if that implements the #setup method' do
+ server_mock = mock("Server").as_null_object
+ server_mock.api.should_receive(:setup)
+
+ Goliath::Server.stub!(:new).and_return(server_mock)
+
+ @r.stub!(:load_config).and_return({})
+ @r.send(:run_server)
+ end
+
it 'runs the server' do
server_mock = mock("Server").as_null_object
server_mock.should_receive(:start)

0 comments on commit e832599

Please sign in to comment.