According to the Gemfile documentation Gemfile you can simply pass an array of requests. I address this issue by examining RSpec as syntactic sugar for Minitest and noting what I need:
require 'minitest/spec' require 'minitest/autorun'
To make it work. I have never tried a few queries in the Gemfile before, and googling led me here to this question, and more Googling led me to Gemfile that say:
REQUIRE AS (:require) Each gem MAY specify files that should be used when autorequiring via Bundler.require. You may pass an array with multiple files, or false to prevent any file from being autorequired. gem "sqlite3-ruby", :require => "sqlite3" gem "redis", :require => ["redis/connection/hiredis", "redis"] gem "webmock", :require => false
So in my Gemfile I turned on
group :test do gem 'minitest', require: ['minitest/autorun', 'minitest/spec'] gem 'rack-test', require: 'rack/test' gem 'simplecov', require: false end
Which works fine and allows me to write a test like
describe 'basic crud' do it 'must create a user with valid details' do User.transaction do user = User.create!(username: 'test', password: 'pass') user.username.must_equal 'test' user.destroy end end end
What I find reads better than assert_equals user.username, 'test' and gives me access to my familiar methods of preparing and cleaning before :each doβ¦ and after :all doβ¦
source share