How to organize rspec 2 tests into 'unit' (fast) and 'integration' (slow) categories?
rspec
command, but not the 'integration' tests. We have groups of the same nature. We run then one by one both on the local dev boxes and on the CI.
you can simply do
bundle exec rake spec:unit
bundle exec rake spec:integration
bundle exec rake spec:api
This is what our spec.rake looks like
namespace :spec do
RSpec::Core::RakeTask.new(:unit) do |t|
t.pattern = Dir['spec/*/**/*_spec.rb'].reject{ |f| f['/api/v1'] || f['/integration'] }
end
RSpec::Core::RakeTask.new(:api) do |t|
t.pattern = "spec/*/{api/v1}*/**/*_spec.rb"
end
RSpec::Core::RakeTask.new(:integration) do |t|
t.pattern = "spec/integration/**/*_spec.rb"
end
end
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With