Methods
T
Instance Public methods
test_clear()
# File actionpack/test/dispatch/request/session_test.rb, line 62
def test_clear
  s = Session.create(store, {}, {})
  s['rails'] = 'ftw'
  s['adequate'] = 'awesome'

  s.clear
  assert_empty(s.values)
end
test_create_adds_itself_to_env()
# File actionpack/test/dispatch/request/session_test.rb, line 7
def test_create_adds_itself_to_env
  env = {}
  s = Session.create(store, env, {})
  assert_equal s, env[Rack::Session::Abstract::ENV_SESSION_KEY]
end
test_create_merges_old()
# File actionpack/test/dispatch/request/session_test.rb, line 21
def test_create_merges_old
  env = {}
  s = Session.create(store, env, {})
  s['foo'] = 'bar'

  s1 = Session.create(store, env, {})
  assert_not_equal s, s1
  assert_equal 'bar', s1['foo']
end
test_delete()
# File actionpack/test/dispatch/request/session_test.rb, line 81
def test_delete
  s = Session.create(store, {}, {})
  s['rails'] = 'ftw'

  s.delete('rails')

  assert_empty(s.keys)
end
test_destroy()
# File actionpack/test/dispatch/request/session_test.rb, line 39
def test_destroy
  s = Session.create(store, {}, {})
  s['rails'] = 'ftw'

  s.destroy

  assert_empty s
end
test_fetch()
# File actionpack/test/dispatch/request/session_test.rb, line 90
def test_fetch
  session = Session.create(store, {}, {})

  session['one'] = '1'
  assert_equal '1', session.fetch(:one)

  assert_equal '2', session.fetch(:two, '2')
  assert_nil session.fetch(:two, nil)

  assert_equal 'three', session.fetch(:three) {|el| el.to_s }

  assert_raise KeyError do
    session.fetch(:three)
  end
end
test_find()
# File actionpack/test/dispatch/request/session_test.rb, line 31
def test_find
  env = {}
  assert_nil Session.find(env)

  s = Session.create(store, env, {})
  assert_equal s, Session.find(env)
end
test_keys()
# File actionpack/test/dispatch/request/session_test.rb, line 48
def test_keys
  s = Session.create(store, {}, {})
  s['rails'] = 'ftw'
  s['adequate'] = 'awesome'
  assert_equal %w[rails adequate], s.keys
end
test_to_hash()
# File actionpack/test/dispatch/request/session_test.rb, line 13
def test_to_hash
  env = {}
  s = Session.create(store, env, {})
  s['foo'] = 'bar'
  assert_equal 'bar', s['foo']
  assert_equal({'foo' => 'bar'}, s.to_hash)
end
test_update()
# File actionpack/test/dispatch/request/session_test.rb, line 71
def test_update
  s = Session.create(store, {}, {})
  s['rails'] = 'ftw'

  s.update(:rails => 'awesome')

  assert_equal(['rails'], s.keys)
  assert_equal('awesome', s['rails'])
end
test_values()
# File actionpack/test/dispatch/request/session_test.rb, line 55
def test_values
  s = Session.create(store, {}, {})
  s['rails'] = 'ftw'
  s['adequate'] = 'awesome'
  assert_equal %w[ftw awesome], s.values
end