我跟隨了幾個教程和FactoryGirl的文檔與RSpec一起使用。帶RSpec和FactoryGirl的Rails引擎
describe "GenericRecipesController" do
describe "GET 'index'" do
it "displays list of generic recipes" do
generic_recipe = FactoryGirl.create(:generic_recipe)
visit '/recipe'
response.should be_success
end
end
end
和錯誤:
GenericRecipesController GET 'index' displays list of generic recipes
Failure/Error: generic_recipe = FactoryGirl.create(:generic_recipe)
NameError:
uninitialized constant GenericRecipe
# ./spec/integration/generic_recipes_spec.rb:8:in `block (3 levels) in <top (required)>'
的code is there其餘的目前我嘗試使用FactoryGirl.create時,你得到一個錯誤。
在提出問題之前,請提供完整的源代碼。 – depa
另外,你可以告訴我們你的工廠的代碼? – depa
謝謝,工廠在這裏:https://github.com/valk/edible-recipe/blob/master/spec/factories.rb – valk