我試圖運行鍼對包含的Hello文件中的hello方法測試:`要求:不能加載這樣的文件 - 你好(LoadError)
ruby hello_spec.rb
返回:
/usr/local/Cellar/ruby/2.1.2_2/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- hello (LoadError)
from /usr/local/Cellar/ruby/2.1.2_2/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from hello_spec.rb:116:in `<main>'
這些文件包含在同一個目錄中。我已經安裝了RSpec和(我相信)必要的寶石。其他人似乎也有類似的問題,但沒有解決方案爲我工作。
我正在運行Ruby 2.1.2 我是Ruby的新手,我正在努力(顯然)正確配置環境。任何幫助深表感謝。
注:我沒有寫任何測試代碼。我真的只做了hello.rb文件。
嘗試「加載」命令而不是「要求」? 加載'hello_spec.rb' 需要加載文件只有一次在紅寶石。 包含在「加載」ruby源文件中。 –
從REPL內部?我得到同樣的東西。 – smth
tr load'./hello_spec.rb' –