Sha256: 30cf1ad36501d446b3bba04fb451a876d8b1430cf7a6a350c31702b88bcd0f8e

Contents?: true

Size: 1.04 KB

Versions: 1

Compression:

Stored size: 1.04 KB

Contents

module SecureHeaders
  describe XContentTypeOptions do
    specify{ XContentTypeOptions.new.name.should == "X-Content-Type-Options" }

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

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

          lambda {
            XContentTypeOptions.new(:value => "nosniff")
          }.should_not raise_error
        end

        it "accepts nil" do
          lambda {
            XContentTypeOptions.new
          }.should_not raise_error
        end

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
secure_headers-1.1.1 spec/lib/secure_headers/headers/x_content_type_options_spec.rb