diaspora/lib/tasks/ci.rake
Steven Hancock 95d5c9ca68 Fix Jasmine tests - first pass
193 specs | 5 failing

The 5 failing specs appear (according to Firebug) to be due to missing
fixtures and/or missing routes in the Jasmine environment. Fixing these
last 5 failures is a task probably best left to a more experienced
Javascript/Jasmine developer.

This commit also moves validation.js and clear-form.js into
app/assets/javascripts and precompiles validation.js
2012-03-27 18:08:27 -07:00

45 lines
1.5 KiB
Ruby

namespace :ci do
desc "Run tests in the cloud. ZOMG!"
task :travis do
if ENV['BUILD_TYPE'] == 'cucumber'
puts "Running cucumber features..."
system("export DISPLAY=:99.0 && bundle exec rake cucumber")
raise "Cucumber failed!" unless $?.exitstatus == 0
else
["rake generate_fixtures", "rake spec"].each do |cmd|
puts "Running bundle exec #{cmd}..."
system("bundle exec #{cmd}")
raise "#{cmd} failed!" unless $?.exitstatus == 0
end
["rake jasmine:ci", "rake cucumber"].each do |cmd|
puts "Running bundle exec #{cmd}..."
system("export DISPLAY=:99.0 && GROUP=oauth bundle exec #{cmd}")
raise "#{cmd} failed!" unless $?.exitstatus == 0
end
end
end
desc "Run tests that can't run on travis"
task :hard_things => [:environment, :'ci:migrate'] do
puts "Starting virtual display..."
`sh -e /etc/init.d/xvfb start`
puts "Starting specs..."
system('export DISPLAY=:99.0 && CI=true bundle exec rake cucumber')
exit_status = $?.exitstatus
puts "Stopping virtual display..."
`sh -e /etc/init.d/xvfb stop`
puts "Cleaning up..."
FileUtils.rm_rf("#{Rails.root}/public/uploads/images")
FileUtils.rm_rf("#{Rails.root}/public/uploads/tmp")
raise "tests failed!" unless exit_status == 0
puts "All tests passed!"
end
task :migrate => ['db:drop', 'db:create', 'db:schema:load'] do
system('bundle exec rake db:test:prepare')
raise "migration failed!" unless $?.exitstatus == 0
end
end
task :travis => "ci:travis"