提交 6a5d1c76 编写于 作者: P Pratik Naik

Make sure :via works with mount

上级 6904af1d
......@@ -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
......
......@@ -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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册