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

database_cleaner-sequel

Package Overview
Dependencies
Maintainers
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

database_cleaner-sequel

  • 2.0.2
  • Rubygems
  • Socket score

Version published
Maintainers
2
Created
Source

Database Cleaner Adapter for Sequel

Build Status Code Climate codecov

Clean your Sequel databases with Database Cleaner.

See https://github.com/DatabaseCleaner/database_cleaner for more information.

Installation

# Gemfile
group :test do
  gem 'database_cleaner-sequel'
end
# test_helper.rb
DatabaseCleaner[:sequel].strategy = :transaction

class Minitest::Spec
  before :each do
    DatabaseCleaner[:sequel].start
  end

  after :each do
    DatabaseCleaner[:sequel].clean
  end
end

Supported Strategies

Three strategies are supported:

  • Transaction (default)
  • Truncation
  • Deletion

Strategy configuration options

The transaction strategy accepts no options.

The truncation and deletion strategies may accept the following options:

  • :only and :except may take a list of table names:
# Only truncate the "users" table.
DatabaseCleaner[:sequel].strategy = :truncation, only: ["users"]

# Delete all tables except the "users" table.
DatabaseCleaner[:sequel].strategy = :deletion, except: ["users"]
  • :pre_count - When set to true, this will check each table for existing rows before truncating or deleting it. This can speed up test suites when many of the tables are never populated. Defaults to false.

Adapter configuration options

#db defaults to the default Sequel database, but can be specified manually in a few ways:

# Sequel connection object
DatabaseCleaner[:sequel].db = Sequel.connect(uri)

# Back to default:
DatabaseCleaner[:sequel].db = :default

# Multiple Sequel databases can be specified:
DatabaseCleaner[:sequel, db: :default]
DatabaseCleaner[:sequel, db: Sequel.connect(uri)]

See LICENSE for details.

FAQs

Package last updated on 08 Mar 2022

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