I am trying to reuse some code from a Rails 1.2.6 app in edge rails.
In the old app, I can run all my tests with ‘rake’ or I can run
individual tests using ‘ruby test/functionals/foo_controller_test.rb’.
But in my edge rails app, I have to use ‘rake’. If I try to run
individual tests, I get the error below. How can include my factory
module in a way that lets me run tests via rake AND individually with
‘ruby $filename’?
/usr/bin/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
gem_original_require': no such file to load -- factory (MissingSourceFile) from /usr/bin/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
require’
from
/rails/cms/vendor/rails/activerecord/lib/…/…/activesupport/lib/active_support/dependencies.rb:495:in
require' from /rails/cms/vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:342:in
new_constants_in’
from
/rails/cms/vendor/rails/activerecord/lib/…/…/activesupport/lib/active_support/dependencies.rb:495:in
`require’
from ./test/unit/…/test_helper.rb:5
from test/unit/user_test.rb:1
The desired Factory module is in test/factory.rb - right next to
test_helper.rb. The offending includes are:
From test/unit/user_test.rb
require File.dirname(FILE) + ‘/…/test_helper’
class UserTest < Test::Unit::TestCase
From tests/test_helper.rb
ENV[“RAILS_ENV”] = “test”
require File.expand_path(File.dirname(FILE) +
“/…/config/environment”)
require ‘test_help’
require ‘factory’
class Test::Unit::TestCase
And test/factory.rb starts
module Factory …
–
Cynthia