Fix SimpleCov setup in micro-tests when COVERAGE is not set
[gitorious:mainline.git] / bin / micro-tests
1 #!/usr/bin/env ruby
2
3 require "pathname"
4 rails_root = Pathname(__FILE__) + "../../"
5
6 Dir.chdir(rails_root)
7
8 require "./test/coverage_helper"
9
10 if ENV['COVERAGE']
11   SimpleCov.command_name 'Unit Tests'
12 end
13
14 if ARGV.length > 0
15   tests = ARGV.map { |a| "test/micro/#{a}_test.rb" }.join(" ")
16 else
17   tests = Dir.glob("test/micro/**/*.rb").join(" ")
18 end
19
20 command = "bundle exec \"ruby -I.:app:app/presenters:lib:test -e '%w[#{tests}].each { |t| require(t) }'\""
21 puts command
22 system command