0

我正在运行 Ruby 1.8.6。

我安装了 minitest 1.3.1 gem,它实际上是 Ruby 1.9 中 Test::Unit 框架的新替代品。API 应该是相同的。

我写了一个小测试来让事情顺利进行:

require 'rubygems'
gem 'minitest'
require 'minitest/unit'

MiniTest::Unit.autorun

class CategoryMiniTest < MiniTest::Unit::TestCase
  def test_twoCategoriesCannotHaveSameName
    assert_equals(2,2)
  end
end

这导致:

>ruby test\unit\category_mini_test.rb
l:/ruby_home/lib/ruby/1.8/pathname.rb:709:in `relative_path_from': different prefix: "l:/" and "L:/Gishu/Ruby/Rails/ShowMeTheMoney" (ArgumentError)
        from l:/ruby_home/lib/ruby/gems/1.8/gems/minitest-1.3.1/lib/minitest/unit.rb:17

是什么赋予了?

4

1 回答 1

1

I can't see anything wrong with your code. It looks almost exactly the same as the Ruby 1.8.6 & MiniTest example in my blog post: Test::Unit and MiniTest with different Ruby versions.

So I wonder if it is:

  1. something to do with your environment,
  2. something to do with how you are running the test, or
  3. a bug in MiniTest.

Looking at the error message, I wonder whether the problem is with case-sensitivity - the upper-case and lower-case L drive letters may not match.

于 2009-02-08T14:39:53.357 回答