Caboose does its testing with rspec. Since we want you to test your own code, we'll be getting you to set up rspec in your own application and then pull in all the caboose tests. This will test caboose using your own data.
Add the following lines to your Gemfile:
group :development, :test do
gem 'rspec'
gem 'rspec-rails'
gem 'factory_girl_rails'
end
group :test do
gem 'faker'
gem 'capybara'
gem 'guard-rspec'
gem 'launchy'
end
Download and install the gems.
bundle install
Initialize the spec directory.
rails generate rspec:install
Edit the new .rspec file that was created to include the following:
--color
--require rails_helper
--format documentation
Edit the new spec/rails_helper.rb file that was created to have the following:
ENV["RAILS_ENV"] ||= 'test'
require 'spec_helper'
require File.expand_path("../../config/environment", __FILE__)
require 'rspec/rails'
require "capybara/rspec"
require 'factory_girl_rails'
require 'caboose'
# Pull in all the caboose tests
Dir["#{Caboose.root}/spec/**/*.rb"].each { |f| require f }
RSpec.configure do |config|
config.fixture_path = "#{::Rails.root}/spec/fixtures"
config.use_transactional_fixtures = true
config.infer_spec_type_from_file_location!
end
If necessary, copy down the production database to the development database.
rake caboose:sync:p2d
Now run all the tests.
rake