Sha256: e797ef99b9de3e8608e0325244be12c9fdb153f3da11c4385d7b315ecd766fb3

Contents?: true

Size: 1.02 KB

Versions: 36

Compression:

Stored size: 1.02 KB

Contents

require 'spec_helper'

module SecureHeaders
  describe XFrameOptions do
    describe "#value" do
      specify { expect(XFrameOptions.make_header).to eq([XFrameOptions::HEADER_NAME, XFrameOptions::DEFAULT_VALUE]) }
      specify { expect(XFrameOptions.make_header("DENY")).to eq([XFrameOptions::HEADER_NAME, "DENY"]) }

      context "with invalid configuration" do
        it "allows SAMEORIGIN" do
          expect do
            XFrameOptions.validate_config!("SAMEORIGIN")
          end.not_to raise_error
        end

        it "allows DENY" do
          expect do
            XFrameOptions.validate_config!("DENY")
          end.not_to raise_error
        end

        it "allows ALLOW-FROM*" do
          expect do
            XFrameOptions.validate_config!("ALLOW-FROM: example.com")
          end.not_to raise_error
        end
        it "does not allow garbage" do
          expect do
            XFrameOptions.validate_config!("I like turtles")
          end.to raise_error(XFOConfigError)
        end
      end
    end
  end
end

Version data entries

36 entries across 36 versions & 1 rubygems

Version Path
secure_headers-3.9.0 spec/lib/secure_headers/headers/x_frame_options_spec.rb
secure_headers-3.8.0 spec/lib/secure_headers/headers/x_frame_options_spec.rb
secure_headers-3.7.4 spec/lib/secure_headers/headers/x_frame_options_spec.rb
secure_headers-3.7.3 spec/lib/secure_headers/headers/x_frame_options_spec.rb
secure_headers-3.7.2 spec/lib/secure_headers/headers/x_frame_options_spec.rb
secure_headers-3.7.1 spec/lib/secure_headers/headers/x_frame_options_spec.rb
secure_headers-3.7.0 spec/lib/secure_headers/headers/x_frame_options_spec.rb
secure_headers-3.6.7 spec/lib/secure_headers/headers/x_frame_options_spec.rb
secure_headers-3.6.6 spec/lib/secure_headers/headers/x_frame_options_spec.rb
secure_headers-3.6.5 spec/lib/secure_headers/headers/x_frame_options_spec.rb
secure_headers-3.6.4 spec/lib/secure_headers/headers/x_frame_options_spec.rb
secure_headers-3.6.3 spec/lib/secure_headers/headers/x_frame_options_spec.rb
secure_headers-3.6.2 spec/lib/secure_headers/headers/x_frame_options_spec.rb
secure_headers-3.6.1 spec/lib/secure_headers/headers/x_frame_options_spec.rb
secure_headers-3.6.0 spec/lib/secure_headers/headers/x_frame_options_spec.rb
secure_headers-3.5.1 spec/lib/secure_headers/headers/x_frame_options_spec.rb
secure_headers-3.5.0 spec/lib/secure_headers/headers/x_frame_options_spec.rb
secure_headers-3.5.0.pre spec/lib/secure_headers/headers/x_frame_options_spec.rb
secure_headers-3.4.1 spec/lib/secure_headers/headers/x_frame_options_spec.rb
secure_headers-3.4.0 spec/lib/secure_headers/headers/x_frame_options_spec.rb