Forum: RSpec What makes specs run against the test database?

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Wes G. (Guest)
on 2008-10-09 03:50
I just did a test where I ran one spec and deep deep within the code
under test, I printed out the DB connection of the AR class of a given
object, like so:

puts invoice.class.connection.inspect

My spec requires spec_helper.rb, which supposedly sets the Rails
environment to be "test".

However, the output of that inspect looks like this:

223509519, @logger=#<ActiveSupport::BufferedLogger:0x3590008 @buffer=[],
ck=false, @level=0, @auto_flushing=1,
@log=#<File:X:/log/development.log>>, @run
time=0.0, @quoted_table_names={"draft_invoices"=>"`draft_invoices`"},
n=#<Mysql>, @quoted_column_names={"draft_invoices"=>"`draft_invoices`"},
cache_enabled=false, @config={:password=>"blah", :username=>"root",
er=>"mysql", :database=>"my_db_development", :encoding=>"utf8",
ost", :allow_concurrency=>false}, @connection_options=["machost",
"root", "r3n&s
t1mpy", "aafes_vss_development", nil, nil]>


@config={:password=>"blah", :username=>"root", :adapt
er=>"mysql", :database=>"my_db_development", :encoding=>"utf8",
ost", :allow_concurrency=>false}

which shows that I am hitting my development database.  Why would I see
this output when running a spec that AFAIK, should be running against
the test DB?

Nick H. (Guest)
on 2008-10-09 03:54
(Received via mailing list)
On 2008-10-08, at 19:50, Wes G. wrote:
> Thanks,
> wes

This sounds like a dumb question, but in database.yml , have you
confirmed that your test DB is configured for use in the test

Wes G. (Guest)
on 2008-10-09 04:14
(Received via mailing list)
This topic is locked and can not be replied to.