septerr septerr - 1 year ago 163
Ruby Question

Load Error rack/test

I am getting following error when running a test file.

$ruby test/test_gothonweb.rb
/Users/sony/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- rack/test (LoadError)
from /Users/sony/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from test/test_gothonweb.rb:3:in `<main>'

Snippet of the test file:

require_relative '../lib/gothonweb.rb'
require 'test/unit'
require 'rack/test'

ENV['RACK_ENV'] = 'test'

class GothonwebTest < Test::Unit::TestCase
include Rack::Test::Methods

def app

I think the gem is installed and should be available:

gem list

*** LOCAL GEMS ***

bundler (1.1.3)
rack (1.4.1)
rack-protection (1.2.0)
rake (
rubygems-bundler (0.9.0)
rvm (
sinatra (1.3.2)
tilt (1.3.3)

Why the error you think?

Answer Source

rack-test is a separate gem. Include that in your Gem file.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download