我没有任何问题安装了rspec。但是,当我运行命令rspec
时,我收到以下错误。有人可以帮忙吗?
C:\>ruby -v
ruby 1.9.3p327 (2012-11-10) [i386-mingw32]
C:\>rspec
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rspec-core-2.12.1/lib/rspec/core/configuration.rb:789:in `load': cannot load such file -- C:/spec (LoadError)
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/rspec-core-2.12.1/lib/rspec/core/configuration.rb:789:in `block in load_spec_files'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/rspec-core-2.12.1/lib/rspec/core/configuration.rb:789:in `each'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/rspec-core-2.12.1/lib/rspec/core/configuration.rb:789:in `load_spec_files'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/rspec-core-2.12.1/lib/rspec/core/command_line.rb:22:in `run'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/rspec-core-2.12.1/lib/rspec/core/runner.rb:80:in `run'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/rspec-core-2.12.1/lib/rspec/core/runner.rb:17:in `block in autorun'
C:\>gem list --local
*** LOCAL GEMS ***
actionmailer (3.2.9)
actionpack (3.2.9)
activemodel (3.2.9)
activerecord (3.2.9)
activeresource (3.2.9)
activesupport (3.2.9)
archive-tar-minitar (0.5.2)
arel (3.0.2)
awesome_print (1.1.0)
bigdecimal (1.1.0)
builder (3.0.4)
bundler (1.2.2)
coffee-rails (3.2.2)
coffee-script (2.2.0)
coffee-script-source (1.4.0)
columnize (0.3.6)
diff-lcs (1.1.3)
domain_name (0.5.4)
erubis (2.7.0)
execjs (1.4.0)
hike (1.2.1)
i18n (0.6.1)
io-console (0.3)
journey (1.0.4)
jquery-rails (2.1.3)
json (1.7.5, 1.5.4)
linecache19 (0.5.12)
mail (2.4.4)
mechanize (2.5.1)
mechanize-progressbar (0.2.0)
mime-types (1.19)
minitest (2.5.1)
multi_json (1.3.7)
net-http-digest_auth (1.2.1)
net-http-persistent (2.8)
nokogiri (1.5.5 x86-mingw32)
ntlm-http (0.1.1)
ocra (1.3.0)
pik (0.2.8)
polyglot (0.3.3)
progressbar (0.12.0)
rack (1.4.1)
rack-cache (1.2)
rack-ssl (1.3.2)
rack-test (0.6.2)
rails (3.2.9)
railties (3.2.9)
rake (10.0.2, 0.9.2.2)
rdiscount (1.6.8)
rdoc (3.12, 3.9.4)
rspec (2.12.0)
rspec-core (2.12.1)
rspec-expectations (2.12.0)
rspec-mocks (2.12.0)
ruby-debug-base19x (0.11.30.pre10, 0.11.30.pre3)
ruby-debug-ide (0.4.17.beta14)
ruby_core_source (0.1.5)
sass (3.2.3)
sass-rails (3.2.5)
shoes (3.0.1)
sprockets (2.2.1)
sqlite3 (1.3.6 x86-mingw32)
thor (0.16.0)
tilt (1.3.3)
tiny_tds (0.5.1 x86-mingw32)
treetop (1.4.12)
tzinfo (0.3.35)
uglifier (1.3.0)
unf (0.0.5)
unf_ext (0.0.5 x86-mingw32)
webrobots (0.0.13)
wxruby-ruby19 (2.0.1 x86-mingw32)
C:\>
编辑:
正如David指出的那样,我在c:\下没有spec
文件夹。创建该文件夹后,一切似乎都很好。对不起这个愚蠢的问题我很抱歉。我对rspec完全不熟悉。谢谢大家!
C:\>mkdir spec
C:\>rspec
No examples found.
Finished in 0 seconds
0 examples, 0 failures
C:\>
答案 0 :(得分:2)
rspec
命令应该在项目的目录上下文中运行,而不是在驱动器的根目录下任意运行。它抱怨,因为它无法找到要执行的特定spec
文件夹。在根处创建一个似乎有点奇怪。
每个项目都应该有自己的spec
目录,并且应该从该目录的父目录执行rspec
命令。