1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Make sure :via works with mount

This commit is contained in:
Pratik Naik 2012-08-20 10:25:23 -05:00
parent 6904af1db2
commit 6a5d1c765f
2 changed files with 12 additions and 2 deletions

View file

@ -444,9 +444,10 @@ module ActionDispatch
raise "A rack application must be specified" unless path 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]) define_generate_prefix(app, options[:as])
self self

View file

@ -22,6 +22,7 @@ class TestRoutingMount < ActionDispatch::IntegrationTest
mount SprocketsApp => "/shorthand" mount SprocketsApp => "/shorthand"
mount FakeEngine, :at => "/fakeengine" mount FakeEngine, :at => "/fakeengine"
mount FakeEngine, :at => "/getfake", :via => :get
scope "/its_a" do scope "/its_a" do
mount SprocketsApp, :at => "/sprocket" mount SprocketsApp, :at => "/sprocket"
@ -52,6 +53,14 @@ class TestRoutingMount < ActionDispatch::IntegrationTest
assert_equal "/shorthand -- /omg", response.body assert_equal "/shorthand -- /omg", response.body
end 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 def test_with_fake_engine_does_not_call_invalid_method
get "/fakeengine" get "/fakeengine"
assert_equal "OK", response.body assert_equal "OK", response.body