MiniTests can't see AutoRun

ruby

#1

Hi there, I’m testing out various CI toolsets with a small ruby program that has a test. (I’m a novice at Ruby so apologies if I’ve missed something within my test program and not with CircleCI)

The problem I’m experiencing is that I can’t get the MiniTest test to run. Using a pre-test command in the build setup, and I can see the MiniTest gem that I’m using is available:

bundle show minitest
/home/ubuntu/TestCDTool/vendor/bundle/ruby/2.2.0/gems/minitest-5.3.5

Yet when I run the test the code hits the line “require ‘minitest/autorun’” in my test file and the CircleCI test runner will error with:

/opt/circleci/ruby/ruby-2.2.4/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in ‘require’: cannot load such file – minitest/autorun (LoadError)
from /opt/circleci/ruby/ruby-2.2.4/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in ‘require’
from tests/maths_spec.rb:1:in `’

I’ve tried running the build without a cache (I can then see bundler grabbing the gem). I’ve tried using a circle.yml file, I’ve tried running it locally (and it all works).

Can anyone help me and let me know what I’m doing wrong? (If the issue is down to my Ruby knowledge then please accept my apologies.)


#2

Hey Phil,

There may be a version mismatch here.

This shows that it is installed under Ruby 2.2.0:

But your tests seem to be trying to use Ruby 2.2.4, in addition its looking under “system ruby” rather than your RVM environment.

/opt/circleci/ruby/ruby-2.2.4/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in ‘require’: cannot load such file – minitest/autorun (LoadError)

Can you share your full Circle.yml, or even better if this is a public repo the build URL? Also, can you confirm which version of ruby you are trying to use?


#3