Sha256: 46de57a3881d93f4597ac896697635fc4c2f0c54aeae0b11673a96b93874deab

Contents?: true

Size: 1.26 KB

Versions: 80

Compression:

Stored size: 1.26 KB

Contents

require File.expand_path('../spec_helper.rb', __FILE__)

describe Rack::Protection::FrameOptions do
  it_behaves_like "any rack application"

  it 'should set the X-Frame-Options' do
    get('/', {}, 'wants' => 'text/html').headers["X-Frame-Options"].should == "SAMEORIGIN"
  end

  it 'should not set the X-Frame-Options for other content types' do
    get('/', {}, 'wants' => 'text/foo').headers["X-Frame-Options"].should be_nil
  end

  it 'should allow changing the protection mode' do
    # I have no clue what other modes are available
    mock_app do
      use Rack::Protection::FrameOptions, :frame_options => :deny
      run DummyApp
    end

    get('/', {}, 'wants' => 'text/html').headers["X-Frame-Options"].should == "DENY"
  end


  it 'should allow changing the protection mode to a string' do
    # I have no clue what other modes are available
    mock_app do
      use Rack::Protection::FrameOptions, :frame_options => "ALLOW-FROM foo"
      run DummyApp
    end

    get('/', {}, 'wants' => 'text/html').headers["X-Frame-Options"].should == "ALLOW-FROM foo"
  end

  it 'should not override the header if already set' do
    mock_app with_headers("X-Frame-Options" => "allow")
    get('/', {}, 'wants' => 'text/html').headers["X-Frame-Options"].should == "allow"
  end
end

Version data entries

80 entries across 75 versions & 20 rubygems

Version Path
logstash-output-scalyr-0.2.1.beta vendor/bundle/jruby/2.5.0/gems/rack-protection-1.5.5/spec/frame_options_spec.rb
logstash-output-scalyr-0.2.0 vendor/bundle/jruby/2.5.0/gems/rack-protection-1.5.5/spec/frame_options_spec.rb
logstash-output-scalyr-0.2.0.beta vendor/bundle/jruby/2.5.0/gems/rack-protection-1.5.5/spec/frame_options_spec.rb
logstash-output-scalyr-0.1.26.beta vendor/bundle/jruby/2.5.0/gems/rack-protection-1.5.5/spec/frame_options_spec.rb
logstash-output-scalyr-0.1.25.beta vendor/bundle/jruby/2.5.0/gems/rack-protection-1.5.5/spec/frame_options_spec.rb
logstash-output-scalyr-0.1.24.beta vendor/bundle/jruby/2.5.0/gems/rack-protection-1.5.5/spec/frame_options_spec.rb
logstash-output-scalyr-0.1.23.beta vendor/bundle/jruby/2.5.0/gems/rack-protection-1.5.5/spec/frame_options_spec.rb
logstash-output-scalyr-0.1.22.beta vendor/bundle/jruby/2.5.0/gems/rack-protection-1.5.5/spec/frame_options_spec.rb
logstash-output-scalyr-0.1.21.beta vendor/bundle/jruby/2.5.0/gems/rack-protection-1.5.5/spec/frame_options_spec.rb
logstash-output-scalyr-0.1.20.beta vendor/bundle/jruby/2.5.0/gems/rack-protection-1.5.5/spec/frame_options_spec.rb
logstash-output-scalyr-0.1.19.beta vendor/bundle/jruby/2.5.0/gems/rack-protection-1.5.5/spec/frame_options_spec.rb
logstash-output-scalyr-0.1.18.beta vendor/bundle/jruby/2.5.0/gems/rack-protection-1.5.5/spec/frame_options_spec.rb
logstash-output-scalyr-0.1.17.beta vendor/bundle/jruby/2.5.0/gems/rack-protection-1.5.5/spec/frame_options_spec.rb
logstash-output-scalyr-0.1.16.beta vendor/bundle/jruby/2.5.0/gems/rack-protection-1.5.5/spec/frame_options_spec.rb
logstash-output-scalyr-0.1.15.beta vendor/bundle/jruby/2.5.0/gems/rack-protection-1.5.5/spec/frame_options_spec.rb
logstash-output-scalyr-0.1.14.beta vendor/bundle/jruby/2.5.0/gems/rack-protection-1.5.5/spec/frame_options_spec.rb
logstash-output-scalyr-0.1.13 vendor/bundle/jruby/2.5.0/gems/rack-protection-1.5.5/spec/frame_options_spec.rb
logstash-output-scalyr-0.1.12 vendor/bundle/jruby/2.5.0/gems/rack-protection-1.5.5/spec/frame_options_spec.rb
logstash-output-scalyr-0.1.11.beta vendor/bundle/jruby/2.5.0/gems/rack-protection-1.5.5/spec/frame_options_spec.rb
logstash-output-scalyr-0.1.10.beta vendor/bundle/jruby/2.5.0/gems/rack-protection-1.5.5/spec/frame_options_spec.rb