Marcis
Marcis

Reputation: 85

Ruby cannot load file required in test_helper

This is the file structure of my gem under Documents folder:

my_client
  lib
    my_client.rb
  test
    test_helper.rb
    test_my_client.rb
  my_client-1.0.0.gem 
  miracl_client.gemspec
  Rakefile

My test_helper.rb file looks like:

require 'minitest/autorun'
require 'my_client'

and I have require 'test_helper' line on top of my test_my_client.rb file.

Error message when I try to run tests by typing ruby -I. test_miracl_client.rb:

/.rvm/rubies/ruby-2.1.3/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- my_client (LoadError)

What's the right configuration of test_helper (and maybe Rakefile if that's necessary) to load my_client.rb where class MyClient is located?

Upvotes: 0

Views: 657

Answers (1)

Ursus
Ursus

Reputation: 30056

Have you tried something like

require_relative '../lib/my_client'

?

Upvotes: 1

Related Questions