Sha256: 8a3c1a710c987cfa27193648682868bc7b42309ecff9272ccc141092e3844ff1

Contents?: true

Size: 626 Bytes

Versions: 2

Compression:

Stored size: 626 Bytes

Contents

require_relative "../lib/tynn/protection"

test "includes secure headers" do
  Tynn.helpers(Tynn::Protection)

  assert Tynn.include?(Tynn::SecureHeaders)
end

test "includes ssl helper if ssl is true" do
  Tynn.helpers(Tynn::Protection, ssl: true)

  assert Tynn.include?(Tynn::SSL)
end

test "supports hsts options" do
  hsts = { expires: 100, subdomains: false, preload: true }

  Tynn.helpers(Tynn::Protection, ssl: true, hsts: hsts)

  Tynn.define do
  end

  app = Tynn::Test.new
  app.get("/", {}, "HTTPS" => "on")

  hsts = app.res.headers["Strict-Transport-Security"]

  assert_equal "max-age=100; preload", hsts
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
tynn-0.0.4 test/protection_test.rb
tynn-0.0.3 test/protection_test.rb