diff options
author | José Valim <jose.valim@gmail.com> | 2012-01-12 20:46:54 +0100 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2012-01-13 19:55:34 +0100 |
commit | b745fe1e83df24990f8489a819bef62f4add49a5 (patch) | |
tree | 714bddeb6ac8b1026ec0705cad1ed9f1df42a2b7 /railties/test/application/middleware | |
parent | 70631e723ca9503b387f25076b9fb7f68726f81e (diff) | |
download | rails-b745fe1e83df24990f8489a819bef62f4add49a5.tar.gz rails-b745fe1e83df24990f8489a819bef62f4add49a5.tar.bz2 rails-b745fe1e83df24990f8489a819bef62f4add49a5.zip |
config.force_ssl should mark the session as secure.
Diffstat (limited to 'railties/test/application/middleware')
-rw-r--r-- | railties/test/application/middleware/session_test.rb | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/railties/test/application/middleware/session_test.rb b/railties/test/application/middleware/session_test.rb new file mode 100644 index 0000000000..f4e77ee244 --- /dev/null +++ b/railties/test/application/middleware/session_test.rb @@ -0,0 +1,30 @@ +# encoding: utf-8 +require 'isolation/abstract_unit' +require 'rack/test' + +module ApplicationTests + class MiddlewareSessionTest < ActiveSupport::TestCase + include ActiveSupport::Testing::Isolation + include Rack::Test::Methods + + def setup + build_app + boot_rails + FileUtils.rm_rf "#{app_path}/config/environments" + end + + def teardown + teardown_app + end + + def app + @app ||= Rails.application + end + + test "config.force_ssl sets cookie to secure only" do + add_to_config "config.force_ssl = true" + require "#{app_path}/config/environment" + assert app.config.session_options[:secure], "Expected session to be marked as secure" + end + end +end |