aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/test')
-rw-r--r--actionpack/test/controller/http_digest_authentication_test.rb2
-rw-r--r--actionpack/test/controller/request/test_request_test.rb23
-rw-r--r--actionpack/test/dispatch/session/cookie_store_test.rb3
-rw-r--r--actionpack/test/dispatch/session/test_session_test.rb24
4 files changed, 21 insertions, 31 deletions
diff --git a/actionpack/test/controller/http_digest_authentication_test.rb b/actionpack/test/controller/http_digest_authentication_test.rb
index 00789eea38..7bebc8cd2a 100644
--- a/actionpack/test/controller/http_digest_authentication_test.rb
+++ b/actionpack/test/controller/http_digest_authentication_test.rb
@@ -111,8 +111,6 @@ class HttpDigestAuthenticationTest < ActionController::TestCase
test "authentication request with valid credential and nil session" do
@request.env['HTTP_AUTHORIZATION'] = encode_credentials(:username => 'pretty', :password => 'please')
- # session_id = "" in functional test, but is +nil+ in real life
- @request.session.session_id = nil
get :display
assert_response :success
diff --git a/actionpack/test/controller/request/test_request_test.rb b/actionpack/test/controller/request/test_request_test.rb
index 81551b4ba7..0a39feb7fe 100644
--- a/actionpack/test/controller/request/test_request_test.rb
+++ b/actionpack/test/controller/request/test_request_test.rb
@@ -10,26 +10,27 @@ class ActionController::TestRequestTest < ActiveSupport::TestCase
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],
+
+ ActionDispatch::Session::AbstractStore::DEFAULT_OPTIONS.each_key do |option|
+ test "rack default session options #{option} exists in session options and is default" do
+ assert_equal(ActionDispatch::Session::AbstractStore::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),
+
+ 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 =
+ prev_id =
assert_not_equal(@request.session_options[:id], ActionController::TestRequest.new.session_options[:id])
end
-
+
end \ No newline at end of file
diff --git a/actionpack/test/dispatch/session/cookie_store_test.rb b/actionpack/test/dispatch/session/cookie_store_test.rb
index b9bf8cf411..3090a70244 100644
--- a/actionpack/test/dispatch/session/cookie_store_test.rb
+++ b/actionpack/test/dispatch/session/cookie_store_test.rb
@@ -10,8 +10,7 @@ class CookieStoreTest < ActionController::IntegrationTest
:key => SessionKey, :secret => SessionSecret)
Verifier = ActiveSupport::MessageVerifier.new(SessionSecret, 'SHA1')
-
- SignedBar = "BAh7BjoIZm9vIghiYXI%3D--fef868465920f415f2c0652d6910d3af288a0367"
+ SignedBar = Verifier.generate(:foo => "bar", :session_id => ActiveSupport::SecureRandom.hex(16))
class TestController < ActionController::Base
def no_session_access
diff --git a/actionpack/test/dispatch/session/test_session_test.rb b/actionpack/test/dispatch/session/test_session_test.rb
index de6539e1cc..0ff93f1c5d 100644
--- a/actionpack/test/dispatch/session/test_session_test.rb
+++ b/actionpack/test/dispatch/session/test_session_test.rb
@@ -2,37 +2,30 @@ require 'abstract_unit'
require 'stringio'
class ActionController::TestSessionTest < ActiveSupport::TestCase
-
def test_calling_delete_without_parameters_raises_deprecation_warning_and_calls_to_clear_test_session
assert_deprecated(/use clear instead/){ ActionController::TestSession.new.delete }
end
-
+
def test_calling_update_without_parameters_raises_deprecation_warning_and_calls_to_clear_test_session
assert_deprecated(/use replace instead/){ ActionController::TestSession.new.update }
end
-
+
def test_calling_close_raises_deprecation_warning
assert_deprecated(/sessions should no longer be closed/){ ActionController::TestSession.new.close }
end
-
- def test_defaults
- session = ActionController::TestSession.new
- assert_equal({}, session.data)
- assert_equal('', session.session_id)
- end
-
+
def test_ctor_allows_setting
session = ActionController::TestSession.new({:one => 'one', :two => 'two'})
assert_equal('one', session[:one])
assert_equal('two', session[:two])
end
-
+
def test_setting_session_item_sets_item
session = ActionController::TestSession.new
session[:key] = 'value'
assert_equal('value', session[:key])
end
-
+
def test_calling_delete_removes_item
session = ActionController::TestSession.new
session[:key] = 'value'
@@ -40,13 +33,13 @@ class ActionController::TestSessionTest < ActiveSupport::TestCase
session.delete(:key)
assert_nil(session[:key])
end
-
+
def test_calling_update_with_params_passes_to_attributes
session = ActionController::TestSession.new()
session.update('key' => 'value')
assert_equal('value', session[:key])
end
-
+
def test_clear_emptys_session
params = {:one => 'one', :two => 'two'}
session = ActionController::TestSession.new({:one => 'one', :two => 'two'})
@@ -54,5 +47,4 @@ class ActionController::TestSessionTest < ActiveSupport::TestCase
assert_nil(session[:one])
assert_nil(session[:two])
end
-
-end \ No newline at end of file
+end