aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test/application
diff options
context:
space:
mode:
authorRemo Mueller <remosm@gmail.com>2015-02-26 09:29:01 -0500
committerRemo Mueller <remosm@gmail.com>2015-04-30 10:12:00 -0400
commitf5132c19d52c4457aa2e09c647d2f52a73966c68 (patch)
treebf6fb095c11c39f3da1468e720a50119d97004e3 /railties/test/application
parent8fd46330095b3c1a5d7461c194028e22d9b77b97 (diff)
downloadrails-f5132c19d52c4457aa2e09c647d2f52a73966c68.tar.gz
rails-f5132c19d52c4457aa2e09c647d2f52a73966c68.tar.bz2
rails-f5132c19d52c4457aa2e09c647d2f52a73966c68.zip
Mailer preview now uses `url_for` to fix links to emails for apps running on a subdirectory, closes #19092.
Diffstat (limited to 'railties/test/application')
-rw-r--r--railties/test/application/mailer_previews_test.rb30
1 files changed, 30 insertions, 0 deletions
diff --git a/railties/test/application/mailer_previews_test.rb b/railties/test/application/mailer_previews_test.rb
index 83501a7f11..1835d42c82 100644
--- a/railties/test/application/mailer_previews_test.rb
+++ b/railties/test/application/mailer_previews_test.rb
@@ -454,6 +454,36 @@ module ApplicationTests
assert_match '<option selected value="?part=text%2Fplain">View as plain-text email</option>', last_response.body
end
+ test "mailer previews create correct links when loaded on a subdirectory" do
+ mailer 'notifier', <<-RUBY
+ class Notifier < ActionMailer::Base
+ default from: "from@example.com"
+
+ def foo
+ mail to: "to@example.org"
+ end
+ end
+ RUBY
+
+ text_template 'notifier/foo', <<-RUBY
+ Hello, World!
+ RUBY
+
+ mailer_preview 'notifier', <<-RUBY
+ class NotifierPreview < ActionMailer::Preview
+ def foo
+ Notifier.foo
+ end
+ end
+ RUBY
+
+ app('development')
+
+ get "/rails/mailers", {}, 'SCRIPT_NAME' => '/my_app'
+ assert_match '<h3><a href="/my_app/rails/mailers/notifier">Notifier</a></h3>', last_response.body
+ assert_match '<li><a href="/my_app/rails/mailers/notifier/foo">foo</a></li>', last_response.body
+ end
+
private
def build_app
super