"Unable to autoload constant" using rspec but not rails -
i've file test.
app/workers/station/http.rb
module worker module station class http # ... end end end
this spec file.
spec/workers/station/http_spec.rb
describe worker::station::http "should something" end end
the problem i'm getting following error when running spec file using rspec.
rspec spec/workers/station/http_spec.rb
/users/linus/.rvm/gems/ruby-2.0.0-p247@global/gems/activesupport-4.0.4/lib/active_support/dependencies.rb:464:in `load_missing_constant': unable autoload constant station::http, expected app/workers/station/http.rb define (loaderror) /users/linus/.rvm/gems/ruby-2.0.0-p247@global/gems/activesupport-4.0.4/lib/active_support/dependencies.rb:184:in `const_missing' spec/workers/station/http_spec.rb:3:in `<top (required)>' /users/linus/.rvm/gems/ruby-2.0.0-p247@global/gems/activesupport-4.0.4/lib/active_support/dependencies.rb:223:in `load' /users/linus/.rvm/gems/ruby-2.0.0-p247@global/gems/activesupport-4.0.4/lib/active_support/dependencies.rb:223:in `block in load' /users/linus/.rvm/gems/ruby-2.0.0-p247@global/gems/activesupport-4.0.4/lib/active_support/dependencies.rb:214:in `load_dependency' /users/linus/.rvm/gems/ruby-2.0.0-p247@global/gems/activesupport-4.0.4/lib/active_support/dependencies.rb:223:in `load' /users/linus/.rvm/gems/ruby-2.0.0-p247@global/gems/rspec-core-2.14.8/lib/rspec/core/configuration.rb:896:in `block in load_spec_files' /users/linus/.rvm/gems/ruby-2.0.0-p247@global/gems/rspec-core-2.14.8/lib/rspec/core/configuration.rb:896:in `each' /users/linus/.rvm/gems/ruby-2.0.0-p247@global/gems/rspec-core-2.14.8/lib/rspec/core/configuration.rb:896:in `load_spec_files' /users/linus/.rvm/gems/ruby-2.0.0-p247@global/gems/rspec-core-2.14.8/lib/rspec/core/command_line.rb:22:in `run' /users/linus/.rvm/gems/ruby-2.0.0-p247@global/gems/rspec-core-2.14.8/lib/rspec/core/runner.rb:80:in `run' /users/linus/.rvm/gems/ruby-2.0.0-p247@global/gems/rspec-core-2.14.8/lib/rspec/core/runner.rb:17:in `block in autorun' /users/linus/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require' /users/linus/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
the strange thing everyting works in console.
$ rails c [1] pry(main)> worker::station::http => worker::station::http
why happening using rspec , not in rails , how fix it?
i'm using
- rails (4.0.4)
- rspec (2.14.1)
the app/workers
path not being autoloaded rspec because not standard rails layout, can add autoload line spec_helper or require file in spec directly!
Comments
Post a Comment