提交 c8284c80 编写于 作者: R Rafael Mendonça França

Merge pull request #17896 from GBH/globbing_route_mailer_preview

fixing mailer previews for apps with globbing route
......@@ -41,7 +41,7 @@ class Railtie < Rails::Railtie # :nodoc:
options.each { |k,v| send("#{k}=", v) }
if options.show_previews
app.routes.append do
app.routes.prepend do
get '/rails/mailers' => "rails/mailers#index"
get '/rails/mailers/*path' => "rails/mailers#preview"
end
......
......@@ -40,6 +40,17 @@ def teardown
assert_equal 404, last_response.status
end
test "/rails/mailers is accessible with globbing route present" do
app_file "config/routes.rb", <<-RUBY
Rails.application.routes.draw do
get '*foo', to: 'foo#index'
end
RUBY
app("development")
get "/rails/mailers"
assert_equal 200, last_response.status
end
test "mailer previews are loaded from the default preview_path" do
mailer 'notifier', <<-RUBY
class Notifier < ActionMailer::Base
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册