I am testing Minitest :: Spec as an alternative to RSpec, but I have an unpleasant problem that I cannot answer:
I set some basic specifications in spec/models/*_spec.rb There is minitest-rails in my rails application, and I installed my rake file as follows:
Rake::TestTask.new do |t| t.libs.push "lib" t.test_files = FileList['spec/**/*_spec.rb'] t.verbose = true end task :default => :test
Now, if I write my specification files as follows:
require 'minitest_helper' describe User do ... end
... and run rake test , I get:
user_spec.rb:1:in `require': cannot load such file
however, if I change the require string to
require_relative '../minitest_helper'
Then it works. So this is functional, but it seems that every example of people using mini-tests that I find on the Internet just calls require 'minitest_helper' and not require_relative . So, what am I missing that allows others to work, but not in my situation?
One last piece of information, my supporting file is as follows:
# spec/minitest_helper.rb ENV["RAILS_ENV"] = "test" require File.expand_path('../../config/environment', __FILE__) require "minitest/autorun" require "minitest/rails"
Nothing unusual. Thanks for the help!