Sha256: cd372fa76d6f2ddcb1284dbb04447803aa3cfa1a240909bb5299c36c3009d089

Contents?: true

Size: 1.09 KB

Versions: 4

Compression:

Stored size: 1.09 KB

Contents

require 'spec_helper'

module SecureHeaders
  describe XContentTypeOptions do
    specify{ expect(XContentTypeOptions.new.name).to eq("X-Content-Type-Options") }

    describe "#value" do
      specify { expect(XContentTypeOptions.new.value).to eq(XContentTypeOptions::Constants::DEFAULT_VALUE)}
      specify { expect(XContentTypeOptions.new("nosniff").value).to eq("nosniff")}
      specify { expect(XContentTypeOptions.new(:value => 'nosniff').value).to eq("nosniff")}

      context "invalid configuration values" do
        it "accepts nosniff" do
          expect {
            XContentTypeOptions.new("nosniff")
          }.not_to raise_error

          expect {
            XContentTypeOptions.new(:value => "nosniff")
          }.not_to raise_error
        end

        it "accepts nil" do
          expect {
            XContentTypeOptions.new
          }.not_to raise_error
        end

        it "doesn't accept anything besides no-sniff" do
          expect {
            XContentTypeOptions.new("donkey")
          }.to raise_error(XContentTypeOptionsBuildError)
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
secure_headers-2.5.3 spec/lib/secure_headers/headers/x_content_type_options_spec.rb
secure_headers-2.5.2 spec/lib/secure_headers/headers/x_content_type_options_spec.rb
secure_headers-2.5.1 spec/lib/secure_headers/headers/x_content_type_options_spec.rb
secure_headers-2.5.0 spec/lib/secure_headers/headers/x_content_type_options_spec.rb