Sha256: 41cbf8eb60572893f08be00a89a222c5e87e3f95066388dd458aae77377ef935

Contents?: true

Size: 1.19 KB

Versions: 1

Compression:

Stored size: 1.19 KB

Contents

# frozen_string_literal: true

require "hanami/config/actions"

RSpec.describe Hanami::Config::Actions, "default values" do
  subject(:config) { described_class.new }

  describe "sessions" do
    specify { expect(config.sessions).not_to be_enabled }
  end

  describe "name_inference_base" do
    specify { expect(config.name_inference_base).to eq "actions" }
  end

  describe "view_name_inferrer" do
    specify { expect(config.view_name_inferrer).to eq Hanami::Slice::ViewNameInferrer }
  end

  describe "view_name_inference_base" do
    specify { expect(config.view_name_inference_base).to eq "views" }
  end

  describe "new default values applied to base action settings" do
    describe "content_security_policy" do
      specify { expect(config.content_security_policy).to be_kind_of(Hanami::Config::Actions::ContentSecurityPolicy) }
    end

    describe "default_headers" do
      specify {
        config.finalize!

        expect(config.default_headers).to eq(
          "X-Frame-Options" => "DENY",
          "X-Content-Type-Options" => "nosniff",
          "X-XSS-Protection" => "1; mode=block",
          "Content-Security-Policy" => config.content_security_policy.to_s
        )
      }
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
hanami-2.1.0.beta1 spec/unit/hanami/config/actions/default_values_spec.rb