1
0
Fork 0
mirror of https://github.com/thoughtbot/shoulda-matchers.git synced 2022-11-09 12:01:38 -05:00
thoughtbot--shoulda-matchers/Rakefile

70 lines
2 KiB
Ruby

require 'rubygems'
require 'rake'
require 'rake/testtask'
require 'rake/rdoctask'
require 'rake/gempackagetask'
require 'cucumber/rake/task'
$LOAD_PATH.unshift("lib")
require 'shoulda/version'
load 'tasks/shoulda.rake'
# Test::Unit::UI::VERBOSE
test_files_pattern = 'test/{unit,functional,other,matchers}/**/*_test.rb'
Rake::TestTask.new do |t|
t.libs << 'lib' << 'test'
t.pattern = test_files_pattern
t.verbose = false
end
Rake::RDocTask.new { |rdoc|
rdoc.rdoc_dir = 'doc'
rdoc.title = "Shoulda -- Making tests easy on the fingers and eyes"
rdoc.options << '--line-numbers'
rdoc.template = "#{ENV['template']}.rb" if ENV['template']
rdoc.rdoc_files.include('README.rdoc', 'CONTRIBUTION_GUIDELINES.rdoc', 'lib/**/*.rb')
}
desc "Run code-coverage analysis using rcov"
task :coverage do
rm_rf "coverage"
files = Dir[test_files_pattern]
system "rcov --rails --sort coverage -Ilib #{files.join(' ')}"
end
eval("$specification = begin; #{IO.read('shoulda.gemspec')}; end")
Rake::GemPackageTask.new $specification do |pkg|
pkg.need_tar = true
pkg.need_zip = true
end
desc "Clean files generated by rake tasks"
task :clobber => [:clobber_rdoc, :clobber_package]
namespace :cucumber do
Cucumber::Rake::Task.new(:rails2, "Run the cucumber features in Rails 2") do |t|
t.fork = true
t.cucumber_opts = ['--format', (ENV['CUCUMBER_FORMAT'] || 'progress')]
t.profile = 'rails2'
end
Cucumber::Rake::Task.new(:rails3, "Run the cucumber features in Rails 3") do |t|
t.fork = true
t.cucumber_opts = ['--format', (ENV['CUCUMBER_FORMAT'] || 'progress')]
t.profile = 'rails3'
end
end
desc "Run the cucumber features in both Rails 2 and 3"
task :cucumber => ["cucumber:rails2", "cucumber:rails3"]
desc 'run tests for all supported versions of Rails'
task :test_all do
%w(2.3.8 3.0.0.beta4).each do |version|
system("RAILS_VERSION=#{version} rake -s test;")
end
end
desc 'Default: run test and cucumber features for support versions'
task :default => [:test_all, :cucumber]