提交 a210aff2 编写于 作者: J José Valim

Add delete to middleware stack proxy.

上级 981f8127
...@@ -28,6 +28,10 @@ def use(*args, &block) ...@@ -28,6 +28,10 @@ def use(*args, &block)
@operations << [:use, args, block] @operations << [:use, args, block]
end end
def delete(*args, &block)
@operations << [:delete, args, block]
end
def merge_into(other) def merge_into(other)
@operations.each do |operation, args, block| @operations.each do |operation, args, block|
other.send(operation, *args, &block) other.send(operation, *args, &block)
......
...@@ -57,6 +57,12 @@ def app ...@@ -57,6 +57,12 @@ def app
assert !middleware.include?("ActionDispatch::Static") assert !middleware.include?("ActionDispatch::Static")
end end
test "can delete a middleware from the stack" do
add_to_config "config.middleware.delete ActionDispatch::Static"
boot!
assert !middleware.include?("ActionDispatch::Static")
end
test "removes show exceptions if action_dispatch.show_exceptions is disabled" do test "removes show exceptions if action_dispatch.show_exceptions is disabled" do
add_to_config "config.action_dispatch.show_exceptions = false" add_to_config "config.action_dispatch.show_exceptions = false"
boot! boot!
......
...@@ -232,7 +232,7 @@ class Test::Unit::TestCase ...@@ -232,7 +232,7 @@ class Test::Unit::TestCase
require_environment = "-r #{environment}" require_environment = "-r #{environment}"
end end
`#{Gem.ruby} #{require_environment} #{RAILS_FRAMEWORK_ROOT}/bin/rails #{tmp_path('app_template')}` `#{Gem.ruby} #{require_environment} #{RAILS_FRAMEWORK_ROOT}/bin/rails new #{tmp_path('app_template')}`
File.open("#{tmp_path}/app_template/config/boot.rb", 'w') do |f| File.open("#{tmp_path}/app_template/config/boot.rb", 'w') do |f|
if require_environment if require_environment
f.puts "Dir.chdir('#{File.dirname(environment)}') do" f.puts "Dir.chdir('#{File.dirname(environment)}') do"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册