Sha256: 45bb6860325358fead1521183575cd22dadd25196ce8c51d4630327be6e9bbd8

Contents?: true

Size: 1.07 KB

Versions: 12

Compression:

Stored size: 1.07 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(XContentTypeOptionsBuildError)
        end
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
secure_headers-1.1.0 spec/lib/secure_headers/headers/x_content_type_options_spec.rb
secure_headers-1.0.0 spec/lib/secure_headers/headers/x_content_type_options_spec.rb
secure_headers-0.5.0 spec/lib/secure_headers/headers/x_content_type_options_spec.rb
secure_headers-0.4.3 spec/lib/secure_headers/headers/x_content_type_options_spec.rb
secure_headers-0.4.2 spec/lib/secure_headers/headers/x_content_type_options_spec.rb
secure_headers-0.4.1 spec/lib/secure_headers/headers/x_content_type_options_spec.rb
secure_headers-0.4.0 spec/lib/secure_headers/headers/x_content_type_options_spec.rb
secure_headers-0.3.0 spec/lib/secure_headers/headers/x_content_type_options_spec.rb
secure_headers-0.2.1 spec/lib/secure_headers/headers/x_content_type_options_spec.rb
secure_headers-0.2.0 spec/lib/secure_headers/headers/x_content_type_options_spec.rb
secure_headers-0.1.1 spec/lib/secure_headers/headers/x_content_type_options_spec.rb
secure_headers-0.1.0 spec/lib/secure_headers/headers/x_content_type_options_spec.rb