我正在网上看这个教程: https://www.relishapp.com/rspec/docs/gettingstarted
# game_spec.rb
describe Game do
describe "#score" do
it "returns 0 for all gutter game" do
game = Game.new
20.times { game.roll(0) }
game.score.should == 0
end
end
end
运行第一个例子,我注意到他们列出的错误消息比我看到的要短得多。在我的终端上,堆栈跟踪很长,它从顶部滚动。是否有任何方法可以缩短错误消息/堆栈输出以使其适合?
/testspec/game_spec.rb:3:in `<top (required)>': uninitialized constant Game (NameError)
from /.rvm/gems/ruby-1.9.3-p194/gems/rspec-core-2.12.2/lib/rspec/core/configuration.rb:789:in `load'
from /.rvm/gems/ruby-1.9.3-p194/gems/rspec-core-2.12.2/lib/rspec/core/configuration.rb:789:in `block in load_spec_files'
from /.rvm/gems/ruby-1.9.3-p194/gems/rspec-core-2.12.2/lib/rspec/core/configuration.rb:789:in `each'
from /.rvm/gems/ruby-1.9.3-p194/gems/rspec-core-2.12.2/lib/rspec/core/configuration.rb:789:in `load_spec_files'
from /.rvm/gems/ruby-1.9.3-p194/gems/rspec-core-2.12.2/lib/rspec/core/command_line.rb:22:in `run'
from /.rvm/gems/ruby-1.9.3-p194/gems/rspec-core-2.12.2/lib/rspec/core/runner.rb:80:in `run'
from /.rvm/gems/ruby-1.9.3-p194/gems/rspec-core-2.12.2/lib/rspec/core/runner.rb:17:in `block in autorun'
我从那里的dirs列表中剥离了我的家庭目录。是否可以将详细程度简单地命名为NameError行?
答案 0 :(得分:0)
正如我在评论中所猜测的那样,您的配置/安装存在错误。
`require': cannot load such file -- ./game
Ruby无法找到该文件。确保您有正确的文件,然后再次运行测试。