spec/virginia/service_spec.rb in virginia-0.2.1 vs spec/virginia/service_spec.rb in virginia-0.3.0

- old
+ new

@@ -4,19 +4,26 @@ class DummyHandler def initialize(host, port) end end - let(:host) { "127.0.0.1" } - let(:port) { 8989 } - let(:handler) { DummyHandler } + let(:host) { "127.0.0.1" } + let(:port) { 8989 } + let(:options) { {Host: host, Port: port} } + before :each do - Adhearsion.config.virginia.host = host - Adhearsion.config.virginia.port = port - Adhearsion.config.virginia.handler = handler + Adhearsion.stub(:root).and_return '.' + Adhearsion.config.virginia.host = host + Adhearsion.config.virginia.port = port + Adhearsion.config.virginia.rackup = 'spec/fixtures/config.ru' end it "should instantiate the handler" do - handler.should_receive(:new).with(host, port) + rack_logger = mock 'Rack::CommonLogger' + ::Rack::CommonLogger.should_receive(:new).once.with(TestApp, Adhearsion.logger).and_return rack_logger + ::Reel::Rack::Server.should_receive(:supervise_as).once.with(:reel_rack_server, rack_logger, options) Virginia::Service.start end +end + +class TestApp end