rails: can't use fixtures with a created engine

hi all, i have trouble testing an engine

rails plugin new something --full

i create an engine, and some models, then i started to test, on ‘rake test’ command i realized that the fixtures are not loaded, so as the helper methods to load fixtures like:

people(:one)

it is a bug or maybe i understand this wrong and I’m using it the wrong way?

About this issue

  • Original URL
  • State: closed
  • Created 12 years ago
  • Comments: 29 (11 by maintainers)

Commits related to this issue

Most upvoted comments

This issue continues to exist in 4.2.6, even tried downgrading to 4.2.4.

I have the same problem in 4.0.0 only with models, and fixed it editing test_helper.rb as:

# Configure Rails Environment
ENV["RAILS_ENV"] = "test"

require File.expand_path("../dummy/config/environment.rb",  __FILE__)
require "rails/test_help"

Rails.backtrace_cleaner.remove_silencers!

# Load support files
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }

# Load fixtures from the engine
if ActiveSupport::TestCase.method_defined?(:fixture_path=)
  ActiveSupport::TestCase.fixture_path = File.expand_path("../fixtures", __FILE__)
end

ActiveSupport::TestCase.fixture_path = File.expand_path("../fixtures", __FILE__)

class ActiveSupport::TestCase
    fixtures :all 
end

It seems that if ActiveSupport::TestCase.method_defined?(:fixture_path=) returns false always