Can't get Test::Rails to work


I'm very happy with TDD and use it whereever possible. I came across Rails::Test and hoped to make even better tests easier. My problem is I haven't been able to run my tests ever since I made those 3 small changes to test_helper.rb :frowning:

At first, I simply tried running rake test:functionals but it just gives me errors like: /Users/gitte/Projects/rtime/config/../app/controllers/billing_controller.rb:3: undefined method `layout' for BillingController:Class (NoMethodError)

It's obvious to me what the error is - it's not obvious why. Have I missed something?

My test_helper.rb looks like this: ENV["RAILS_ENV"] = "test" require File.expand_path(File.dirname(__FILE__) + "/../config/environment") require 'test/rails' require 'test_help'

class Test::Rails::TestCase    self.use_transactional_fixtures = false    self.use_instantiated_fixtures = false

   # Add more helper methods to be used by all tests here... end


Gitte Wange

Hi, I highly recommend using the following for testing your rails application(s):

unit (test models) functional (test controller and model) integration (test across controllers and models)

Stub files are automatically generated for both controllers and models. Then you can easily use rake tasks to execute your tests. For example,

rake test → executes unit, functional, and integration

rake test:units → execute unit tests

rake test:functionals → execute functional tests

rake test:integration → execute integration tests

Good luck,


I've very familiar witht the stock testing framework in rails - I use it all the time for TDD :slight_smile: I came across Test::Rails and wanted to try it out. It has some assertions for ajax stuff and a lot of other nifty things that I would like to benefit from. So I just wanted to know if anyone else had the same kind of problems with the module as I have :slight_smile:

Greetings, Gitte Wange