Sha256: 0e8c8df6c39916efa025c15080c7f48f1f93710c846ac6feb2706a0f53b56159

Contents?: true

Size: 1.13 KB

Versions: 3

Compression:

Stored size: 1.13 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(XFOBuildError)
        end

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

        it "allows ALLOW-FROM*" do
          lambda {
            XFrameOptions.new("ALLOW-FROM: example.com").value
          }.should_not raise_error(XFOBuildError)
        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

3 entries across 3 versions & 1 rubygems

Version Path
secure_headers-1.1.0 spec/lib/secure_headers/headers/x_frame_options_spec.rb
secure_headers-1.0.0 spec/lib/secure_headers/headers/x_frame_options_spec.rb
secure_headers-0.5.0 spec/lib/secure_headers/headers/x_frame_options_spec.rb