I had to modify rake test to run tests without migration dependencies. My script after modification looked as following:
desc 'Test all units and functionals'
task :run_customized_test do
exceptions = ["custom_test:units","custom_test:functionals","custom_test:integration","custom_test:rcov"].collect do |task|
begin
Rake::Task[task].invoke
nil
rescue => e
e
end
end.compact
exceptions.each {|e| puts e;puts e.backtrace }
raise "Test failures" unless exceptions.empty?
end
namespace :custom_test do
#UNITS
Rake::TestTask.new(:units) do |t|
t.libs << "test"
t.pattern = 'test/unit/**/*_test.rb'
t.verbose = true
end
Rake::Task['custom_test:units'].comment = "Run the unit tests in test/unit without migrations"
#FUNCTIONALS
Rake::TestTask.new(:functionals) do |t|
t.libs << "test"
t.pattern = 'test/functional/**/*_test.rb'
t.verbose = true
end
Rake::Task['custom_test:functionals'].comment = "Run the functional tests in test/functional without migrations"
#INTEGRATION
Rake::TestTask.new(:integration) do |t|
t.libs << "test"
t.pattern = 'test/integration/**/*_test.rb'
t.verbose = true
end
Rake::Task['custom_test:integration'].comment = "Run the integration tests in test/integration without migrations"
#This task was redesigned by my coworker Krishna Kotecha
desc "Run the ruby coverrage for your project"
task :rcov do
output_folder = "."
rm_f output_folder
rm_f "coverage.data"
rcov = "rcov --rails --aggregate coverage.data --text-summary -Ilib"
system("#{rcov} --no-html test/unit/*_test.rb")
system("#{rcov} --no-html test/unit/helpers/*_test.rb")
system("#{rcov} --no-html test/functional/*_test.rb")
system("#{rcov} --output=#{output_folder} --sort=coverage --html test/integration/*_test.rb")
end
end
Also, there is an rcov taks wich will generate ruby coverage and store it in public folder under ProjectName folder. This task is customized for cc.rb you might need to change the path.