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

How to return test tasks?

Backstory: I did not start with the default rails project. I use datamapper with dm-rails and used the boodstrap command:

rails 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 
+4
source share
1 answer

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

The DataMapper template will change this. Since it does not use ActiveRecord, it cannot require 'rails/all' to cause problems. The only Rails component that it actually stores is the ActionController. It places require expressions for ActiveResource, ActionMailer, and TestUnit in the expressions, but comments on them by default .

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

 require 'rails/test_unit/railtie' 
+7
source

Source: https://habr.com/ru/post/1339423/


All Articles