开发者

Missing `test` rake tasks in Rails 3 project based on DataMapper template

开发者 https://www.devze.com 2023-02-10 05:18 出处:网络
How can I get the test tasks back? Backstory:I didn\'t start with the default new rails project.I\'m using datamapper with dm-rails and used their boodstrap command:

How can I get the test tasks back?

Backstory: I didn't start with the default new rails project. I'm using datamapper with dm-rails and used their boodstrap command:

ra开发者_如何学运维ils new project_name -m http://datamapper.org/templates/rails.rb

My Rakefile is as follows:

require File.expand_path('../config/application', __FILE__)
require 'rake'

MyAppName::Application.load_tasks


In a default Rails 3 project, config/application.rb contains require 'rails/all', basically requiring all of the rails frameworks (ActiveRecord, ActiveResource, ActionController, ActionMailer, TestUnit, etc.)

The DataMapper template changes this. Since it doesn't use ActiveRecord, it can't require 'rails/all' without causing problems. The only default Rails component it actually keeps is ActionController. It puts in require statements for ActiveResource, ActionMailer, and TestUnit, but comments them out by default.

Long story short: uncomment the following line in config/application.rb:

require 'rails/test_unit/railtie'
0

精彩评论

暂无评论...
验证码 换一张
取 消