Here is what my rakefile looks like
gem 'rspec', '~>3' require 'rspec/core/rake_task' task :default => :spec desc "run tests for this app" RSpec::Core::RakeTask.new do |task| test_dir = Rake.application.original_dir task.pattern = "#{test_dir}/*_spec.rb" task.rspec_opts = [ "-I#{test_dir}", "-I#{test_dir}/source", '-f documentation', '-r ./rspec_config'] task.verbose = false end
You can "rake" from your test directory, and it will run all the tests with the name [something] _spec.rb - and it should work in different test directories (for example, in different projects); if you have the source in a separate directory (for example, in the code above, a subdirectory called "/ source", it will pick them up. Obviously, you can change this source directory to whatever you want.
Here's the rspec_config file I'm using, you can add your own settings here:
RSpec.configure do |c| c.fail_fast = true c.color = true end
source share