Rails, using rspec to run one file - ruby-on-rails

I want to run an rspec test on one file.
I have tried various methods such as
rspec path/to/spec/file.rb
rake spec SPEC=spec/controllers/sessions_controller_spec.rb
bundle exec rspec path/to/spec/file.rb
But all of them give me this error:
.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/rack-2.0.3/lib/rack/builder.rb:146:in `to_app': missing run or map statement (RuntimeError)
from /home/jay/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/rack-2.0.3/lib/rack/builder.rb:160:in `block in generate_map'
from /home/jay/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/rack-2.0.3/lib/rack/builder.rb:160:in `each'
from /home/jay/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/rack-2.0.3/lib/rack/builder.rb:160:in `generate_map'
from /home/jay/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/rack-2.0.3/lib/rack/builder.rb:145:in `to_app'
from /home/jay/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/capybara-2.16.1/lib/capybara/rails.rb:13:in `<top (required)>'
from /home/jay/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:in `require'
from /home/jay/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:in `block in require'
from /home/jay/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:258:in `load_dependency'
from /home/jay/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:in `require'
from /home/jay/Sites/New Folder/pg/scheduler/spec/spec_helper.rb:19:in `<top (required)>'
from /home/jay/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/rspec-core-3.7.0/lib/rspec/core/configuration.rb:1455:in `require'
from /home/jay/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/rspec-core-3.7.0/lib/rspec/core/configuration.rb:1455:in `block in requires='
from /home/jay/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/rspec-core-3.7.0/lib/rspec/core/configuration.rb:1455:in `each'
from /home/jay/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/rspec-core-3.7.0/lib/rspec/core/configuration.rb:1455:in `requires='
from /home/jay/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/rspec-core-3.7.0/lib/rspec/core/configuration_options.rb:112:in `block in process_options_into'
from /home/jay/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/rspec-core-3.7.0/lib/rspec/core/configuration_options.rb:111:in `each'
from /home/jay/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/rspec-core-3.7.0/lib/rspec/core/configuration_options.rb:111:in `process_options_into'
from /home/jay/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/rspec-core-3.7.0/lib/rspec/core/configuration_options.rb:21:in `configure'
from /home/jay/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/rspec-core-3.7.0/lib/rspec/core/runner.rb:99:in `setup'
from /home/jay/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/rspec-core-3.7.0/lib/rspec/core/runner.rb:86:in `run'
from /home/jay/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/rspec-core-3.7.0/lib/rspec/core/runner.rb:71:in `run'
from /home/jay/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/rspec-core-3.7.0/lib/rspec/core/runner.rb:45:in `invoke'
from /home/jay/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/rspec-core-3.7.0/exe/rspec:4:in `<main>'
How do I run an rspec test on one file?

I tried :
ruby -I test test/unit/my_model_test.rb
and it worked for me let me know if it helped you

Related

How to fix 'rails aborted' error when running "rails db:create db:migrate "?

This is the error message I get:
rails aborted!
LoadError: cannot load such file -- active_record/railties/databases.rake
/Users/Prodigy/.rvm/gems/ruby-2.5.3/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:69:in `load'
/Users/Prodigy/.rvm/gems/ruby-2.5.3/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:69:in `rescue in load'
/Users/Prodigy/.rvm/gems/ruby-2.5.3/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:52:in `load'
/Users/Prodigy/.rvm/gems/ruby-2.5.3/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:285:in `block in load'
/Users/Prodigy/.rvm/gems/ruby-2.5.3/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:257:in `load_dependency'
/Users/Prodigy/.rvm/gems/ruby-2.5.3/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:285:in `load'
/Users/Prodigy/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.3/lib/active_record/railtie.rb:49:in `block in <class:Railtie>'
/Users/Prodigy/.rvm/gems/ruby-2.5.3/gems/railties-5.2.3/lib/rails/railtie.rb:246:in `instance_exec'
/Users/Prodigy/.rvm/gems/ruby-2.5.3/gems/railties-5.2.3/lib/rails/railtie.rb:246:in `block in run_tasks_blocks'
/Users/Prodigy/.rvm/gems/ruby-2.5.3/gems/railties-5.2.3/lib/rails/railtie.rb:255:in `each'
/Users/Prodigy/.rvm/gems/ruby-2.5.3/gems/railties-5.2.3/lib/rails/railtie.rb:255:in `each_registered_block'
/Users/Prodigy/.rvm/gems/ruby-2.5.3/gems/railties-5.2.3/lib/rails/railtie.rb:246:in `run_tasks_blocks'
/Users/Prodigy/.rvm/gems/ruby-2.5.3/gems/railties-5.2.3/lib/rails/application.rb:514:in `block in run_tasks_blocks'
/Users/Prodigy/.rvm/gems/ruby-2.5.3/gems/railties-5.2.3/lib/rails/engine/railties.rb:15:in `each'
/Users/Prodigy/.rvm/gems/ruby-2.5.3/gems/railties-5.2.3/lib/rails/engine/railties.rb:15:in `each'
/Users/Prodigy/.rvm/gems/ruby-2.5.3/gems/railties-5.2.3/lib/rails/application.rb:514:in `run_tasks_blocks'
/Users/Prodigy/.rvm/gems/ruby-2.5.3/gems/railties-5.2.3/lib/rails/engine.rb:459:in `load_tasks'
/Users/Prodigy/code/PierceF/conqueredtime/Rakefile:6:in `<top (required)>'
/Users/Prodigy/.rvm/gems/ruby-2.5.3/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:54:in `load'
/Users/Prodigy/.rvm/gems/ruby-2.5.3/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:54:in `load'
/Users/Prodigy/.rvm/gems/ruby-2.5.3/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:285:in `block in load'
/Users/Prodigy/.rvm/gems/ruby-2.5.3/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:257:in `load_dependency'
/Users/Prodigy/.rvm/gems/ruby-2.5.3/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:285:in `load'
/Users/Prodigy/.rvm/gems/ruby-2.5.3/gems/railties-5.2.3/lib/rails/commands/rake/rake_command.rb:22:in `block in perform'
/Users/Prodigy/.rvm/gems/ruby-2.5.3/gems/railties-5.2.3/lib/rails/commands/rake/rake_command.rb:20:in `perform'
/Users/Prodigy/.rvm/gems/ruby-2.5.3/gems/railties-5.2.3/lib/rails/command.rb:48:in `invoke'
/Users/Prodigy/.rvm/gems/ruby-2.5.3/gems/railties-5.2.3/lib/rails/commands.rb:18:in `<top (required)>'
/Users/Prodigy/.rvm/gems/ruby-2.5.3/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require'
/Users/Prodigy/.rvm/gems/ruby-2.5.3/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `block in require_with_bootsnap_lfi'
/Users/Prodigy/.rvm/gems/ruby-2.5.3/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
/Users/Prodigy/.rvm/gems/ruby-2.5.3/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require_with_bootsnap_lfi'
/Users/Prodigy/.rvm/gems/ruby-2.5.3/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
/Users/Prodigy/.rvm/gems/ruby-2.5.3/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:291:in `block in require'
/Users/Prodigy/.rvm/gems/ruby-2.5.3/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:257:in `load_dependency'
/Users/Prodigy/.rvm/gems/ruby-2.5.3/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:291:in `require'
/Users/Prodigy/code/PierceF/conqueredtime/bin/rails:9:in `<top (required)>'
/Users/Prodigy/.rvm/gems/ruby-2.5.3/gems/spring-2.1.0/lib/spring/client/rails.rb:28:in `load'
/Users/Prodigy/.rvm/gems/ruby-2.5.3/gems/spring-2.1.0/lib/spring/client/rails.rb:28:in `call'
/Users/Prodigy/.rvm/gems/ruby-2.5.3/gems/spring-2.1.0/lib/spring/client/command.rb:7:in `call'
/Users/Prodigy/.rvm/gems/ruby-2.5.3/gems/spring-2.1.0/lib/spring/client.rb:30:in `run'
/Users/Prodigy/.rvm/gems/ruby-2.5.3/gems/spring-2.1.0/bin/spring:49:in `<top (required)>'
/Users/Prodigy/.rvm/gems/ruby-2.5.3/gems/spring-2.1.0/lib/spring/binstub.rb:11:in `load'
/Users/Prodigy/.rvm/gems/ruby-2.5.3/gems/spring-2.1.0/lib/spring/binstub.rb:11:in `<top (required)>'
/Users/Prodigy/code/PierceF/conqueredtime/bin/spring:15:in `require'
/Users/Prodigy/code/PierceF/conqueredtime/bin/spring:15:in `<top (required)>'
bin/rails:3:in `load'
bin/rails:3:in `<main>'
Caused by:
Bootsnap::LoadPathCache::FallbackScan:
(See full trace by running task with --trace)
I also tried bundle exec rails db:create db:migrate but that still had no effect.
Since I was having this error only with this rails project and not the others, I thought maybe I'll try starting a brand new rails project and copy-paste the code/files from the older project into this new one. That fixed the issue! I guess since this is a small app I was able to get away with it.

Error installing rails api with postgresql

I am trying to build a skeleton rails-api to use for future use but keep coming across an error. So i am in a folder call Rails_API_Skeleton and i run..
gem install rails-api
Which runs fine.
I then run...
rails-api new Skeleton_App -d postgresql -T
Which also runs without any issues. So i...
cd Skeleton_App/
then run...
bin/rake db:create
And get the following error, which after much googling i cant figure out how to resolve.
/Users/username/.rvm/gems/ruby-2.2.2/gems/bundler-1.12.5/lib/bundler/runtime.rb:89:in `rescue in block (2 levels) in require': There was an error while trying to load the gem 'rails-api'.
Gem Load Error is: uninitialized constant ActionController::API::RackDelegation
Backtrace for gem load error is:
/Users/username/.rvm/gems/ruby-2.2.2/gems/rails-api-0.4.0/lib/rails-api/action_controller/api.rb:131:in `<class:API>'
/Users/username/.rvm/gems/ruby-2.2.2/gems/rails-api-0.4.0/lib/rails-api/action_controller/api.rb:85:in `<module:ActionController>'
/Users/username/.rvm/gems/ruby-2.2.2/gems/rails-api-0.4.0/lib/rails-api/action_controller/api.rb:5:in `<top (required)>'
/Users/username/.rvm/gems/ruby-2.2.2/gems/rails-api-0.4.0/lib/rails-api.rb:3:in `require'
/Users/username/.rvm/gems/ruby-2.2.2/gems/rails-api-0.4.0/lib/rails-api.rb:3:in `<top (required)>'
/Users/username/.rvm/gems/ruby-2.2.2/gems/bundler-1.12.5/lib/bundler/runtime.rb:86:in `require'
/Users/username/.rvm/gems/ruby-2.2.2/gems/bundler-1.12.5/lib/bundler/runtime.rb:86:in `block (2 levels) in require'
/Users/username/.rvm/gems/ruby-2.2.2/gems/bundler-1.12.5/lib/bundler/runtime.rb:81:in `each'
/Users/username/.rvm/gems/ruby-2.2.2/gems/bundler-1.12.5/lib/bundler/runtime.rb:81:in `block in require'
/Users/username/.rvm/gems/ruby-2.2.2/gems/bundler-1.12.5/lib/bundler/runtime.rb:70:in `each'
/Users/username/.rvm/gems/ruby-2.2.2/gems/bundler-1.12.5/lib/bundler/runtime.rb:70:in `require'
/Users/username/.rvm/gems/ruby-2.2.2/gems/bundler-1.12.5/lib/bundler.rb:102:in `require'
/Users/username/Desktop/Apple_tv_movies_and_stuff/skeletons/Rails_API_Skeleton/Skeleton_App/config/application.rb:17:in `<top (required)>'
/Users/username/.rvm/gems/ruby-2.2.2/gems/spring-1.7.2/lib/spring/application.rb:82:in `require'
/Users/username/.rvm/gems/ruby-2.2.2/gems/spring-1.7.2/lib/spring/application.rb:82:in `preload'
/Users/username/.rvm/gems/ruby-2.2.2/gems/spring-1.7.2/lib/spring/application.rb:143:in `serve'
/Users/username/.rvm/gems/ruby-2.2.2/gems/spring-1.7.2/lib/spring/application.rb:131:in `block in run'
/Users/username/.rvm/gems/ruby-2.2.2/gems/spring-1.7.2/lib/spring/application.rb:125:in `loop'
/Users/username/.rvm/gems/ruby-2.2.2/gems/spring-1.7.2/lib/spring/application.rb:125:in `run'
/Users/username/.rvm/gems/ruby-2.2.2/gems/spring-1.7.2/lib/spring/application/boot.rb:19:in `<top (required)>'
/Users/username/.rvm/rubies/ruby-2.2.2/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
/Users/username/.rvm/rubies/ruby-2.2.2/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
-e:1:in `<main>'
Bundler Error Backtrace:
(Bundler::GemRequireError)
from /Users/username/.rvm/gems/ruby-2.2.2/gems/bundler-1.12.5/lib/bundler/runtime.rb:85:in `block (2 levels) in require'
from /Users/username/.rvm/gems/ruby-2.2.2/gems/bundler-1.12.5/lib/bundler/runtime.rb:81:in `each'
from /Users/username/.rvm/gems/ruby-2.2.2/gems/bundler-1.12.5/lib/bundler/runtime.rb:81:in `block in require'
from /Users/username/.rvm/gems/ruby-2.2.2/gems/bundler-1.12.5/lib/bundler/runtime.rb:70:in `each'
from /Users/username/.rvm/gems/ruby-2.2.2/gems/bundler-1.12.5/lib/bundler/runtime.rb:70:in `require'
from /Users/username/.rvm/gems/ruby-2.2.2/gems/bundler-1.12.5/lib/bundler.rb:102:in `require'
from /Users/username/Desktop/Apple_tv_movies_and_stuff/skeletons/Rails_API_Skeleton/Skeleton_App/config/application.rb:17:in `<top (required)>'
from /Users/username/.rvm/gems/ruby-2.2.2/gems/spring-1.7.2/lib/spring/application.rb:82:in `require'
from /Users/username/.rvm/gems/ruby-2.2.2/gems/spring-1.7.2/lib/spring/application.rb:82:in `preload'
from /Users/username/.rvm/gems/ruby-2.2.2/gems/spring-1.7.2/lib/spring/application.rb:143:in `serve'
from /Users/username/.rvm/gems/ruby-2.2.2/gems/spring-1.7.2/lib/spring/application.rb:131:in `block in run'
from /Users/username/.rvm/gems/ruby-2.2.2/gems/spring-1.7.2/lib/spring/application.rb:125:in `loop'
from /Users/username/.rvm/gems/ruby-2.2.2/gems/spring-1.7.2/lib/spring/application.rb:125:in `run'
from /Users/username/.rvm/gems/ruby-2.2.2/gems/spring-1.7.2/lib/spring/application/boot.rb:19:in `<top (required)>'
from /Users/username/.rvm/rubies/ruby-2.2.2/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /Users/username/.rvm/rubies/ruby-2.2.2/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from -e:1:in `<main>'
Thanks for any help in advance
I suspect something changed with the gem in response to Rails 5.
Maybe its use is deprecated now?
Anyway, the new Rails API way seems to be
http://edgeguides.rubyonrails.org/api_app.html
rails new skeleton_api --api

Rails Test Failing

I keep getting these errors on terminal whenever i run the following code.
rake test or bundle exec rake test
/usr/local/lib/ruby/gems/2.2.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in `require': cannot load such file -- guard (LoadError)
from /usr/local/lib/ruby/gems/2.2.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in `block in require'
from /usr/local/lib/ruby/gems/2.2.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:240:in `load_dependency'
from /usr/local/lib/ruby/gems/2.2.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in `require'
from /usr/local/lib/ruby/gems/2.2.0/gems/guard-minitest-2.4.4/lib/minitest/guard_minitest_plugin.rb:4:in `<top (required)>'
from /usr/local/lib/ruby/gems/2.2.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in `require'
from /usr/local/lib/ruby/gems/2.2.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in `block in require'
from /usr/local/lib/ruby/gems/2.2.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:240:in `load_dependency'
from /usr/local/lib/ruby/gems/2.2.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in `require'
from /usr/local/lib/ruby/gems/2.2.0/gems/minitest-5.5.1/lib/minitest.rb:91:in `block in load_plugins'
from /usr/local/lib/ruby/gems/2.2.0/gems/minitest-5.5.1/lib/minitest.rb:85:in `each'
from /usr/local/lib/ruby/gems/2.2.0/gems/minitest-5.5.1/lib/minitest.rb:85:in `load_plugins'
from /usr/local/lib/ruby/gems/2.2.0/gems/minitest-5.5.1/lib/minitest.rb:114:in `run'
from /usr/local/lib/ruby/gems/2.2.0/gems/minitest-5.5.1/lib/minitest.rb:56:in `block in autorun'
Looks like guard is not installed/included in Gemfile. Include it in Gemfile if it is not already there. And run bundle install.
See http://railscasts.com/episodes/264-guard for how to use guard. https://github.com/guard/guard is also a good resource.

Loaderror: cannot find such file

Hi i have just started making an app on ruby on rails and i have problems writing my spec files.
i ran bundle exec rspec spec/controllers/api/user_controller_spec.rb but it gave me the error:
/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'
EDIT: when i ran bundle exec rspec spec they gave me the following error:
/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'
can anyone shed some light on this? what does it mean?
It looks like it cannot find the file spec/controllers/api/user_controller_spec.rb
Try to rename your spec file into users_controller_spec.rb

Running command on heroku console from a rake task

I'm trying to run a heroku console command from a rake task, so my approach is to try to do it all on one line.
Note that this works
heroku run console
Rails.cache.clear
Here is my rake task:
task :setup_staging_env do
sh "heroku run console Rails.cache.clear"
end
But this fails. So to simplify I tried just that command on the command line and get this:
heroku run console Rails.cache.clear
Running console Rails.cache.clear attached to terminal... up, run.1
You did not specify how you would like Rails to report deprecation notices for your Rails.cache.clear environment, please set config.active_support.deprecation to :log, :notify or :stderr at config/environments/Rails.cache.clear.rb
/usr/local/lib/ruby/1.9.1/uri/common.rb:156:in `split': bad URI(is not URI?): (URI::InvalidURIError)
from /usr/local/lib/ruby/1.9.1/uri/common.rb:174:in `parse'
from /usr/local/lib/ruby/1.9.1/uri/common.rb:628:in `parse'
from /app/config/initializers/resque.rb:2:in `<top (required)>'
from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:234:in `load'
from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:234:in `block in load'
from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:223:in `block in load_dependency'
from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:640:in `new_constants_in'
from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:223:in `load_dependency'
from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:234:in `load'
from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.1.3/lib/rails/engine.rb:556:in `block (2 levels) in <class:Engine>'
from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.1.3/lib/rails/engine.rb:555:in `each'
from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.1.3/lib/rails/engine.rb:555:in `block in <class:Engine>'
from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.1.3/lib/rails/initializable.rb:30:in `instance_exec'
from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.1.3/lib/rails/initializable.rb:30:in `run'
from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.1.3/lib/rails/initializable.rb:55:in `block in run_initializers'
from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.1.3/lib/rails/initializable.rb:54:in `each'
from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.1.3/lib/rails/initializable.rb:54:in `run_initializers'
from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.1.3/lib/rails/application.rb:96:in `initialize!'
from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.1.3/lib/rails/railtie/configurable.rb:30:in `method_missing'
from /app/config/environment.rb:6:in `<top (required)>'
from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:240:in `require'
from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:240:in `block in require'
from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:223:in `block in load_dependency'
from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:640:in `new_constants_in'
from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:223:in `load_dependency'
from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:240:in `require'
from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.1.3/lib/rails/application.rb:83:in `require_environment!'
from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.1.3/lib/rails/commands.rb:39:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
So how can I run this command from a rake task?

Resources