Forum: Ruby on Rails Rails without a db - how to run tests

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.
Pat M. (Guest)
on 2005-12-21 22:46
(Received via mailing list)
I'm writing a simple app that doesn't need to use a database.  I added
:active_record to the config.frameworks -= line in environment.rb
file.  This lets me run ./script/generate fine without complaining
about no connection.  However if I try to run a functional test, it
complains about no connection being established.  Well...I don't want
a connection to be established.  I've tried overriding
Fixtures#teardown to be blank, but that doesn't do anything.  The
actual error is:
  1) Error:

I put this in my test_helper.rb file:
class Fixtures
  def teardown() end

No luck though.  I'd like to be able to run unit tests on my models
and functional tests on my controllers.  I don't see why it needs a
database to do that.  Can anyone offer me any pointers?

Obie F. (Guest)
on 2005-12-22 17:36
(Received via mailing list)
Perhaps not exactly the answer you're looking for, but what I did in a
similar case (my Rails app was hitting web services for data) is to
use sqlite memory db for testing. Keep in mind you need to have sqlite

  adapter: sqlite3
  database: ":memory:"

Hope it helps,
Pat M. (Guest)
on 2006-01-24 12:57
(Received via mailing list)
Well I got something figure out finally...haven't been working on it
this whole time, but I decided to give it another go tonight.  You can
check it out on my blog:

If anyone can tell me how to make resources show up in the browser
instead of prompt a download dialog, I'd really appreciate it :)  I've
tried setting the content type to text/plain, but no luck apparently.

Anyway, hope someone finds this useful.

Pat M. (Guest)
on 2006-01-24 12:57
(Received via mailing list)
Hey Obie,

I spent some more time on this tonight and think I may have found a
solution.  Thought you might be interested:

Curt H. (Guest)
on 2006-01-24 17:54
(Received via mailing list)
What did you use to format the Ruby source code you posted with color

Pat M. (Guest)
on 2006-01-24 22:56
(Received via mailing list)
<typo:code lang="ruby">
cool ruby code here
Curt H. (Guest)
on 2006-01-24 23:59
(Received via mailing list)
Cool... you're running a newer version of typo than I am. I gotta get
myself upgraded!

This topic is locked and can not be replied to.