Sha256: 9162c0f70b79b13e2dfcecea19d37901358b52fde9124552aac913a512a1e507

Contents?: true

Size: 1.05 KB

Versions: 3

Compression:

Stored size: 1.05 KB

Contents

# frozen_string_literal: true

RSpec.describe "force SSL", type: :integration do
  it "forces SSL" do
    project = "bookshelf_force_ssl"

    with_project(project, server: :puma) do
      generate "action web home#index --url=/"

      inject_line_after "apps/web/app.rb", "configure do", "force_ssl true"

      RSpec::Support::Env["HANAMI_ENV"]   = "production"
      RSpec::Support::Env["DATABASE_URL"] = "sqlite://#{Pathname.new('db').join('bookshelf.sqlite')}"
      RSpec::Support::Env["SMTP_HOST"]    = "localhost"
      RSpec::Support::Env["SMTP_PORT"]    = "25"

      # key  = Pathname.new(__dir__).join("..", "fixtures", "openssl", "server.key").realpath
      # cert = Pathname.new(__dir__).join("..", "fixtures", "openssl", "server.crt").realpath

      # bundle_exec "puma -b 'ssl://127.0.0.1:2300?key=#{key}&cert=#{cert}'" do
      server do
        # FIXME: I know, it's lame how I solved this problem, but I can't get Excon to do SSL handshake
        expect do
          get "/"
        end.to raise_error(Excon::Error::Socket)
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
hanami-2.0.0.beta2 spec/integration/security/force_ssl_spec.rb
hanami-2.0.0.beta1.1 spec/integration/security/force_ssl_spec.rb
hanami-2.0.0.beta1 spec/integration/security/force_ssl_spec.rb