Alex Chaffee 的 test-first ruby 课程教授如何使用 rspec。我目前坚持第一次练习,00_hello
. 我按照指示创建了一个hello.rb
包含代码的文件:
def hello
"Hello!"
end
并将其放在00_hello
带有hello_specs.rb
. 当我rake
从目录中输入终端时00_hello
,我收到以下错误,这些错误与 rspec 错误不同:
(in /Users/stevenjli/Documents/App Academy/learn_ruby-master)
/Users/stevenjli/Documents/App Academy/learn_ruby-master/00_hello/hello_spec.rb:116:in `require': cannot load such file -- hello (LoadError)
from /Users/stevenjli/Documents/App Academy/learn_ruby-master/00_hello/hello_spec.rb:116:in `<top (required)>'
from /usr/local/rvm/gems/ruby-1.9.3-p286/gems/rspec-core-2.12.2/lib/rspec/core/configuration.rb:789:in `load'
from /usr/local/rvm/gems/ruby-1.9.3-p286/gems/rspec-core-2.12.2/lib/rspec/core/configuration.rb:789:in `block in load_spec_files'
from /usr/local/rvm/gems/ruby-1.9.3-p286/gems/rspec-core-2.12.2/lib/rspec/core/configuration.rb:789:in `each'
from /usr/local/rvm/gems/ruby-1.9.3-p286/gems/rspec-core-2.12.2/lib/rspec/core/configuration.rb:789:in `load_spec_files'
from /usr/local/rvm/gems/ruby-1.9.3-p286/gems/rspec-core-2.12.2/lib/rspec/core/command_line.rb:22:in `run'
from /usr/local/rvm/gems/ruby-1.9.3-p286/gems/rspec-core-2.12.2/lib/rspec/core/runner.rb:80:in `run'
from /usr/local/rvm/gems/ruby-1.9.3-p286/gems/rspec-core-2.12.2/lib/rspec/core/runner.rb:17:in `block in autorun'
rake aborted!
/usr/local/rvm/rubies/ruby-1.9.3-p286/bin/ruby -S rspec /Users/stevenjli/Documents/App\
Academy/learn_ruby-master/00_hello/hello_spec.rb -I/Users/stevenjli/Documents/App
Academy/learn_ruby-master/00_hello -I/Users/stevenjli/Documents/App Academy/learn_ruby-master
/00_hello/solution -f documentation -r ./rspec_config failed
我猜我的设置有问题。这是我正在使用的版本。
- Mac OS 10.8.2
- 红宝石版本 1.9.3
- 耙 0.9.2.2
- rspec 版本 2.12.2