diff options
author | Pratik Naik <pratiknaik@gmail.com> | 2012-08-20 10:25:23 -0500 |
---|---|---|
committer | Pratik Naik <pratiknaik@gmail.com> | 2012-08-20 10:25:23 -0500 |
commit | 6a5d1c765fc82f4d4e32f5bc41a78cac4f62ef2b (patch) | |
tree | 4d9475bd0f0b780a790109f1625b71e76aa541db /actionpack | |
parent | 6904af1db2f35c6bdb9294d2c8687c86fe20a395 (diff) | |
download | rails-6a5d1c765fc82f4d4e32f5bc41a78cac4f62ef2b.tar.gz rails-6a5d1c765fc82f4d4e32f5bc41a78cac4f62ef2b.tar.bz2 rails-6a5d1c765fc82f4d4e32f5bc41a78cac4f62ef2b.zip |
Make sure :via works with mount
Diffstat (limited to 'actionpack')
-rw-r--r-- | actionpack/lib/action_dispatch/routing/mapper.rb | 5 | ||||
-rw-r--r-- | actionpack/test/dispatch/mount_test.rb | 9 |
2 files changed, 12 insertions, 2 deletions
diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb index ea5028a7c0..f64cff8394 100644 --- a/actionpack/lib/action_dispatch/routing/mapper.rb +++ b/actionpack/lib/action_dispatch/routing/mapper.rb @@ -444,9 +444,10 @@ module ActionDispatch 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 diff --git a/actionpack/test/dispatch/mount_test.rb b/actionpack/test/dispatch/mount_test.rb index 536e35ab2e..3b008fdff0 100644 --- a/actionpack/test/dispatch/mount_test.rb +++ b/actionpack/test/dispatch/mount_test.rb @@ -22,6 +22,7 @@ class TestRoutingMount < ActionDispatch::IntegrationTest 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 @@ class TestRoutingMount < ActionDispatch::IntegrationTest 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 |