【发布时间】:2018-09-14 03:29:25
【问题描述】:
我刚搬到一台运行 Win 10/ruby 2.2.2/Rails 4.2.0 的新笔记本电脑上(以前的 Win 8 ruby 2.0.0/Rails 4.2/rspec 3.2 没有问题)。现在在安装rspec的时候,下面出现了一个奇怪的错误:
$ rails g rspec:install
identical .rspec
exist spec
create spec/C:/Users/Jun C/AppData/Local/Temp/d20160219-10996-1x6hu8w/spec/spec_helper.rb
C:/Ruby22-x64/lib/ruby/2.2.0/fileutils.rb:252:in `mkdir': Invalid argument @ dir_s_mkdir - C:/D/code/rails_proj/engines/simple_orderx/spec/C: (Errno::EINVAL)
from C:/Ruby22-x64/lib/ruby/2.2.0/fileutils.rb:252:in `fu_mkdir'
from C:/Ruby22-x64/lib/ruby/2.2.0/fileutils.rb:226:in `block (2 levels) in mkdir_p'
from C:/Ruby22-x64/lib/ruby/2.2.0/fileutils.rb:224:in `reverse_each'
from C:/Ruby22-x64/lib/ruby/2.2.0/fileutils.rb:224:in `block in mkdir_p'
from C:/Ruby22-x64/lib/ruby/2.2.0/fileutils.rb:210:in `each'
from C:/Ruby22-x64/lib/ruby/2.2.0/fileutils.rb:210:in `mkdir_p'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/actions/create_file.rb:61:in `block in invoke!'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/actions/empty_directory.rb:116:in `call'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/actions/empty_directory.rb:116:in `invoke_with_conflict_check'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/actions/create_file.rb:60:in `invoke!'
Rails 应用根目录下有/spec。 spec-helper 文件应在/spec 下生成为/spec/spec-helper.rb。但是安装尝试在spec/C:/Users/Jun C/AppData/Local/Temp/d20160219-10996-1x6hu8w/spec/ 生成spec-helper。好像路径不对。
这是Gemfile中的行:
s.add_development_dependency "rspec-rails", ">= 3.2.0"
这是engine.rb中的配置
config.generators do |g|
g.template_engine :erb
g.integration_tool :rspec
g.test_framework :rspec
g.fixture_replacement :factory_girl, :dir => "spec/factories"
end
rspec 版本是3.2.2。如何修复 rspec 安装中的这个错误路径?
【问题讨论】:
-
你可以在这里找到答案:stackoverflow.com/questions/25858155/…
标签: ruby-on-rails rspec