# Vanilla Rails 2.1 and Unit Test Error

**URL:** <https://www.ruby-forum.com/t/vanilla-rails-2-1-and-unit-test-error/139450>\
**Category:** Rails\
**Created:** [June 4, 2008, 12:53am UTC](https://www.ruby-forum.com/t/vanilla-rails-2-1-and-unit-test-error/139450 "2008-06-04T00:53:39Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Derek\_P](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/ba9def/32.png) [@Derek\_P](https://www.ruby-forum.com/u/Derek_P)\
**Post date:** [June 4, 2008, 12:53am UTC](https://www.ruby-forum.com/t/vanilla-rails-2-1-and-unit-test-error/139450/1 "2008-06-04T00:53:39Z")

</div>

I did a basic rails 2.1 command and made a basic model and ran the  
unit tests with rake, I get this error:

LoadError: no such file to load — test\_helper

I went back and compared my old unit tests from other projects to the  
one that was generated, this is what I found:

RAILS 2.1:  
require ‘test\_helper’

RAILS 2.0.2:  
require File.dirname( **FILE** ) + ‘/…/test\_helper’

Now, if I copy/paste my old rails 2.0.2 require statement, it works  
perfectly. Did this get overlooked?

---

<div class="post-metadata">

**Author:** ![Derek\_P](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/ba9def/32.png) [@Derek\_P](https://www.ruby-forum.com/u/Derek_P)\
**Post date:** [June 15, 2008, 7:49pm UTC](https://www.ruby-forum.com/t/vanilla-rails-2-1-and-unit-test-error/139450/2 "2008-06-15T19:49:03Z")

</div>

I’m learning from this book to currently and got snagged on the test  
chapter because of this same error -

> **[Pragmatic Bookshelf: By Developers, For Developers](https://pragprog.com)**
>
> We improve the lives of professional developers. We create timely, practical books on classic and cutting-edge topics to help you learn and practice your craft, and accelerate your career. Come learn with us.

It has me run a test directly like 'ruby test/unit/meeting\_test.rb . I  
just changed the require at the top from:

require ‘test\_helper’

to:

require ‘test/test\_helper’

I don’t know if this will help you when running from rake though, but  
it worked for me. Perhaps this is a mistake with 2.1.0. I’m don’t  
know. I’m a noob.
