mirror of
https://github.com/TracksApp/tracks.git
synced 2026-03-08 05:32:37 +01:00
upgrade to rails 2.3.11
Signed-off-by: Reinier Balt <lrbalt@gmail.com>
This commit is contained in:
parent
6d66406d8c
commit
736224aadb
49 changed files with 767 additions and 285 deletions
|
|
@ -100,11 +100,26 @@ class CookieTest < ActionController::TestCase
|
|||
end
|
||||
|
||||
def test_setting_cookie_with_secure
|
||||
@request.env["HTTPS"] = "on"
|
||||
get :authenticate_with_secure
|
||||
assert_equal ["user_name=david; path=/; secure"], @response.headers["Set-Cookie"]
|
||||
assert_equal({"user_name" => "david"}, @response.cookies)
|
||||
end
|
||||
|
||||
def test_setting_cookie_with_secure_in_development
|
||||
with_environment(:development) do
|
||||
get :authenticate_with_secure
|
||||
assert_equal ["user_name=david; path=/; secure"], @response.headers["Set-Cookie"]
|
||||
assert_equal({"user_name" => "david"}, @response.cookies)
|
||||
end
|
||||
end
|
||||
|
||||
def test_not_setting_cookie_with_secure
|
||||
get :authenticate_with_secure
|
||||
assert_not_equal ["user_name=david; path=/; secure"], @response.headers["Set-Cookie"]
|
||||
assert_not_equal({"user_name" => "david"}, @response.cookies)
|
||||
end
|
||||
|
||||
def test_multiple_cookies
|
||||
get :set_multiple_cookies
|
||||
assert_equal 2, @response.cookies.size
|
||||
|
|
@ -177,4 +192,17 @@ class CookieTest < ActionController::TestCase
|
|||
assert_match %r(#{20.years.from_now.year}), @response.headers["Set-Cookie"].first
|
||||
assert_equal 100, @controller.send(:cookies).signed[:remember_me]
|
||||
end
|
||||
|
||||
private
|
||||
def with_environment(enviroment)
|
||||
old_rails = Object.const_get(:Rails) rescue nil
|
||||
mod = Object.const_set(:Rails, Module.new)
|
||||
(class << mod; self; end).instance_eval do
|
||||
define_method(:env) { @_env ||= ActiveSupport::StringInquirer.new(enviroment.to_s) }
|
||||
end
|
||||
yield
|
||||
ensure
|
||||
Object.module_eval { remove_const(:Rails) } if defined?(Rails)
|
||||
Object.const_set(:Rails, old_rails) if old_rails
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue