imatrix Day 2 配置rails3开发gem

开始配置项目 首先,将view的模板改为haml, 测试模块改为rspec, 夹具使用factory-girl

 

编辑Gemfilesource 'http://rubygems.org'

gem 'rails', '3.0.0.rc'

gem 'mysql'

gem 'haml'
#devise 使用Haml时需要下面的gem
gem 'ruby_parser'
gem 'hpricot'


group :development, :test do
  gem 'rails3-generators'
  gem 'rspec-rails' , ">= 2.0.0.beta.19"
end

group :test do
  gem 'factory_girl_rails'
  gem 'autotest'
  gem 'capybara'
  gem 'database_cleaner'
  gem 'cucumber-rails'
  gem 'cucumber'
  gem 'spork'
  gem 'launchy'
end

 

bundle install

 

编辑config/application.rb

 

添加以下内容

 

config.generators do |g|
      g.template_engine :haml
      g.test_framework :rspec, :fixture => true, :views => false
      g.fixture_replacement :factory_girl, :dir => "spec/factories"
end

 

开始安装cucumber和rails

 

$ rails g cucumber:install --rspec --capybara
$ rails g rspec:install

 

编辑feature/support/env.rb, 让cucumber支持factory_girl

 

require "#{Rails.root}/spec/factories/factories"

 

编辑spec/spec_helper.rb, 

 

config.include Webrat::HaveTagMatcher
  config.include Haml::Helpers
  config.include ActionView::Helpers
  config.before(:each) do
  init_haml_helpers
end
 

你可能感兴趣的:(mysql,Ruby,Rails,rubygems,rspec)