railstutorial.org - undefined method `Factory'

前端 未结 10 1428
时光取名叫无心
时光取名叫无心 2021-02-14 08:06

I\'m attempting to follow railstutorial.org, and am currently on Chapter 7, where you start using factories: http://railstutorial.org/chapters/modeling-and-viewing-users-two#sec

10条回答
  •  南笙
    南笙 (楼主)
    2021-02-14 08:23

    I had this problem, but it was because I had placed the factory girl gem under the development section instead of the test section of the Gemfile. Once under the test section, it worked. One difference I note between my entry and yours is that mine specifies 1.0:

    group :test do
      gem 'rspec-rails', '2.6.1'
      gem 'webrat', '0.7.1'
      gem 'factory_girl_rails', '1.0'
    end
    

提交回复
热议问题