Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Fix when using Rack > 1.3.6 #9

Closed
wants to merge 3 commits into
from
Jump to file or symbol
Failed to load files and symbols.
+10 −37
Split
View
@@ -1,32 +1,4 @@
module Rack
- class Builder
- attr :ins
- def use(middleware, *args, &block)
- middleware.instance_variable_set "@rack_builder", self
- def middleware.rack_builder
- @rack_builder
- end
- @ins << lambda { |app|
- middleware.new(app, *args, &block)
- }
- end
-
- def run(app)
- klass = app.class
- klass.instance_variable_set "@rack_builder", self
- def klass.rack_builder
- @rack_builder
- end
- @ins << app #lambda { |nothing| app }
- end
-
- def leaf_app
- ins.last
- end
- end
-end
-
-module Rack
class Flash
# Raised when the session passed to FlashHash initialize is nil. This
# is usually an indicator that session middleware is not in use.
View
@@ -1,9 +1,8 @@
require 'rubygems'
-gem 'sinatra', '<1.0.0'
+gem 'sinatra', '<=1.3.2'
require 'sinatra/base'
require 'bacon'
-require 'sinatra/test'
-require 'sinatra/test/bacon'
+require 'rack/test'
require File.join(File.dirname(__FILE__), *%w[.. lib rack-flash])
class String
@@ -21,10 +20,6 @@ def err_explain
end
end
-def mock_app(&block)
- @app = Sinatra.new(&block)
-end
-
module Rack
class FakeFlash < Rack::Flash::FlashHash
attr_reader :flagged, :sweeped, :store
View
@@ -1,6 +1,12 @@
require File.dirname(__FILE__) + '/helper'
describe 'Rack::Flash' do
+ include Rack::Test::Methods
+
+ def app(&block)
+ return Sinatra.new &block
+ end
+
before do
@fake_session = {}
end
@@ -127,7 +133,7 @@ def new_flash(entries={})
describe 'integration' do
it 'provides :sweep option to clear unused entries' do
- mock_app {
+ app {
use Rack::Flash, :sweep => true
set :sessions, true
@@ -139,7 +145,7 @@ def new_flash(entries={})
fake_flash = Rack::FakeFlash.new(:foo => 'bar')
- get '/', :env => { 'x-rack.flash' => fake_flash }
+ get '/', :env=>{ 'x-rack.flash' => fake_flash }
fake_flash.should.be.flagged
fake_flash.should.be.swept