Sha256: 44e8429b24954a01f4789d085b41c859341b0888983aed219f61745d1d60cd03

Contents?: true

Size: 522 Bytes

Versions: 2

Compression:

Stored size: 522 Bytes

Contents

require_relative "../lib/tynn/force_ssl"

setup do
  Tynn::Test.new
end

test "redirects to https" do |app|
  Tynn.helpers(Tynn::ForceSSL)

  Tynn.define do
  end

  app.get("/")

  assert_equal 301, app.res.status
  assert_equal "https://example.org/", app.res.location
end

test "https request" do |app|
  Tynn.helpers(Tynn::ForceSSL)

  Tynn.define do
    root do
      res.write("secure")
    end
  end

  app.get("/", {}, "HTTPS" => "on")

  assert_equal 200, app.res.status
  assert_equal "secure", app.res.body
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
tynn-1.0.0 test/force_ssl_test.rb
tynn-1.0.0.rc3 test/force_ssl_test.rb