Git Product home page Git Product logo

database_cleaner-sequel's Introduction

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, connection: :default]
DatabaseCleaner[:sequel, connection: Sequel.connect(uri)]

COPYRIGHT

See LICENSE for details.

database_cleaner-sequel's People

Contributors

bmabey avatar etagwerker avatar botandrose-machine avatar jonrowe avatar vrinek avatar snusnu avatar sanemat avatar skalee avatar svenfuchs avatar stanislaw avatar betelgeuse avatar dpisarewski avatar ethco avatar tommeier avatar netskin-ci avatar nyarly avatar botandrose avatar cyberdelia avatar buehmann avatar andreale avatar sirkosi avatar rhunter avatar johnf avatar jnv avatar japgolly avatar anicholson avatar barthez avatar kamui avatar kamal avatar st0012 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.