Sha256: be93678f435962cd2db46d179cd6435f8bce4c84bea4c1b4a7f67063827d2f8a

Contents?: true

Size: 1.08 KB

Versions: 29

Compression:

Stored size: 1.08 KB

Contents

require 'spec_helper'

module SecureHeaders
  describe XFrameOptions do
    specify{ expect(XFrameOptions.new.name).to eq("X-Frame-Options") }

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

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

        it "allows DENY" do
          expect {
            XFrameOptions.new("DENY").value
          }.not_to raise_error        end

        it "allows ALLOW-FROM*" do
          expect {
            XFrameOptions.new("ALLOW-FROM: example.com").value
          }.not_to raise_error
        end
        it "does not allow garbage" do
          expect {
            XFrameOptions.new("I like turtles").value
          }.to raise_error(XFOBuildError)
        end
      end
    end
  end
end

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
secure_headers-2.5.3 spec/lib/secure_headers/headers/x_frame_options_spec.rb
secure_headers-2.5.2 spec/lib/secure_headers/headers/x_frame_options_spec.rb
secure_headers-2.5.1 spec/lib/secure_headers/headers/x_frame_options_spec.rb
secure_headers-2.5.0 spec/lib/secure_headers/headers/x_frame_options_spec.rb
secure_headers-2.4.4 spec/lib/secure_headers/headers/x_frame_options_spec.rb
secure_headers-2.4.3 spec/lib/secure_headers/headers/x_frame_options_spec.rb
secure_headers-2.4.2 spec/lib/secure_headers/headers/x_frame_options_spec.rb
secure_headers-2.4.1 spec/lib/secure_headers/headers/x_frame_options_spec.rb
secure_headers-2.4.0 spec/lib/secure_headers/headers/x_frame_options_spec.rb
secure_headers-2.3.0 spec/lib/secure_headers/headers/x_frame_options_spec.rb
secure_headers-2.2.4 spec/lib/secure_headers/headers/x_frame_options_spec.rb
secure_headers-2.2.3 spec/lib/secure_headers/headers/x_frame_options_spec.rb
secure_headers-2.2.2 spec/lib/secure_headers/headers/x_frame_options_spec.rb
secure_headers-2.2.1 spec/lib/secure_headers/headers/x_frame_options_spec.rb
secure_headers-2.2.0 spec/lib/secure_headers/headers/x_frame_options_spec.rb
secure_headers-2.1.0 spec/lib/secure_headers/headers/x_frame_options_spec.rb
secure_headers-2.0.2 spec/lib/secure_headers/headers/x_frame_options_spec.rb
secure_headers-2.0.1 spec/lib/secure_headers/headers/x_frame_options_spec.rb
secure_headers-2.0.0 spec/lib/secure_headers/headers/x_frame_options_spec.rb
secure_headers-1.4.1 spec/lib/secure_headers/headers/x_frame_options_spec.rb