rspec-autotest
provides integration between autotest and RSpec; Autotest is not included
in this gem and can be installed via the autotest-standalone
or zentest
gems.
RSpec Autotest ships with a specialized subclass of Autotest. To use it, just add a
.rspec
file to your project's root directory, and run the autotest
command
as normal:
$ autotest
The autotest
command generates a shell command that runs your specs. If you
are using Bundler, and you want the shell command to include bundle exec
,
require the Autotest bundler plugin in a .autotest
file in the project's root
directory or your home directory:
# in .autotest
require "autotest/bundler"
To use RSpec and Rails with autotest, bring in the autotest-rails
gem:
# Gemfile
gem 'autotest-rails', :group => [:development, :test]
autotest
will now autodetect RSpec and Rails after you run the rails generate rspec:install
command.
This happens if you're using rspec-3.x + rspec-autotest-1.x and you still have rspec-core-2.x installed. You have two options to resolve this issue:
- Uninstall rspec-core-2.x (or remove it from the current gemset if you use a tool that supports gemsets).
- Pass a
--style
flag to theautotest
executable, which should resolve the version of rspec correctly to 3.x:
autotest --style rspec
The --tty
option was added in rspec-core-2.2.1, and is used
internally by RSpec. If you see an error citing it as an invalid option, you'll
probably see there are two or more versions of rspec-core in the backtrace: one
< 2.2.1 and one >= 2.2.1.
This usually happens because you have a newer rspec-core installed, and an older rspec-core specified in a Bundler Gemfile. If this is the case, you can:
- specify the newer version in the Gemfile (recommended)
- prefix the
autotest
command withbundle exec
Add this line to your application's Gemfile:
gem 'rspec-autotest'
And then execute:
$ bundle
Or install it yourself as:
$ gem install rspec-autotest
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request