Sha256: cbfa0c11ed8c9645364a1b0fe971dcbe5dcdcd87ab7efa5f439b2a8e5e7cb80b

Contents?: true

Size: 1.62 KB

Versions: 4

Compression:

Stored size: 1.62 KB

Contents

require "hanami/configuration/actions"

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

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

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

  describe "view_context_identifier" do
    specify { expect(configuration.view_context_identifier).to eq "views.context" }
  end

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

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

  describe "new default values applied to base action settings" do
    describe "default_request_format" do
      specify { expect(configuration.default_request_format).to eq :html }
    end

    describe "default_response_format" do
      specify { expect(configuration.default_response_format).to eq :html }
    end

    describe "content_security_policy" do
      specify { expect(configuration.content_security_policy).to be_kind_of(Hanami::Configuration::Actions::ContentSecurityPolicy) }
    end

    describe "default_headers" do
      specify {
        configuration.finalize!

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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
hanami-2.0.0.beta3 spec/unit/hanami/configuration/actions/default_values_spec.rb
hanami-2.0.0.beta2 spec/unit/hanami/configuration/actions/default_values_spec.rb
hanami-2.0.0.beta1.1 spec/unit/hanami/configuration/actions/default_values_spec.rb
hanami-2.0.0.beta1 spec/unit/hanami/configuration/actions/default_values_spec.rb