[Radiant] Extension Testing troubles

Andrew Neil andrew.jr.neil at googlemail.com
Fri Nov 9 05:59:27 CST 2007


Thanks Giovanni,
When writing tests for an extension i discovered that the tests load
radiant default fixtures by default. You have to change test helper so
you include your extension's fixtures path.

I think it does this already. This is the relevant line:

   # Add the fixture directory to the fixture path
   self.fixture_path << File.dirname(__FILE__) + "/fixtures"

I notice that it appends the extension fixture path to  
self.fixture_path. Could this mean that Radiant fixtures are still in  
place, and being used instead of mine? Should I replace the '<<'  
operator with '='?

The test_helper.rb file was generated automatically. Here is the  
whole thing:

require 'test/unit'
# # Load the environment
unless defined? RADIANT_ROOT
   ENV["RAILS_ENV"] = "test"
   require "#{File.expand_path(File.dirname(__FILE__) +  
"/../../../../")}/config/environment"
end
require "#{RADIANT_ROOT}/test/test_helper"

class Test::Unit::TestCase

   # Include a helper to make testing Radius tags easier
   test_helper :extension_tags

   # Add the fixture directory to the fixture path
   self.fixture_path << File.dirname(__FILE__) + "/fixtures"

   # Add more helper methods to be used by all extension tests here...

end


p.s. Sorry if this appears twice. The first was overlarge, so I've  
pruned it.


More information about the Radiant mailing list