Misha Moroshko
Misha Moroshko

Reputation: 171351

Rails 3: Error when running a simple test using RailsGuides instructions

I try to run a simple test following RailsGuides instructions. I have a default structure of the test folder. Here is the relevant part:

test
  unit
    job_test.rb
  test_helper.rb

When I run:

ruby unit/job_test.rb

from the test directory, I get:

<internal:lib/rubygems/custom_require>:29:in `require': 
    no such file to load -- test_helper (LoadError)
from <internal:lib/rubygems/custom_require>:29:in `require'
from unit/job_test.rb:1:in `<main>'

Here is my job_test.rb:

require 'test_helper'
class JobTest < ActiveSupport::TestCase
  test "My First Test" do
    assert false
  end
end

Is this a known Rails 3 issue ?

Any workarounds ?

Upvotes: 2

Views: 528

Answers (1)

Ashish
Ashish

Reputation: 5791

Try to include test helper like this

require File.dirname(__FILE__) + '/../test_helper'

Upvotes: 3

Related Questions