Getting Started with MiniTest and Rails
Since you are switching the app from rspec, you most probably have rspec gem in test environment specified in Gemfile, something like:
group :test do gem 'rspec'end
When you load up the 'test' environment with ENV["RAILS_ENV"] = "test"
, you are loading up the rspec, which defines its own describe
method and overrides the one defined by minitest.
So there are 2 solutions here:1. Remove rspec gem from test environment2. If you still want to run rspecs while switching to minitest, you can leave the 'test' environment alone and define another test environment specifically for minitest. Let's call it minitest - copy the config/environment/test.rb to config/enviroment/minitest.rb, define database for minitest environment, and update minitest_helper to set RAILS_ENV to 'minitest':
$ cp config/environments/test.rb config/environments/minitest.rb
(a portion of) config/database.yml
:
minitest: adapter: sqlite3 database: db/test.sqlite3 pool: 5 timeout: 5000test/minitest_helper.rb:ENV["RAILS_ENV"] = "minitest"require File.expand_path("../../config/environment", __FILE__)require "minitest/autorun"