aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/controller/default_url_options_with_before_action_test.rb
diff options
context:
space:
mode:
authorFrancesco Rodriguez <lrodriguezsanc@gmail.com>2012-12-08 10:20:59 -0500
committerFrancesco Rodriguez <lrodriguezsanc@gmail.com>2012-12-08 10:21:20 -0500
commit4ec7493e3cb9366df604f9f3082b4cd6f6dfd4fd (patch)
treea9ebf2deafa6a04bde975886d3fc98b630683ece /actionpack/test/controller/default_url_options_with_before_action_test.rb
parentbef330803ae4a30bfeaf6dd9c86077cfb5e250e1 (diff)
downloadrails-4ec7493e3cb9366df604f9f3082b4cd6f6dfd4fd.tar.gz
rails-4ec7493e3cb9366df604f9f3082b4cd6f6dfd4fd.tar.bz2
rails-4ec7493e3cb9366df604f9f3082b4cd6f6dfd4fd.zip
use _action callbacks in actionmailer
Diffstat (limited to 'actionpack/test/controller/default_url_options_with_before_action_test.rb')
-rw-r--r--actionpack/test/controller/default_url_options_with_before_action_test.rb29
1 files changed, 29 insertions, 0 deletions
diff --git a/actionpack/test/controller/default_url_options_with_before_action_test.rb b/actionpack/test/controller/default_url_options_with_before_action_test.rb
new file mode 100644
index 0000000000..656fd0431e
--- /dev/null
+++ b/actionpack/test/controller/default_url_options_with_before_action_test.rb
@@ -0,0 +1,29 @@
+require 'abstract_unit'
+
+
+class ControllerWithBeforeActionAndDefaultUrlOptions < ActionController::Base
+
+ before_action { I18n.locale = params[:locale] }
+ after_action { I18n.locale = "en" }
+
+ def target
+ render :text => "final response"
+ end
+
+ def redirect
+ redirect_to :action => "target"
+ end
+
+ def default_url_options
+ {:locale => "de"}
+ end
+end
+
+class ControllerWithBeforeActionAndDefaultUrlOptionsTest < ActionController::TestCase
+
+ # This test has its roots in issue #1872
+ test "should redirect with correct locale :de" do
+ get :redirect, :locale => "de"
+ assert_redirected_to "/controller_with_before_action_and_default_url_options/target?locale=de"
+ end
+end