New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

testy_cookie

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

testy_cookie

  • 1.1.0
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

TestyCookie

TestyCookie gem provides a helper for accessing plain, permanent, signed, and encrypted cookies in Rails controller, integration, and request tests.

Why do I need a custom helper?

In Rails, ActionDispatch::IntegrationTest based tests and RSpec request specs do not provide encrypted, permanent and signed stores when the default cookies helper is used (it returns Rack::Test::CookieJar instance). TestyCookie resolves this limitation by initializing a proper ActionDispatch::Cookies::CookieJar instance which support these stores. The included helper also propagates any changes back to the original Rack::Test::CookieJar instance making them correctly read in application controllers.

In ActionController::TestCase tests and RSpec controller specs, cookie_jar serves as an alias for the default cookies method which returns ActionDispatch::Cookies::CookieJar instance correctly.

Usage

Inside your controller / integration / request test, call cookie_jar helper to access cookies:

cookie_jar.encrypted[:key]
cookie_jar.signed[:key] = value
cookie_jar.signed.encrypted.permanent[:key] = value

Installation

Add this line to your application's Gemfile:

gem "testy_cookie"

And then execute:

$ bundle

License

The gem is available as open source under the terms of the MIT License.

FAQs

Package last updated on 05 Mar 2024

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