Permalink
Browse files

set up the API before running the server

  • Loading branch information...
marcoow committed Jan 8, 2013
1 parent 34ac587 commit 79edd2f494343f3fe83f360f68594bc9c82d6e36
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 79edd2f

Please sign in to comment.