Permalink
Browse files

Use a proxy class for the generated application

To use the generated sinatra application from a rackup file we needed a
simple proxy class that hooks up all the methods rack expects.
  • Loading branch information...
1 parent 4bd9a23 commit 46b746bb0a7df7b461816b5aa09374731cf60c28 @vanstee committed Jul 2, 2012
Showing with 22 additions and 0 deletions.
  1. +1 −0 lib/hovercraft.rb
  2. +14 −0 lib/hovercraft/server.rb
  3. +7 −0 spec/hovercraft/server_spec.rb
View
@@ -1 +1,2 @@
+require 'hovercraft/server'
require 'hovercraft/version'
View
@@ -0,0 +1,14 @@
+require 'hovercraft/builder'
+
+module Hovercraft
+ class Server
+ def initialize
+ builder = Builder.new
+ @application = builder.application
+ end
+
+ def call(env)
+ @application.call(env)
+ end
+ end
+end
@@ -0,0 +1,7 @@
+require 'hovercraft/server'
+
+describe Hovercraft::Server do
+ it 'is a rack application' do
+ subject.respond_to?(:call).should be_true
+ end
+end

0 comments on commit 46b746b

Please sign in to comment.