Rspec installation error - Invalid argument @ dir_s_mkdir

589 views
Skip to first unread message

emcla...@gmail.com

unread,
Feb 20, 2016, 3:23:26 AM2/20/16
to rspec

Just moved to a new laptop running on Win 10/ruby 2.2.2/Rails 4.2.0 (No problem on previous Win 8 ruby 2.0.0/Rails 4.2/rspec 3.2). Now when installing rspec, there is a strange error below:


 $ 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:infu_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:inreverse_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:ineach'
  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:inblock 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:ininvoke_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!'


There is /spec under Rails app root. The spec-helper file should be generated under /spec as /spec/spec-helper.rb. However the installation tried to generate spec-helper at spec/C:/Users/Jun C/AppData/Local/Temp/d20160219-10996-1x6hu8w/spec/. It seems that the path is wrong.


Here is the line in Gemfile:

  s.add_development_dependency "rspec-rails", ">= 3.2.0"


Here is the config in 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


The rspec version is 3.2.2. How to fix this wrong path in rspec installation?

Jon Rowe

unread,
Feb 22, 2016, 5:47:09 AM2/22/16
to rs...@googlegroups.com
Hi, the directory you’re seeing is a temporary directory that the files are created in before being put into place, I’m not sure quite why it’s breaking but do your other generators work? If so does `Dir.mktmpdir` work in a normal ruby script?

Jon Rowe
---------------------------

--
You received this message because you are subscribed to the Google Groups "rspec" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rspec+un...@googlegroups.com.
To post to this group, send email to rs...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rspec/9b07e23f-c1e4-4c51-a460-9897694b9c94%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

emcla...@gmail.com

unread,
Feb 26, 2016, 9:59:43 PM2/26/16
to rspec
Hi Jon,

simple_form generator works fine. Here is the output of irb according to a reply on github:

C:\D\code\rails_proj\engines\simple_orderx>irb
irb(main):001:0> require 'tempfile'
=> true
irb(main):002:0> Dir.mktmpdir { |d| puts d}
C:/Users/JUNC~1/AppData/Local/Temp/d20160225-10316-1oexvut
=> nil
irb(main):003:0>

Reply all
Reply to author
Forward
0 new messages