Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
config.force_ssl should mark the session as secure.
- Loading branch information
Showing
3 changed files
with
39 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# encoding: utf-8 | ||
require 'isolation/abstract_unit' | ||
require 'rack/test' | ||
|
||
module ApplicationTests | ||
class MiddlewareSessionTest < ActiveSupport::TestCase | ||
This comment has been minimized.
Sorry, something went wrong. |
||
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 |
Shouldn't MiddlewareSessionTest be a subclass of Test::Unit::TestCase instead?
Ah, missed it, forgot what version of rb MRI I was running against. Can't remember but I think activesupport wasn't being loaded somehow.