将rails从ubuntu迁移到osx时未初始化的常量

时间:2012-11-06 08:54:36

标签: ruby-on-rails macos devise

我试图将我的rails应用程序从ubuntu移动到osx。运行rspec时,我得到以下模糊错误:

/Users/josh/dev/myproject/spec/support/devise.rb:3:in `block in <top (required)>': uninitialized constant RequestHelpers (NameError)
    from /Users/josh/.rvm/gems/ruby-1.9.3-p286@myproject/gems/rspec-core-2.11.1/lib/rspec/core.rb:92:in `configure'
    from /Users/josh/dev/myproject/spec/support/devise.rb:1:in `<top (required)>'
    from /Users/josh/dev/myproject/spec/spec_helper.rb:21:in `block (2 levels) in <top (required)>'
    from /Users/josh/dev/myproject/spec/spec_helper.rb:21:in `each'
    from /Users/josh/dev/myproject/spec/spec_helper.rb:21:in `block in <top (required)>'
    from /Users/josh/.rvm/gems/ruby-1.9.3-p286@myproject/gems/spork-0.9.2/lib/spork.rb:24:in `prefork'
    from /Users/josh/dev/myproject/spec/spec_helper.rb:4:in `<top (required)>'
    from /Users/josh/dev/myproject/spec/controllers/comments_controller_spec.rb:1:in `require'
    from /Users/josh/dev/myproject/spec/controllers/comments_controller_spec.rb:1:in `<top (required)>'
    from /Users/josh/.rvm/gems/ruby-1.9.3-p286@myproject/gems/rspec-core-2.11.1/lib/rspec/core/configuration.rb:780:in `load'
    from /Users/josh/.rvm/gems/ruby-1.9.3-p286@myproject/gems/rspec-core-2.11.1/lib/rspec/core/configuration.rb:780:in `block in load_spec_files'
    from /Users/josh/.rvm/gems/ruby-1.9.3-p286@myproject/gems/rspec-core-2.11.1/lib/rspec/core/configuration.rb:780:in `map'
    from /Users/josh/.rvm/gems/ruby-1.9.3-p286@myproject/gems/rspec-core-2.11.1/lib/rspec/core/configuration.rb:780:in `load_spec_files'
    from /Users/josh/.rvm/gems/ruby-1.9.3-p286@myproject/gems/rspec-core-2.11.1/lib/rspec/core/command_line.rb:22:in `run'
    from /Users/josh/.rvm/gems/ruby-1.9.3-p286@myproject/gems/rspec-core-2.11.1/lib/rspec/core/runner.rb:66:in `rescue in run'
    from /Users/josh/.rvm/gems/ruby-1.9.3-p286@myproject/gems/rspec-core-2.11.1/lib/rspec/core/runner.rb:62:in `run'
    from /Users/josh/.rvm/gems/ruby-1.9.3-p286@myproject/gems/rspec-core-2.11.1/lib/rspec/core/runner.rb:8:in `block in autorun'

一切都在Ubuntu上很好用,所以我想它一定是环保的。有什么想法可以从哪里开始挖掘?

感谢 - 乔希

编辑:不明白为什么,但是rake无法找到文件request_helpers.rb。把它移到其他地方解决了这个问题。

1 个答案:

答案 0 :(得分:1)

这几乎不是操作系统问题,而是配置问题。确保您的environemnt在以下方面是相同的:

  • 使用rvm以相同的方式安装
  • 在Gemfile中拥有所有需要的宝石
  • 使用bundle执行rspec
  • 使用相同版本的所有内容。

通过这种方式,这不是一个模糊的信息,事实上非常清楚:

  

uninitialized constant RequestHelpers (NameError)

因此spec/support/devise.rb文件无法找到所需的类。

你写过那个文件吗?如果没有,你是如何产生它的?重复此过程以生成它(可能是rake somethingrails generate something),这样就可以了。