Instiki 0.16.5
Update to Rails 2.3.2 (the stable Rails 2.3 release). Add audio/speex support Update CHANGELOG Bump version number
This commit is contained in:
parent
801d307405
commit
e2ccdfd812
264 changed files with 4850 additions and 1906 deletions
|
@ -199,29 +199,18 @@ class CookieStoreTest < ActionController::IntegrationTest
|
|||
|
||||
with_test_route_set do
|
||||
# First request accesses the session
|
||||
time = Time.local(2008, 4, 24)
|
||||
Time.stubs(:now).returns(time)
|
||||
expected_expiry = (time + 5.hours).gmtime.strftime("%a, %d-%b-%Y %H:%M:%S GMT")
|
||||
|
||||
cookies[SessionKey] = SignedBar
|
||||
|
||||
get '/set_session_value'
|
||||
assert_response :success
|
||||
cookie = headers['Set-Cookie']
|
||||
|
||||
cookie_body = response.body
|
||||
assert_equal "_myapp_session=#{cookie_body}; path=/; expires=#{expected_expiry}; HttpOnly",
|
||||
headers['Set-Cookie']
|
||||
|
||||
# Second request does not access the session
|
||||
time = Time.local(2008, 4, 25)
|
||||
Time.stubs(:now).returns(time)
|
||||
expected_expiry = (time + 5.hours).gmtime.strftime("%a, %d-%b-%Y %H:%M:%S GMT")
|
||||
|
||||
# Second request does not access the session so the
|
||||
# expires header should not be changed
|
||||
get '/no_session_access'
|
||||
assert_response :success
|
||||
|
||||
assert_equal "_myapp_session=#{cookie_body}; path=/; expires=#{expected_expiry}; HttpOnly",
|
||||
headers['Set-Cookie']
|
||||
assert_equal cookie, headers['Set-Cookie'],
|
||||
"#{unmarshal_session(cookie).inspect} expected but was #{unmarshal_session(headers['Set-Cookie']).inspect}"
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -236,4 +225,13 @@ class CookieStoreTest < ActionController::IntegrationTest
|
|||
yield
|
||||
end
|
||||
end
|
||||
|
||||
def unmarshal_session(cookie_string)
|
||||
session = Rack::Utils.parse_query(cookie_string, ';,').inject({}) {|h,(k,v)|
|
||||
h[k] = Array === v ? v.first : v
|
||||
h
|
||||
}[SessionKey]
|
||||
verifier = ActiveSupport::MessageVerifier.new(SessionSecret, 'SHA1')
|
||||
verifier.verify(session)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -17,11 +17,14 @@ class MemCacheStoreTest < ActionController::IntegrationTest
|
|||
end
|
||||
|
||||
def get_session_id
|
||||
render :text => "foo: #{session[:foo].inspect}; id: #{request.session_options[:id]}"
|
||||
session[:foo]
|
||||
render :text => "#{request.session_options[:id]}"
|
||||
end
|
||||
|
||||
def call_reset_session
|
||||
session[:bar]
|
||||
reset_session
|
||||
session[:bar] = "baz"
|
||||
head :ok
|
||||
end
|
||||
|
||||
|
@ -58,6 +61,27 @@ class MemCacheStoreTest < ActionController::IntegrationTest
|
|||
end
|
||||
end
|
||||
|
||||
def test_setting_session_value_after_session_reset
|
||||
with_test_route_set do
|
||||
get '/set_session_value'
|
||||
assert_response :success
|
||||
assert cookies['_session_id']
|
||||
session_id = cookies['_session_id']
|
||||
|
||||
get '/call_reset_session'
|
||||
assert_response :success
|
||||
assert_not_equal [], headers['Set-Cookie']
|
||||
|
||||
get '/get_session_value'
|
||||
assert_response :success
|
||||
assert_equal 'foo: nil', response.body
|
||||
|
||||
get '/get_session_id'
|
||||
assert_response :success
|
||||
assert_not_equal session_id, response.body
|
||||
end
|
||||
end
|
||||
|
||||
def test_getting_session_id
|
||||
with_test_route_set do
|
||||
get '/set_session_value'
|
||||
|
@ -67,7 +91,7 @@ class MemCacheStoreTest < ActionController::IntegrationTest
|
|||
|
||||
get '/get_session_id'
|
||||
assert_response :success
|
||||
assert_equal "foo: \"bar\"; id: #{session_id}", response.body
|
||||
assert_equal session_id, response.body
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -85,22 +109,6 @@ class MemCacheStoreTest < ActionController::IntegrationTest
|
|||
assert_equal nil, cookies['_session_id']
|
||||
end
|
||||
end
|
||||
|
||||
def test_setting_session_value_after_session_reset
|
||||
with_test_route_set do
|
||||
get '/set_session_value'
|
||||
assert_response :success
|
||||
assert cookies['_session_id']
|
||||
|
||||
get '/call_reset_session'
|
||||
assert_response :success
|
||||
assert_not_equal [], headers['Set-Cookie']
|
||||
|
||||
get '/get_session_value'
|
||||
assert_response :success
|
||||
assert_equal 'foo: nil', response.body
|
||||
end
|
||||
end
|
||||
rescue LoadError, RuntimeError
|
||||
$stderr.puts "Skipping MemCacheStoreTest tests. Start memcached and try again."
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue