Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Make sure :via works with mount

  • Loading branch information...
commit 6a5d1c765fc82f4d4e32f5bc41a78cac4f62ef2b 1 parent 6904af1
@lifo lifo authored
View
5 actionpack/lib/action_dispatch/routing/mapper.rb
@@ -444,9 +444,10 @@ def mount(app, options = nil)
raise "A rack application must be specified" unless path
- options[:as] ||= app_name(app)
+ options[:as] ||= app_name(app)
+ options[:via] ||= :all
- match(path, options.merge(:to => app, :anchor => false, :format => false, :via => :all))
+ match(path, options.merge(:to => app, :anchor => false, :format => false))
define_generate_prefix(app, options[:as])
self
View
9 actionpack/test/dispatch/mount_test.rb
@@ -22,6 +22,7 @@ def self.call(env)
mount SprocketsApp => "/shorthand"
mount FakeEngine, :at => "/fakeengine"
+ mount FakeEngine, :at => "/getfake", :via => :get
scope "/its_a" do
mount SprocketsApp, :at => "/sprocket"
@@ -52,6 +53,14 @@ def test_mounting_with_shorthand
assert_equal "/shorthand -- /omg", response.body
end
+ def test_mounting_works_with_via
+ get "/getfake"
+ assert_equal "OK", response.body
+
+ post "/getfake"
+ assert_response :not_found
+ end
+
def test_with_fake_engine_does_not_call_invalid_method
get "/fakeengine"
assert_equal "OK", response.body
Please sign in to comment.
Something went wrong with that request. Please try again.