【发布时间】:2016-11-05 16:26:16
【问题描述】:
刚刚学习 ruby。
我的目录中有两个文件夹: “库”和“测试”
lib\person.rb 内部:
class Person
attr_accessor :name
def introduction
"Hello, my name is #{name}!"
end
end
内测\test_person.rb:
require 'minitest/autorun'
require 'person'
class TestPerson < Minitest::Test
def test_introduction
person = Person.new
person.name = 'Bob'
assert(person.introduction == 'Hello, my name is Bob!')
end
end
当我尝试运行时:ruby -I lib test/test_person.rb 我收到以下错误:
(...) cannot load such file -- person (LoadError) (...)
-I 参数似乎不起作用。没有它我会得到同样的错误。 有什么线索吗? 坦克
【问题讨论】: