aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test
diff options
context:
space:
mode:
authorthoefer <mail@tomhoefer.de>2011-08-01 11:28:31 +0200
committerJosé Valim <jose.valim@gmail.com>2011-08-01 11:49:24 +0200
commit860202e8b2e3579402d48d7e56fa738a9529a340 (patch)
tree7a0f6e7cca0f6b8e87e8fc7bab93cc1673680b1a /actionpack/test
parentdc8773b19f61af2ba818d66923fc65e17bad6c20 (diff)
downloadrails-860202e8b2e3579402d48d7e56fa738a9529a340.tar.gz
rails-860202e8b2e3579402d48d7e56fa738a9529a340.tar.bz2
rails-860202e8b2e3579402d48d7e56fa738a9529a340.zip
Fix the issue where default_url_options is being cached on test cases. Closes #1872. Closes #2031.
Signed-off-by: José Valim <jose.valim@gmail.com>
Diffstat (limited to 'actionpack/test')
-rw-r--r--actionpack/test/controller/default_url_options_with_filter_test.rb29
1 files changed, 29 insertions, 0 deletions
diff --git a/actionpack/test/controller/default_url_options_with_filter_test.rb b/actionpack/test/controller/default_url_options_with_filter_test.rb
new file mode 100644
index 0000000000..3bbb981040
--- /dev/null
+++ b/actionpack/test/controller/default_url_options_with_filter_test.rb
@@ -0,0 +1,29 @@
+require 'abstract_unit'
+
+
+class ControllerWithBeforeFilterAndDefaultUrlOptions < ActionController::Base
+
+ before_filter { I18n.locale = params[:locale] }
+ after_filter { 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 ControllerWithBeforeFilterAndDefaultUrlOptionsTest < ActionController::TestCase
+
+ # This test has it´s roots in issue #1872
+ test "should redirect with correct locale :de" do
+ get :redirect, :locale => "de"
+ assert_redirected_to "/controller_with_before_filter_and_default_url_options/target?locale=de"
+ end
+end