septerr septerr - 3 months ago 23
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
Sinatra::Application
end
end


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 (0.9.2.2)
rubygems-bundler (0.9.0)
rvm (1.11.3.3)
sinatra (1.3.2)
tilt (1.3.3)


Why the error you think?

Answer

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

Comments