Hi Trey, On 1/27/07, Trey Bean <[EMAIL PROTECTED]> wrote: > 1). Fixtures don't seem to be loading. I read in the docs that I need to > call Engines::Testing.set_fixture_path first, but a) I couldn't get it to > recognize Engines, and b) it looks like the rake plugins:units task does > this for me—I think.
The provided rake tasks will call Engines::Testing.setup_plugin_fixtures, but you need to call Engines::Testing.set_fixture_path yourself in your tests to redirect Test::Unit to the new temporary fixture directory. However, more troubling is the fact that your code doesn't find the engines plugin. Are you running the tests with the supplied rake tasks, or manually (i.e. ruby /path/to/my/test.rb)? > 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 with: > > require File.dirname(__FILE__) + > '/../lib/authenticated_test_helper' > include AuthenticatedTestHelper > > where I used to be able to call include AuthenticatedTestHelper by itself. > Are files in lib not automatically loaded? I believe a change in the way that Rails works means that some classes aren't automagically loaded when they are referenced. Lib directories are certainly available in the load path (you can check this yourself by puts-ing $LOAD_PATH at the top of your tests), so a simple "require 'file'" should be sufficient. Again - this seems like it might be related to your not being able to reference the Engines module. > 3). In my original test_helper.rb there is the TestCase section, where you > set certain options like self.use_transactional_fixtures, I was unable to > 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__) + "/../config/environment") > require 'test_help' > > in test_helper.rb - Do these still need to be in my engine's test_helper.rb? If your tests require the Rails environment to be loaded, yes. Actually, this might relate to a possible source of problems - you won't be able to work with any of the engines functionality until you load the rails environment (and so all the plugins) - are you trying to reference anything within any plugins before these lines? Does any of the above help? -- * J * ~ _______________________________________________ engine-users mailing list [email protected] http://lists.rails-engines.org/listinfo.cgi/engine-users-rails-engines.org
