Sha256: 563276e79e54750da8d8a7a0c647bdd17ef7b5e40652ae5330000dec4e1ee13b

Contents?: true

Size: 983 Bytes

Versions: 33

Compression:

Stored size: 983 Bytes

Contents

# frozen_string_literal: true
require "spec_helper"

module SecureHeaders
  describe XContentTypeOptions do
    describe "#value" do
      specify { expect(XContentTypeOptions.make_header).to eq([XContentTypeOptions::HEADER_NAME, XContentTypeOptions::DEFAULT_VALUE]) }
      specify { expect(XContentTypeOptions.make_header("nosniff")).to eq([XContentTypeOptions::HEADER_NAME, "nosniff"]) }

      context "invalid configuration values" do
        it "accepts nosniff" do
          expect do
            XContentTypeOptions.validate_config!("nosniff")
          end.not_to raise_error
        end

        it "accepts nil" do
          expect do
            XContentTypeOptions.validate_config!(nil)
          end.not_to raise_error
        end

        it "doesn't accept anything besides no-sniff" do
          expect do
            XContentTypeOptions.validate_config!("donkey")
          end.to raise_error(XContentTypeOptionsConfigError)
        end
      end
    end
  end
end

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
secure_headers-7.0.0 spec/lib/secure_headers/headers/x_content_type_options_spec.rb
secure_headers-6.7.0 spec/lib/secure_headers/headers/x_content_type_options_spec.rb
secure_headers-6.6.0 spec/lib/secure_headers/headers/x_content_type_options_spec.rb
secure_headers-6.5.0 spec/lib/secure_headers/headers/x_content_type_options_spec.rb
secure_headers-6.4.0 spec/lib/secure_headers/headers/x_content_type_options_spec.rb
secure_headers-6.3.4 spec/lib/secure_headers/headers/x_content_type_options_spec.rb
secure_headers-6.3.3 spec/lib/secure_headers/headers/x_content_type_options_spec.rb
secure_headers-6.3.2 spec/lib/secure_headers/headers/x_content_type_options_spec.rb
secure_headers-6.3.1 spec/lib/secure_headers/headers/x_content_type_options_spec.rb
secure_headers-5.2.0 spec/lib/secure_headers/headers/x_content_type_options_spec.rb
secure_headers-6.3.0 spec/lib/secure_headers/headers/x_content_type_options_spec.rb
secure_headers-5.1.0 spec/lib/secure_headers/headers/x_content_type_options_spec.rb
secure_headers-6.2.0 spec/lib/secure_headers/headers/x_content_type_options_spec.rb
secure_headers-6.1.2 spec/lib/secure_headers/headers/x_content_type_options_spec.rb
secure_headers-6.1.1 spec/lib/secure_headers/headers/x_content_type_options_spec.rb
secure_headers-6.1.0 spec/lib/secure_headers/headers/x_content_type_options_spec.rb
secure_headers-6.0.0 spec/lib/secure_headers/headers/x_content_type_options_spec.rb
secure_headers-6.0.0.alpha03 spec/lib/secure_headers/headers/x_content_type_options_spec.rb
secure_headers-6.0.0.alpha02 spec/lib/secure_headers/headers/x_content_type_options_spec.rb
secure_headers-6.0.0.alpha01 spec/lib/secure_headers/headers/x_content_type_options_spec.rb