Clean your Nobrainer databases with Database Cleaner.
See https://github.com/DatabaseCleaner/database_cleaner for more information.
# Gemfile
group :test do
gem 'database_cleaner-nobrainer'
end
The nobrainer adapter only has one strategy: the deletion strategy.
:only
and :except
may take a list of collection names:
# Only delete the "users" collection.
DatabaseCleaner[:nobrainer].strategy = :deletion, { only: ["users"] }
# Delete all collections except the "users" collection.
DatabaseCleaner[:nobrainer].strategy = :deletion, { except: ["users"] }
#db
defaults to the Nobrainer database, but can be specified manually in a few ways:
# Redis URI string:
DatabaseCleaner[:nobrainer].db = :logs
# Back to default:
DatabaseCleaner[:nobrainer].db = NoBrainer.current_db
# Multiple Nobrainer databases can be specified:
DatabaseCleaner[:nobrainer, connection: :default]
DatabaseCleaner[:nobrainer, connection: :shard_1]
DatabaseCleaner[:nobrainer, connection: :shard_2]
The Earthfile
is to be used with Earthly.
To build the development Docker image, simply run earth +dev
.
To run the tests, run earth -P +rspec
To publish a new version of the gem, run earthly +publish --RUBYGEMS_OTP=<OTP> --RUBYGEMS_ORG_API_KEY=$(cat ~/.gem/credentials | grep :rubygems_api_key | awk '{print $2}')
Please look at the Earthly documentation for more.
See LICENSE for details.