Ruby on Rails で Test::Unit と Shoulda を使用して Factory Girl をセットアップしようとしています。gem をインストールし、test/factories ディレクトリに factory ファイルを作成し、test/models ディレクトリに spec ファイルを作成しました。現在発生しているエラーは「ArgumentError: No such factory: test」です。これにより、test_factory.rb ファイルがロードされていないと思いますか? 私が何を変更すべきかについて何か考えはありますか?
これが私のファイルです。
#test/factories/test_factory.rb
Factory.define :test do |t|
t.name 'test_spotlight'
t.label 'test spotlight label'
end
と
#test/modes/test_spec.rb
require 'test_helper'
require 'factory_girl'
class TestTest < Test::Unit::TestCase
def setup
@test = Factory.build(:test)
end
context "A test" do
should "save with the minimum requirements" do
assert @test.save
end
end
end