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:
parent
6904af1db2
commit
6a5d1c765f
2 changed files with 12 additions and 2 deletions
|
@ -445,8 +445,9 @@ module ActionDispatch
|
|||
raise "A rack application must be specified" unless path
|
||||
|
||||
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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue