unit testing - Run Rails Tests without Dropping Test Database -
just wondering if there's way run rails tests without dropping database. i'm executing unit tests , using following rake command so: rake test:units
.
thanks in advance!
just in case relevant:
- rails 3
- ruby 1.8.7 (mri)
- oracle 11g database
- activerecord-oracle_enhanced-adapter
after doing research, have found there isn't way this. test rake tasks drop database, when providing test=
option bohdan suggests.
by using --trace
option, can proven. here output:
$ rake test:units test=test/unit/post_test.rb --trace (in /users/johnnyicon/development/ror/test-app) ** invoke test:units (first_time) ** invoke test:prepare (first_time) ** invoke db:test:prepare (first_time) ** invoke db:abort_if_pending_migrations (first_time) ** invoke environment (first_time) ** execute environment ** execute db:abort_if_pending_migrations ** execute db:test:prepare ** invoke db:test:load (first_time) ** invoke db:test:purge (first_time) ** invoke environment ** execute db:test:purge ** execute db:test:load ** invoke db:schema:load (first_time) ** invoke environment ** execute db:schema:load ** execute test:prepare ** execute test:units
reading through ruby on rails guides testing, describes of these rake tasks mean. 1 pay particular attention db:test:load
task, see on 7th line bottom of output ** execute db:test:load
. guides following task:
recreate test database current schema.rb
so if execute unit tests 1 one bohdan suggests, rake task still recreate database. not answer hoping for, isn't problem anymore.
the reason asking begin because did not have access database use testing, using development database testing well. since then, i've been able database dedicated testing.
thanks anyway bohdan! appreciate help!
Comments
Post a Comment