[rspec-users] autotest loosing RAILS_ROOT Constant?

Mikel Lindsaar raasdnil at gmail.com
Wed Jul 25 20:26:47 EDT 2007


I am having a weird error that I have not had before... I'm bouncing
it off the list to see if anyone else has had it, or to give me some
pointers about how to find it.

Basically, AUTOTEST will run (RSpec mode), fine, then suddenly, will
complain that RAILS_ROOT is undefined.

Then I stop and restart it, with no code change... no problem.

It happens on different specs where I use RAILS_ROOT like so:

@file = open("#{RAILS_ROOT}/spec/fixtures/files/test_file.txt", "r") {
|f| f.read}

All the specs that error are just like that.  They are nothing
special, read a file, send it to a method, get the result,
result.should == file

This is what it looks like in my console:

===================================

1)
NameError in 'ListToCsvConverter should ...1'
uninitialized constant RAILS_ROOT
./spec/lib/list_to_csv_converter_spec.rb:18:
script/spec:4:

2)
NameError in 'ListToCsvConverter should ...2'
uninitialized constant RAILS_ROOT
./spec/lib/list_to_csv_converter_spec.rb:11:
script/spec:4:

Finished in 0.008741 seconds

2 examples, 2 failures
^Cmenu
c: continue
q: quit
r: restart
menu> r
/usr/local/bin/ruby -S script/spec -O spec/spec.opts  <SNIP>spec.rb
........................................................................................


Finished in 0.533593 seconds

88 examples, 0 failures

===================================


As I said... weird.

Anyone else run into this?

Regards

Mikel


More information about the rspec-users mailing list