0

我正在关注 Michael Hartl 的 ruby​​ on rails 教程 3.2,但是当我放入gem 'factory_girl_rails', '1.4.0'我的 gemfile 并运行它时,bundle install它显示“捆绑完成”,因为 gem 已经加载到我的 PC 中。我的问题是它没有factories.rb在 spec 文件夹中生成文件。出了什么问题?

Gemfile

source 'https://rubygems.org'

gem 'rails',          '3.2.3'
gem 'bootstrap-sass', '2.0.0'
gem 'bcrypt-ruby',    '3.0.1'

group :development, :test do
   gem 'sqlite3',     '1.3.5'
   gem 'rspec-rails', '2.9.0'
   gem 'annotate',    '~> 2.4.1.beta'
end

# Gems used only for assets and not required
# in production environments by default.

group :assets do
  gem 'sass-rails',   '3.2.4'
  gem 'coffee-rails', '3.2.2'
  gem 'uglifier',     '1.2.3'
end

gem 'jquery-rails', '2.0.0'

group :test do
  gem 'capybara',           '1.1.2'
  gem 'factory_girl_rails', '1.4.0'
end

group :production do
  gem 'pg', '0.12.2'
end

routes.rb

SAMPLEApp::Application.routes.draw do
  resources :users

  root to: 'static_pages#home'

  match '/signup',  to: 'users#new'
  match '/help',    to: 'static_pages#help'
  match '/about',   to: 'static_pages#about'
  match '/contact', to: 'static_pages#contact'
end
4

1 回答 1

2

运行bundle install不会将任何文件添加到您的 Rails 应用程序。它只会下载它需要使用的正确库。有时这些库会附带一个 rails 生成器,你会运行类似rails generate some_library:install. 我不认为 factory_girl_rails 是这种情况。您可能需要手动添加文件。

于 2012-05-11T14:28:11.697 回答