File: test_request_test.rb

package info (click to toggle)
rails 2.3.5-1.2%2Bsqueeze8
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 18,248 kB
  • ctags: 20,944
  • sloc: ruby: 122,413; makefile: 72; sql: 43; sh: 1
file content (35 lines) | stat: -rw-r--r-- 1,202 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
require 'abstract_unit'
require 'stringio'

class ActionController::TestRequestTest < ActiveSupport::TestCase

  def setup
    @request = ActionController::TestRequest.new
  end

  def test_test_request_has_session_options_initialized
    assert @request.session_options
  end
  
  Rack::Session::Abstract::ID::DEFAULT_OPTIONS.each_key do |option|
    test "test_rack_default_session_options_#{option}_exists_in_session_options_and_is_default" do
      assert_equal(Rack::Session::Abstract::ID::DEFAULT_OPTIONS[option], 
                   @request.session_options[option], 
                   "Missing rack session default option #{option} in request.session_options")
    end
    test "test_rack_default_session_options_#{option}_exists_in_session_options" do
      assert(@request.session_options.has_key?(option), 
                   "Missing rack session option #{option} in request.session_options")
    end
  end
  
  def test_session_id_exists_by_default
    assert_not_nil(@request.session_options[:id])
  end
  
  def test_session_id_different_on_each_call
    prev_id = 
    assert_not_equal(@request.session_options[:id], ActionController::TestRequest.new.session_options[:id])
  end
  
end