mirror of
https://github.com/sinatra/sinatra
synced 2023-03-27 23:18:01 -04:00
add Sinatra.use
This commit is contained in:
parent
cbe5d15d42
commit
b03ee9f4f7
2 changed files with 12 additions and 0 deletions
|
@ -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
|
||||
|
|
|
@ -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'
|
||||
|
|
Loading…
Reference in a new issue