Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

file 69 lines (58 sloc) 2.033 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
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]
Something went wrong with that request. Please try again.