我在Q& As中进行了广泛的搜索,但尚未找到解决方案,我希望你能帮助我们。
我目前正在尝试TestFirst(Learn_Ruby TestFirst),甚至无法通过00_hello的第一次测试。当我按照要求创建hello.rb之前输入rake时,我得到一条很长的错误消息 - 而不是任务中提到的一行内容错误消息。
输入 rake
(in /Users/yanique/Desktop/learn_ruby)
/Users/yanique/.rvm/rubies/ruby-2.1.1/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- spec_helper (LoadError)
from /Users/yanique/.rvm/rubies/ruby-2.1.1/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/yanique/.rvm/gems/ruby-2.1.1/gems/rspec-core-3.0.1/lib/rspec/core/configuration.rb:1018:in `block in requires='
from /Users/yanique/.rvm/gems/ruby-2.1.1/gems/rspec-core-3.0.1/lib/rspec/core/configuration.rb:1018:in `each'
from /Users/yanique/.rvm/gems/ruby-2.1.1/gems/rspec-core-3.0.1/lib/rspec/core/configuration.rb:1018:in `requires='
from /Users/yanique/.rvm/gems/ruby-2.1.1/gems/rspec-core-3.0.1/lib/rspec/core/configuration_options.rb:101:in `block in process_options_into'
from /Users/yanique/.rvm/gems/ruby-2.1.1/gems/rspec-core-3.0.1/lib/rspec/core/configuration_options.rb:100:in `each'
from /Users/yanique/.rvm/gems/ruby-2.1.1/gems/rspec-core-3.0.1/lib/rspec/core/configuration_options.rb:100:in `process_options_into'
from /Users/yanique/.rvm/gems/ruby-2.1.1/gems/rspec-core-3.0.1/lib/rspec/core/configuration_options.rb:22:in `configure'
from /Users/yanique/.rvm/gems/ruby-2.1.1/gems/rspec-core-3.0.1/lib/rspec/core/runner.rb:96:in `setup'
from /Users/yanique/.rvm/gems/ruby-2.1.1/gems/rspec-core-3.0.1/lib/rspec/core/runner.rb:85:in `run'
from /Users/yanique/.rvm/gems/ruby-2.1.1/gems/rspec-core-3.0.1/lib/rspec/core/runner.rb:70:in `run'
from /Users/yanique/.rvm/gems/ruby-2.1.1/gems/rspec-core-3.0.1/lib/rspec/core/runner.rb:38:in `invoke'
from /Users/yanique/.rvm/gems/ruby-2.1.1/gems/rspec-core-3.0.1/exe/rspec:4:in `<top (required)>'
from /Users/yanique/.rvm/gems/ruby-2.1.1/bin/rspec:23:in `load'
from /Users/yanique/.rvm/gems/ruby-2.1.1/bin/rspec:23:in `<main>'
/Users/yanique/.rvm/rubies/ruby-2.1.1/bin/ruby -S rspec /Users/yanique/Desktop/learn_ruby/00_hello/hello_spec.rb -I/Users/yanique/Desktop/learn_ruby/00_hello -I/Users/yanique/Desktop/learn_ruby/00_hello/solution -f documentation -r ./rspec_config failed
运行 宝石列表
*** LOCAL GEMS ***
bigdecimal (1.2.4)
bundler (1.6.1)
bundler-unload (1.0.2)
diff-lcs (1.2.5)
executable-hooks (1.3.1)
gem-wrappers (1.2.4)
io-console (0.4.2)
json (1.8.1)
minitest (4.7.5)
psych (2.0.3)
rake (10.1.0)
rdoc (4.1.0)
rspec (3.0.0, 2.99.0)
rspec-core (3.0.1, 2.99.0)
rspec-expectations (3.0.1, 2.99.0)
rspec-mocks (3.0.1, 2.99.1)
rspec-support (3.0.0)
rubygems-bundler (1.4.3)
rvm (1.11.3.9)
test-unit (2.1.1.0)
rvm info
ruby-2.1.1:
system:
uname: "Darwin yaniques-air.home 13.2.0 Darwin Kernel Version 13.2.0: Thu Apr 17 23:03:13 PDT 2014; root:xnu-2422.100.13~1/RELEASE_X86_64 x86_64"
system: "osx/10.9/x86_64"
bash: "/bin/bash => GNU bash, version 3.2.51(1)-release (x86_64-apple-darwin13)"
zsh: "/bin/zsh => zsh 5.0.2 (x86_64-apple-darwin13.0)"
rvm:
version: "rvm 1.25.27 (master) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/]"
updated: "9 days 2 hours 44 seconds ago"
path: "/Users/yanique/.rvm"
ruby:
interpreter: "ruby"
version: "2.1.1p76"
date: "2014-02-24"
platform: "x86_64-darwin12.0"
patchlevel: "2014-02-24 revision 45161"
full_version: "ruby 2.1.1p76 (2014-02-24 revision 45161) [x86_64-darwin12.0]"
homes:
gem: "/Users/yanique/.rvm/gems/ruby-2.1.1"
ruby: "/Users/yanique/.rvm/rubies/ruby-2.1.1"
binaries:
ruby: "/Users/yanique/.rvm/rubies/ruby-2.1.1/bin/ruby"
irb: "/Users/yanique/.rvm/rubies/ruby-2.1.1/bin/irb"
gem: "/Users/yanique/.rvm/rubies/ruby-2.1.1/bin/gem"
rake: "/Users/yanique/.rvm/rubies/ruby-2.1.1/bin/rake"
environment:
PATH: "/Users/yanique/.rvm/gems/ruby-2.1.1/bin:/Users/yanique/.rvm/gems/ruby- 2.1.1@global/bin:/Users/yanique/.rvm/rubies/ruby-2.1.1/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/usr/local/git/bin:/Users/yanique/.rvm/bin"
GEM_HOME: "/Users/yanique/.rvm/gems/ruby-2.1.1"
GEM_PATH: "/Users/yanique/.rvm/gems/ruby-2.1.1:/Users/yanique/.rvm/gems/ruby-2.1.1@global"
MY_RUBY_HOME: "/Users/yanique/.rvm/rubies/ruby-2.1.1"
IRBRC: "/Users/yanique/.rvm/rubies/ruby-2.1.1/.irbrc"
RUBYOPT: ""
gemset: ""
rvm是一个功能
yaniques-air:~ yanique$ type rvm | head -n1
rvm is a function
yaniques-air:~ yanique$ rake --version
rake, version 10.1.0
尝试 捆绑安装
yaniques-air:00_hello yanique$ bundle install
Using rake 10.1.0
Using diff-lcs 1.2.5
Using rspec-support 3.0.0
Using rspec-core 3.0.1
Using rspec-expectations 3.0.1
Using rspec-mocks 3.0.1
Using rspec 3.0.0
Using bundler 1.6.1
Your bundle is complete!
Use `bundle show [gemname]` to see where a bundled gem is installed.
在没有相应的hello.rb的情况下输入rake时,我期待一个简短的错误,但绝对没有这么大的错误。似乎没有什么工作,我觉得我陷入了僵局。很抱歉只是试图掩盖我的基地的长篇文章。
以下是learn_ruby目录中包含的rakefile (我尝试向其中添加require'ruby gems',但这也无济于事)
gem 'rspec', '~>2'
require 'rspec/core/rake_task'
task :default => :spec
desc "run tests for this lab"
RSpec::Core::RakeTask.new do |task|
lab = Rake.application.original_dir
task.pattern = "#{lab}/*_spec.rb"
task.rspec_opts = [ "-I#{lab}", "-I#{lab}/solution", '-f documentation', '-r ./rspec_config']
task.verbose = false
end
任何帮助将不胜感激!谢谢你的时间。
答案 0 :(得分:0)
卸载所有 rspec
相关宝石,所有版本,然后重新安装最后的2.x版本
gem install -v '< 3.0.0' rspec
从根目录再次尝试rake
。