Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error: Command 'test' not recognized

Im developing in c9.io in a rails server. I execute rails test and it works corectly. Next day I execute the same command but instead appear Error: Command 'test' not recognized I do not change anything. How can I restore this command?

Note:rake test works perfectly but ruby page http://edgeguides.rubyonrails.org/testing.html and ruby on rails tutorial by Michael Hartl https://www.railstutorial.org/book/static_pages talk about rails test command and it work for me 2 days.

this is my gemfile

source 'https://rubygems.org'

gem 'rails',        '4.2.2'  
gem 'sass-rails',   '5.0.2'  
gem 'uglifier',     '2.5.3'  
gem 'coffee-rails', '4.1.0'  
gem 'jquery-rails', '4.0.3'  
gem 'turbolinks',   '2.3.0'  
gem 'jbuilder',     '2.2.3'  
gem 'sdoc',         '0.4.0', group: :doc


group :development, :test do    
gem 'sqlite3',     '1.3.9'    
gem 'byebug',      '3.4.0'    
gem 'web-console', '2.0.0.beta3'    
gem 'spring',      '1.1.3'
end


group :test do    
gem 'minitest-reporters', '1.0.5'    
gem 'mini_backtrace',     '0.1.3'    
gem 'guard-minitest',     '2.3.1'   
end


group :production do      
gem 'pg',             '0.17.1'      
gem 'rails_12factor', '0.0.2'  
end
like image 532
Daniel Jose Padilla Peña Avatar asked May 31 '26 18:05

Daniel Jose Padilla Peña


2 Answers

Answered by MarsAtomic:

Prior to Rails 5, you had to run tests using the rake tool. With Rails 5, you run tests with rails test. Either you a) downgraded your Rails version, or b) you were testing against an entirely different project using Rails 5, or c) you were simply mistaken and were using rake test the entire time.

like image 96
Daniel Jose Padilla Peña Avatar answered Jun 02 '26 09:06

Daniel Jose Padilla Peña


Since you say you have not changed anything:

Step 1

Make sure you are in your project's directory:

cd /path/to/app

Step 2

Make sure you are using the version of Rails you think you are using:

rails -v

Step 3

Compare that against your application's environment:

If your app is Rails 4, this will return information about your app:

rake about  

If your app is Rails 5, that will not work, but this will:

rails about

Step 4

Use the appropriate command for the Rails version of your app.

If your app is Rails 4:

rake test

If your app is Rails 5:

rails test
like image 41
S. Harper Avatar answered Jun 02 '26 09:06

S. Harper