CARVIEW |
Select Language
HTTP/2 302
server: nginx
date: Thu, 04 Sep 2025 06:23:40 GMT
content-type: text/plain; charset=utf-8
content-length: 0
x-archive-redirect-reason: found capture at 20091120051955
location: https://web.archive.org/web/20091120051955/https://github.com/technicalpickles/nulldb
server-timing: captures_list;dur=1.209484, exclusion.robots;dur=0.040876, exclusion.robots.policy;dur=0.020778, esindex;dur=0.015713, cdx.remote;dur=23.264309, LoadShardBlock;dur=557.086829, PetaboxLoader3.datanode;dur=414.879899
x-app-server: wwwb-app212
x-ts: 302
x-tr: 656
server-timing: TR;dur=0,Tw;dur=0,Tc;dur=0
set-cookie: wb-p-SERVER=wwwb-app212; path=/
x-location: All
x-rl: 0
x-na: 0
x-page-cache: MISS
server-timing: MISS
x-nid: DigitalOcean
referrer-policy: no-referrer-when-downgrade
permissions-policy: interest-cohort=()
HTTP/2 200
server: nginx
date: Thu, 04 Sep 2025 06:23:41 GMT
content-type: text/html; charset=utf-8
x-archive-orig-server: nginx/0.7.61
x-archive-orig-date: Fri, 20 Nov 2009 05:19:54 GMT
x-archive-orig-connection: close
x-archive-orig-status: 200 OK
x-archive-orig-etag: "15b4847318afb612f0b81da238231d31"
x-archive-orig-x-runtime: 499ms
x-archive-orig-content-length: 28247
x-archive-orig-cache-control: private, max-age=0, must-revalidate
x-archive-guessed-content-type: text/html
x-archive-guessed-charset: utf-8
memento-datetime: Fri, 20 Nov 2009 05:19:55 GMT
link: ; rel="original", ; rel="timemap"; type="application/link-format", ; rel="timegate", ; rel="first memento"; datetime="Fri, 20 Nov 2009 05:19:55 GMT", ; rel="memento"; datetime="Fri, 20 Nov 2009 05:19:55 GMT", ; rel="next memento"; datetime="Mon, 11 Jun 2018 01:46:55 GMT", ; rel="last memento"; datetime="Sat, 07 Nov 2020 03:41:42 GMT"
content-security-policy: default-src 'self' 'unsafe-eval' 'unsafe-inline' data: blob: archive.org web.archive.org web-static.archive.org wayback-api.archive.org athena.archive.org analytics.archive.org pragma.archivelab.org wwwb-events.archive.org
x-archive-src: 52_12_20091120025018_crawl101-c/52_12_20091120051820_crawl101.arc.gz
server-timing: captures_list;dur=0.970339, exclusion.robots;dur=0.032660, exclusion.robots.policy;dur=0.015177, esindex;dur=0.017850, cdx.remote;dur=115.405040, LoadShardBlock;dur=225.301582, PetaboxLoader3.datanode;dur=286.880482, load_resource;dur=208.193947, PetaboxLoader3.resolve;dur=58.101438
x-app-server: wwwb-app212
x-ts: 200
x-tr: 649
server-timing: TR;dur=0,Tw;dur=0,Tc;dur=0
x-location: All
x-rl: 0
x-na: 0
x-page-cache: MISS
server-timing: MISS
x-nid: DigitalOcean
referrer-policy: no-referrer-when-downgrade
permissions-policy: interest-cohort=()
content-encoding: gzip
technicalpickles's nulldb at master - GitHub
This repository is private.
All pages are served over SSL and all pushing and pulling is done over SSH.
No one may fork, clone, or view it unless they are added as a member.
Every repository with this icon (
) is private.
Every repository with this icon (

This repository is public.
Anyone may fork, clone, or view it.
Every repository with this icon (
) is public.
Every repository with this icon (

Fork of avdi/nulldb | |
Description: | An ActiveRecord null database adapter for greater speed and isolation in unit tests. edit |
Homepage: | https://nulldb.rubyforge.org edit |
Public Clone URL: |
git://github.com/technicalpickles/nulldb.git
Give this clone URL to anyone.
git clone git://github.com/technicalpickles/nulldb.git
|
Your Clone URL: |
Use this clone URL yourself.
git clone git@github.com:technicalpickles/nulldb.git
|
nulldb /
name | age | message | |
---|---|---|---|
![]() |
LICENSE | Sun Feb 17 14:20:55 -0800 2008 | initial commit [Avdi Grimm] |
![]() |
README | Loading commit data... ![]() |
|
![]() |
Rakefile | ||
![]() |
init.rb | Thu Feb 21 15:15:14 -0800 2008 | * More RSpec integration * More documentation [Avdi Grimm] |
![]() |
lib/ | ||
![]() |
spec/ | Thu Mar 20 17:38:30 -0700 2008 | Added null object execution result [Avdi Grimm] |
![]() |
tasks/ | Sun Feb 17 21:34:16 -0800 2008 | * Actually works in a real world project. * U... [Avdi Grimm] |
README
= The NullDB Connection Adapter Plugin == What NullDB is the Null Object pattern as applied to ActiveRecord database adapters. It is a database backend that translates database interactions into no-ops. Using NullDB enables you to test your model business logic - including +after_save+ hooks - without ever touching a real database. == How Once installed, NullDB can be used much like any other ActiveRecord database adapter: ActiveRecord::Base.establish_connection :adapter => :nulldb NullDB needs to know where you keep your schema file in order to reflect table metadata. By default it looks in RAILS_ROOT/db/schema.rb. You can override that by setting the +schema+ option: ActiveRecord::Base.establish_connection :adapter => :nulldb, :schema => foo/myschema.rb NullDB comes with RSpec integration. To replace the database with NullDB in all of your specs, put the following in your spec/spec_helper: require 'nulldb_rspec' include NullDB::RSpec::NullifiedDatabase Or if you just want to use NullDB in a specific spec context, you can include the same module inside a context: require 'nulldb_rspec' describe Employee, "with access to the database" do fixtures :employees # ... end describe Employee, "with NullDB" do include NullDB::RSpec::NullifiedDatabase # ... end NullDB::Rspec provides some custom matcher support for verifying expectations about interactions with the database: describe Employee do include NullDB::RSpec::NullifiedDatabase it "should cause an insert statement to be executed" do Employee.create! Employee.connection.should have_executed(:insert) end end UnitRecord-style verification that no database calls have been made at all can be achieved by using the special +:anything+ symbol: describe "stuff that shouldn't touch the database" do after :each do Employee.connection.should_not have_executed(:anything) end # ... end You can also experiment with putting NullDB in your database.yml: unit_test: adapter: nulldb However, due to the way Rails hard-codes specific database adapters into its standard Rake tasks, you may find that this generates unexpected and difficult-to-debug behavior. Workarounds for this are under development. == Why There are a number of advantages to writing unit tests that never touch the database. The biggest is probably speed of execution - unit tests must be fast for test-driven development to be practical. Another is separation of concerns: unit tests should be exercising only the business logic contained in your models, not ActiveRecord. For more on why testing-sans-database is a god idea, see: https://www.dcmanges.com/blog/rails-unit-record-test-without-the-database. NullDB is one way to separate your unit tests from the database. It was inspired by the ARBS[https://arbs.rubyforge.org/] and UnitRecord[https://unit-test-ar.rubyforge.org/] libraries. It differs from them in a couple of ways: 1. It works. At the time of writing both ARBS and UnitRecord were not working for me out of the box with Rails 2.0. 2. It avoids monkey-patching as much as possible. Rather than re-wiring the secret inner workings of ActiveRecord (and thus being tightly coupled to those inner workings), NullDB implements the same [semi-]well-documented public interface that the other standard database adapters, like MySQL and SQLServer, implement. 3. UnitRecord takes the approach of eliminating database interaction in tests by turning almost every database interaction into an exception. NullDB recognizes that ActiveRecord objects typically can't take two steps without consulting the database, so instead it turns database interactions into no-ops. One concrete advantage of this null-object pattern design is that it is possible with NullDB to test +after_save+ hooks. With NullDB, you can call +#save+ and all of the usual callbacks will be called - but nothing will be saved. == Limitations * It is *not* an in-memory database. Finds will not work. Neither will +reload+, currently. Test fixtures won't work either, for obvious reasons. * It has only the most rudimentery schema/migration support. Complex migrations will probably break it. * Lots of other things probably don't work. Patches welcome! == Who NullDB was written by Avdi Grimm <mailto:avdi@avdi.org> == Where * Homepage: https://avdi.org/projects/nulldb/ * Public SVN: https://svn.avdi.org/nulldb/ == Changes * Version 0.0.1 (2007-02-18) - Initial Release == License See the LICENSE file for licensing information.
This feature is coming soon. Sit tight!