Sha256: 58b4e3a48a28433ea6770c21582b317076e0bad96fe5b18ccece7617d9f47296

Contents?: true

Size: 1.08 KB

Versions: 1

Compression:

Stored size: 1.08 KB

Contents

require 'spec_helper'

module SecureHeaders
  describe XFrameOptions do
    specify{ XFrameOptions.new.name.should == "X-Frame-Options" }

    describe "#value" do
      specify { XFrameOptions.new.value.should == XFrameOptions::Constants::DEFAULT_VALUE}
      specify { XFrameOptions.new("SAMEORIGIN").value.should == "SAMEORIGIN"}
      specify { XFrameOptions.new(:value => 'DENY').value.should == "DENY"}

      context "with invalid configuration" do
        it "allows SAMEORIGIN" do
          lambda {
            XFrameOptions.new("SAMEORIGIN").value
          }.should_not raise_error
        end

        it "allows DENY" do
          lambda {
            XFrameOptions.new("DENY").value
          }.should_not raise_error        end

        it "allows ALLOW-FROM*" do
          lambda {
            XFrameOptions.new("ALLOW-FROM: example.com").value
          }.should_not raise_error
        end
        it "does not allow garbage" do
          lambda {
            XFrameOptions.new("I like turtles").value
          }.should raise_error(XFOBuildError)
        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_frame_options_spec.rb