私は次のような工場を持っています:
FactoryGirl.define do
factory :page do
title 'Fake Title For Page'
end
end
そしてテスト:
describe "LandingPages" do
it "should load the landing page with the correct data" do
page = FactoryGirl.create(:page)
visit page_path(page)
end
end
私のspec_helper.rbには次のものが含まれています。
require 'factory_girl_rails'
それでも私は取得し続けます:
LandingPages should load the landing page with the correct data
Failure/Error: page = FactoryGirl.create(:page)
NameError:
uninitialized constant Page
# ./spec/features/landing_pages_spec.rb:5:in `block (2 levels) in <top (required)>'
これは新しいプロジェクトなので、テストが実際に問題になるとは思いません。正しく設定されていない可能性があると思います。試すべきことや、これを解決するためにどこを見ればよいかについてのアイデアはありますか?
私の問題のないpages.rbファイル:
class Pages < ActiveRecord::Base
# attr_accessible :title, :body
end