I’m new to this list as well as to engines in general. I am taking my
stab at writing an engine and am having a little trouble getting the
for my engine working. Everything else is working at this point, e.g.
controllers, models, migrations, etc. The last step is to get testing
Can I get a general overview on how tests are supposed to work? I’m
Rails 1.2.1 and the release branch of Engines 1.2.
Basically, at this point, I copied the tests from the surrounding
application in to my engine’s test folder, so my dir structure looks
Problems I’m having:
1). Fixtures don’t seem to be loading. I read in the docs that I need
call Engines::Testing.set_fixture_path first, but a) I couldn’t get it
recognize Engines, and b) it looks like the rake plugins:units task does
this for meâ€”I think.
2). I had a file in my engine’s lib folder that I need to include. I
couldn’t get it to include normally. I ended up getting it to work
require File.dirname(FILE) + ‘/…/lib/authenticated_test_helper’
where I used to be able to call include AuthenticatedTestHelper by
Are files in lib not automatically loaded?
3). In my original test_helper.rb there is the TestCase section, where
set certain options like self.use_transactional_fixtures, I was unable
get this to work. So, right now, I’ve commented them out.
4). What requires should be where? In the original files, there’s
ENV[“RAILS_ENV”] = “test”
require File.expand_path(File.dirname(FILE) +
in test_helper.rb - Do these still need to be in my engine’s
I think that’s about it. Through various tracking down errors, I’ve
to get the tests to run, but am still getting errors whenever my test
up a fixture with something like users(:trey). Because I’ve done so
random tweaking, I thought I’d ask what the preferred way is.