mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
fixing mailer previews for apps with globbing route
This commit is contained in:
parent
497544f0b3
commit
ccc3ddb776
2 changed files with 12 additions and 1 deletions
|
@ -41,7 +41,7 @@ module ActionMailer
|
|||
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 @@ module ApplicationTests
|
|||
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
|
||||
|
|
Loading…
Reference in a new issue