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)
|
def self.helpers(*extensions, &block)
|
||||||
Delegator.target.helpers(*extensions, &block)
|
Delegator.target.helpers(*extensions, &block)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Use the middleware for classic applications.
|
||||||
|
def self.use(*args, &block)
|
||||||
|
Delegator.target.use(*args, &block)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -100,6 +100,13 @@ class DelegatorTest < Test::Unit::TestCase
|
||||||
assert_equal app.last_call, ["helpers", mixin.to_s ]
|
assert_equal app.last_call, ["helpers", mixin.to_s ]
|
||||||
end
|
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 'get'
|
||||||
delegates 'patch'
|
delegates 'patch'
|
||||||
delegates 'put'
|
delegates 'put'
|
||||||
|
|
Loading…
Add table
Reference in a new issue