diff --git a/lib/sinatra/base.rb b/lib/sinatra/base.rb index dcde6bcd..71d7f1b1 100644 --- a/lib/sinatra/base.rb +++ b/lib/sinatra/base.rb @@ -1525,4 +1525,9 @@ module Sinatra def self.helpers(*extensions, &block) Delegator.target.helpers(*extensions, &block) end + + # Use the middleware for classic applications. + def self.use(*args, &block) + Delegator.target.use(*args, &block) + end end diff --git a/test/delegator_test.rb b/test/delegator_test.rb index 53de077f..a898748c 100644 --- a/test/delegator_test.rb +++ b/test/delegator_test.rb @@ -100,6 +100,13 @@ class DelegatorTest < Test::Unit::TestCase assert_equal app.last_call, ["helpers", mixin.to_s ] end + + it "registers helpers with the delegation target" do + app, mixin = mirror, Module.new + Sinatra.use mixin + assert_equal app.last_call, ["use", mixin.to_s ] + end + delegates 'get' delegates 'patch' delegates 'put'