Permalink
Browse files

Expose MiddlewareStack#unshift to environment configuration.

  • Loading branch information...
1 parent 941516d commit 4de8851289077239ecc91473bdba30f8cf6727bb @benpickles benpickles committed Oct 9, 2013
Showing with 14 additions and 0 deletions.
  1. +4 −0 railties/CHANGELOG.md
  2. +4 −0 railties/lib/rails/configuration.rb
  3. +6 −0 railties/test/application/middleware_test.rb
View
4 railties/CHANGELOG.md
@@ -1,3 +1,7 @@
+* Expose MiddlewareStack#unshift to environment configuration.
+
+ *Ben Pickles*
+
* Include `web-console` into newly generated applications' Gemfile.
*Genadi Samokovarov*
View
4 railties/lib/rails/configuration.rb
@@ -59,6 +59,10 @@ def delete(*args, &block)
@operations << [__method__, args, block]
end
+ def unshift(*args, &block)
+ @operations << [__method__, args, block]
+ end
+
def merge_into(other) #:nodoc:
@operations.each do |operation, args, block|
other.send(operation, *args, &block)
View
6 railties/test/application/middleware_test.rb
@@ -144,6 +144,12 @@ def app
assert_equal "Rack::Config", middleware.second
end
+ test 'unshift middleware' do
+ add_to_config 'config.middleware.unshift Rack::Config'
+ boot!
+ assert_equal 'Rack::Config', middleware.first
+ end
+
test "Rails.cache does not respond to middleware" do
add_to_config "config.cache_store = :memory_store"
boot!

0 comments on commit 4de8851

Please sign in to comment.