运行测试文件时出现以下错误。
$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>'
测试文件片段:
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
我认为 gem 已安装并且应该可用:
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)
为什么你认为的错误?