0
@@ -21,10 +21,10 @@ class VerificationTest < Test::Unit::TestCase
0
verify :only => :guarded_by_method, :method => :post,
0
:redirect_to => { :action => "unguarded" }
0
verify :only => :guarded_by_xhr, :xhr => true,
0
:redirect_to => { :action => "unguarded" }
0
verify :only => :guarded_by_not_xhr, :xhr => false,
0
:redirect_to => { :action => "unguarded" }
0
@@ -39,10 +39,13 @@ class VerificationTest < Test::Unit::TestCase
0
verify :only => :no_default_action, :params => "santa"
0
+ verify :only => :guarded_with_back, :method => :post,
0
render :text => "#{params[:one]}"
0
def guarded_one_for_named_route_test
0
render :text => "#{params[:one]}"
0
@@ -70,11 +73,11 @@ class VerificationTest < Test::Unit::TestCase
0
render :text => "#{request.method}"
0
render :text => "#{request.xhr?}"
0
render :text => "#{request.xhr?}"
0
@@ -86,15 +89,19 @@ class VerificationTest < Test::Unit::TestCase
0
render :nothing => true
0
render :text => "Was a post!"
0
+ render :text => "#{params[:one]}"
0
def rescue_action(e) raise end
0
@@ -109,7 +116,17 @@ class VerificationTest < Test::Unit::TestCase
0
@response = ActionController::TestResponse.new
0
ActionController::Routing::Routes.add_named_route :foo, '/foo', :controller => 'test', :action => 'foo'
0
+ def test_using_symbol_back_with_no_referrer
0
+ assert_raise(ActionController::RedirectBackError) { get :guarded_with_back }
0
+ def test_using_symbol_back_redirects_to_referrer
0
+ @request.env["HTTP_REFERER"] = "/foo"
0
+ get :guarded_with_back
0
+ assert_redirected_to '/foo'
0
def test_no_deprecation_warning_for_named_route
0
assert_not_deprecated do
0
get :guarded_one_for_named_route_test, :two => "not one"
0
@@ -209,44 +226,44 @@ class VerificationTest < Test::Unit::TestCase
0
assert_redirected_to :action => "unguarded"
0
def test_guarded_by_xhr_with_prereqs
0
xhr :post, :guarded_by_xhr
0
assert_equal "true", @response.body
0
def test_guarded_by_xhr_without_prereqs
0
assert_redirected_to :action => "unguarded"
0
def test_guarded_by_not_xhr_with_prereqs
0
get :guarded_by_not_xhr
0
assert_equal "false", @response.body
0
def test_guarded_by_not_xhr_without_prereqs
0
xhr :post, :guarded_by_not_xhr
0
assert_redirected_to :action => "unguarded"
0
def test_guarded_post_and_calls_render_succeeds
0
assert_equal "Was a post!", @response.body
0
def test_default_failure_should_be_a_bad_request
0
post :no_default_action
0
assert_response :bad_request
0
def test_guarded_post_and_calls_render_fails_and_sets_allow_header
0
assert_equal "Must be post", @response.body
0
assert_equal "POST", @response.headers["Allow"]
0
def test_second_redirect
0
assert_nothing_raised { get :two_redirects }