Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

racktest_cookie_disabler

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

racktest_cookie_disabler

  • 0.0.2
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

RackTestCookieDisabler

When you are testing a web app it is sometiimes necessary to be able to disable cookies to emulate what happens when someone whose cookies are disabled uses your app. This gem allows you to disable cookies when using capybara to test your web app. It only works for RackTest or RackTest-based drivers such as Mechanize.

Installation

Add this line to your application's Gemfile:

gem 'racktest_cookie_disabler'

And then execute:

$ bundle

Or install it yourself as:

$ gem install racktest_cookie_disabler

Usage

Add RackTestCookieDisabler middleware to rails middleware stack. Add the following inconfig/environments/test.rb:

    [MyRailsApp]::Application.configure do
      ...
      # Add cookie disabler middleware
      config.middleware.insert_after Rack::Lock, RackTestCookieDisabler::Middleware
      ...
    end

Note Ensure you include racktest_cookie_disabler middleware only for test environment otherwise you may have issues.

In your spec:

    scenario "with cookies disabled" do
      page.disable_cookies(true)
      page.visit '/'
      ...
    end

How does it work

When you call disable_cookies(true) it adds an extra header to your request. The middleware detects this header and removes the 'HTTP_COOKIE' from the request.

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

FAQs

Package last updated on 17 Mar 2013

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc