Sha256: 4d944aa6d164d64f1293a1a341aeaf243f3620292fa7263e502c1a45c4c607ef

Contents?: true

Size: 1.04 KB

Versions: 20

Compression:

Stored size: 1.04 KB

Contents

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
        end
      end
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
secure_headers-2.3.0 spec/lib/secure_headers/headers/x_content_type_options_spec.rb
secure_headers-2.2.4 spec/lib/secure_headers/headers/x_content_type_options_spec.rb
secure_headers-2.2.3 spec/lib/secure_headers/headers/x_content_type_options_spec.rb
secure_headers-2.2.2 spec/lib/secure_headers/headers/x_content_type_options_spec.rb
secure_headers-2.2.1 spec/lib/secure_headers/headers/x_content_type_options_spec.rb
secure_headers-2.2.0 spec/lib/secure_headers/headers/x_content_type_options_spec.rb
secure_headers-2.1.0 spec/lib/secure_headers/headers/x_content_type_options_spec.rb
secure_headers-2.0.2 spec/lib/secure_headers/headers/x_content_type_options_spec.rb
secure_headers-2.0.1 spec/lib/secure_headers/headers/x_content_type_options_spec.rb
secure_headers-2.0.0 spec/lib/secure_headers/headers/x_content_type_options_spec.rb
secure_headers-1.4.1 spec/lib/secure_headers/headers/x_content_type_options_spec.rb
secure_headers-1.4.0 spec/lib/secure_headers/headers/x_content_type_options_spec.rb
secure_headers-2.0.0.pre2 spec/lib/secure_headers/headers/x_content_type_options_spec.rb
secure_headers-2.0.0.pre spec/lib/secure_headers/headers/x_content_type_options_spec.rb
secure_headers-1.3.4 spec/lib/secure_headers/headers/x_content_type_options_spec.rb
secure_headers-1.3.3 spec/lib/secure_headers/headers/x_content_type_options_spec.rb
secure_headers-1.3.2 spec/lib/secure_headers/headers/x_content_type_options_spec.rb
secure_headers-1.3.1 spec/lib/secure_headers/headers/x_content_type_options_spec.rb
secure_headers-1.3.0 spec/lib/secure_headers/headers/x_content_type_options_spec.rb
secure_headers-1.2.0 spec/lib/secure_headers/headers/x_content_type_options_spec.rb