Sha256: fc6eeffb8968f75ad5c43114229d86a52abbfa4c2d8cd27071d4def2e71f24f7

Contents?: true

Size: 1.05 KB

Versions: 33

Compression:

Stored size: 1.05 KB

Contents

# frozen_string_literal: true
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

33 entries across 33 versions & 1 rubygems

Version Path
secure_headers-7.0.0 spec/lib/secure_headers/headers/x_frame_options_spec.rb
secure_headers-6.7.0 spec/lib/secure_headers/headers/x_frame_options_spec.rb
secure_headers-6.6.0 spec/lib/secure_headers/headers/x_frame_options_spec.rb
secure_headers-6.5.0 spec/lib/secure_headers/headers/x_frame_options_spec.rb
secure_headers-6.4.0 spec/lib/secure_headers/headers/x_frame_options_spec.rb
secure_headers-6.3.4 spec/lib/secure_headers/headers/x_frame_options_spec.rb
secure_headers-6.3.3 spec/lib/secure_headers/headers/x_frame_options_spec.rb
secure_headers-6.3.2 spec/lib/secure_headers/headers/x_frame_options_spec.rb
secure_headers-6.3.1 spec/lib/secure_headers/headers/x_frame_options_spec.rb
secure_headers-5.2.0 spec/lib/secure_headers/headers/x_frame_options_spec.rb
secure_headers-6.3.0 spec/lib/secure_headers/headers/x_frame_options_spec.rb
secure_headers-5.1.0 spec/lib/secure_headers/headers/x_frame_options_spec.rb
secure_headers-6.2.0 spec/lib/secure_headers/headers/x_frame_options_spec.rb
secure_headers-6.1.2 spec/lib/secure_headers/headers/x_frame_options_spec.rb
secure_headers-6.1.1 spec/lib/secure_headers/headers/x_frame_options_spec.rb
secure_headers-6.1.0 spec/lib/secure_headers/headers/x_frame_options_spec.rb
secure_headers-6.0.0 spec/lib/secure_headers/headers/x_frame_options_spec.rb
secure_headers-6.0.0.alpha03 spec/lib/secure_headers/headers/x_frame_options_spec.rb
secure_headers-6.0.0.alpha02 spec/lib/secure_headers/headers/x_frame_options_spec.rb
secure_headers-6.0.0.alpha01 spec/lib/secure_headers/headers/x_frame_options_spec.rb