Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: d76439239d
Fetching contributors…

Cannot retrieve contributors at this time

71 lines (57 sloc) 1.57 kb
require File.dirname(__FILE__) + '/../abstract_unit'
class SessionManagementTest < Test::Unit::TestCase
class SessionOffController < ActionController::Base
session :off
def show
render_text "done"
end
def tell
render_text "done"
end
end
class TestController < ActionController::Base
session :off, :only => :show
session :session_secure => true, :except => :show
def show
render_text "done"
end
def tell
render_text "done"
end
end
class SpecializedController < SessionOffController
session :disabled => false, :only => :something
def something
render_text "done"
end
def another
render_text "done"
end
end
def setup
@request, @response = ActionController::TestRequest.new,
ActionController::TestResponse.new
end
def test_session_off_globally
@controller = SessionOffController.new
get :show
assert_equal false, @request.session_options
get :tell
assert_equal false, @request.session_options
end
def test_session_off_conditionally
@controller = TestController.new
get :show
assert_equal false, @request.session_options
get :tell
assert_instance_of Hash, @request.session_options
assert @request.session_options[:session_secure]
end
def test_controller_specialization_overrides_settings
@controller = SpecializedController.new
get :something
assert_instance_of Hash, @request.session_options
get :another
assert_equal false, @request.session_options
end
end
Jump to Line
Something went wrong with that request. Please try again.