Loaderror:找不到这样的文件

时间:2014-07-31 06:03:36

标签: ruby-on-rails ruby rspec

您好我刚刚开始在轨道上制作一个应用程序,我在编写规范文件时遇到问题。 我跑了bundle exec rspec spec/controllers/api/user_controller_spec.rb,但它给了我错误:

/home/action/.gem/ruby/2.0.0/gems/rspec-core-2.13.1/lib/rspec/core/configuration.rb:819:in `load': cannot load such file -- /home/action
/slidey/spec/controllers/api/user_controller_spec.rb (LoadError)                                                                        
        from /home/action/.gem/ruby/2.0.0/gems/rspec-core-2.13.1/lib/rspec/core/configuration.rb:819:in `block in load_spec_files'      
        from /home/action/.gem/ruby/2.0.0/gems/rspec-core-2.13.1/lib/rspec/core/configuration.rb:819:in `each'                          
        from /home/action/.gem/ruby/2.0.0/gems/rspec-core-2.13.1/lib/rspec/core/configuration.rb:819:in `load_spec_files'               
        from /home/action/.gem/ruby/2.0.0/gems/rspec-core-2.13.1/lib/rspec/core/command_line.rb:22:in `run'                             
        from /home/action/.gem/ruby/2.0.0/gems/rspec-core-2.13.1/lib/rspec/core/runner.rb:80:in `run'                                   
        from /home/action/.gem/ruby/2.0.0/gems/rspec-core-2.13.1/lib/rspec/core/runner.rb:17:in `block in autorun'         

编辑:当我跑bundle exec rspec spec时,他们给了我以下错误:

/home/action/.gem/ruby/2.0.0/gems/activerecord-4.0.8/lib/active_record/dynamic_matchers.rb:22:in `method_missing': undefined method `has
_attached_file' for #<Class:0x007f44f503bee8> (NoMethodError)                                                                           
        from /home/action/slidey/app/models/documents.rb:6:in `<class:Documents>'                                                       
        from /home/action/slidey/app/models/documents.rb:1:in `<top (required)>'                                                        
        from /home/action/.gem/ruby/2.0.0/gems/activesupport-4.0.8/lib/active_support/dependencies.rb:229:in `require'                  
        from /home/action/.gem/ruby/2.0.0/gems/activesupport-4.0.8/lib/active_support/dependencies.rb:229:in `block in require'         
        from /home/action/.gem/ruby/2.0.0/gems/activesupport-4.0.8/lib/active_support/dependencies.rb:214:in `load_dependency'          
        from /home/action/.gem/ruby/2.0.0/gems/activesupport-4.0.8/lib/active_support/dependencies.rb:229:in `require'                  
        from /home/action/.gem/ruby/2.0.0/gems/activesupport-4.0.8/lib/active_support/dependencies.rb:330:in `require_or_load'          
        from /home/action/.gem/ruby/2.0.0/gems/activesupport-4.0.8/lib/active_support/dependencies.rb:463:in `load_missing_constant'    
        from /home/action/.gem/ruby/2.0.0/gems/activesupport-4.0.8/lib/active_support/dependencies.rb:184:in `const_missing'            
        from /home/action/slidey/spec/models/documents_spec.rb:3:in `<top (required)>'                                                  
        from /home/action/.gem/ruby/2.0.0/gems/activesupport-4.0.8/lib/active_support/dependencies.rb:223:in `load'                     
        from /home/action/.gem/ruby/2.0.0/gems/activesupport-4.0.8/lib/active_support/dependencies.rb:223:in `block in load'            
        from /home/action/.gem/ruby/2.0.0/gems/activesupport-4.0.8/lib/active_support/dependencies.rb:214:in `load_dependency'          
        from /home/action/.gem/ruby/2.0.0/gems/activesupport-4.0.8/lib/active_support/dependencies.rb:223:in `load'              

任何人都可以对此有所了解吗?这是什么意思?

2 个答案:

答案 0 :(得分:0)

看起来找不到文件spec/controllers/api/user_controller_spec.rb

答案 1 :(得分:0)

尝试将您的规范文件重命名为users_controller_spec.rb