1 require 'abstract_unit'
4 class ActionController
::TestSessionTest < ActiveSupport
::TestCase
6 def test_calling_delete_without_parameters_raises_deprecation_warning_and_calls_to_clear_test_session
7 assert_deprecated(/use clear instead/){ ActionController
::TestSession.new
.delete
}
10 def test_calling_update_without_parameters_raises_deprecation_warning_and_calls_to_clear_test_session
11 assert_deprecated(/use replace instead/){ ActionController
::TestSession.new
.update
}
14 def test_calling_close_raises_deprecation_warning
15 assert_deprecated(/sessions should no longer be closed/){ ActionController
::TestSession.new
.close
}
19 session
= ActionController
::TestSession.new
20 assert_equal({}, session
.data)
21 assert_equal('', session
.session_id
)
24 def test_ctor_allows_setting
25 session
= ActionController
::TestSession.new({:one => 'one', :two => 'two'})
26 assert_equal('one', session
[:one])
27 assert_equal('two', session
[:two])
30 def test_setting_session_item_sets_item
31 session
= ActionController
::TestSession.new
32 session
[:key] = 'value'
33 assert_equal('value', session
[:key])
36 def test_calling_delete_removes_item
37 session
= ActionController
::TestSession.new
38 session
[:key] = 'value'
39 assert_equal('value', session
[:key])
41 assert_nil(session
[:key])
44 def test_calling_update_with_params_passes_to_attributes
45 session
= ActionController
::TestSession.new()
46 session
.update('key' => 'value')
47 assert_equal('value', session
[:key])
50 def test_clear_emptys_session
51 params
= {:one => 'one', :two => 'two'}
52 session
= ActionController
::TestSession.new({:one => 'one', :two => 'two'})
54 assert_nil(session
[:one])
55 assert_nil(session
[:two])