travisci 'LoadError: cannot load such file -- rspec/core/rake_task'
This is quite a frustrating error which can be fixed easily. Whilst experimenting with a project I found that two main things can make a difference:
1. .travis.yml
If your travis config file is not configured correctly then it may not be running bundler correctly. Here is our old bundler config:
install: bundle install --without development --deployment --jobs=3 --retry=3
cache:
directories:
- vendor/bundle
2. Gemfile
Because this was such a basic error I didn't even think to look in the Gemfile. The rspec-rails
gem was in the development group. So you can probably guess what was happening.
When travis did it's thing it wasn't including rspec in the bundle. Therefore it couldn't pick up the rspec rake task file.
As a footnote to this, we also found that adding a task in lib\tasks\spec.rb
helped. Below is a basic task for when travis won't load 'default':
## Required if CI fails default task
require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new
task :default => :spec
Written by Tom Cox
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Ruby
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#