Skip to content

Commit

Permalink
Experimenting with Rack::Test versus standard Rack mock objects.
Browse files Browse the repository at this point in the history
  • Loading branch information
Blake Carlson committed Sep 20, 2009
1 parent 4f531c8 commit 0fcd836
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
3 changes: 2 additions & 1 deletion lib/rack/gridfs.rb
@@ -1,7 +1,8 @@
module Rack
class GridFS
def initialize(app)
def initialize(app, options = {})
@app = app
@options = options
end

def call(env)
Expand Down
16 changes: 14 additions & 2 deletions test/test_rack_gridfs.rb
@@ -1,6 +1,6 @@
require 'test_helper'

class KeyTest < Test::Unit::TestCase
class Rack::GridFSTest < Test::Unit::TestCase
include Rack::Test::Methods

def app
Expand All @@ -11,10 +11,22 @@ def app
end

context "Rack::GridFS" do

should "run a mock request" do
get "/"
get '/'
assert last_response.ok?
end

should "run an old school mock request" do
app = Rack::Builder.new do
use Rack::GridFS
run lambda { |env| [200, {'Content-Type' => 'text/plain'}, ["Hello, World!"]] }
end

response = Rack::MockRequest.new(app).get('/')
assert response.ok?
end

end

end
Expand Down

0 comments on commit 0fcd836

Please sign in to comment.