Skip to content

Instantly share code, notes, and snippets.

@joakimk

joakimk/testbot.rake

Created Nov 25, 2010
Embed
What would you like to do?
namespace :testbot do
task :before_request do
# This is run after you start a request (ex: rake testbot:spec)
end
task :before_run do
# This is run by the runner after files are synced but before tests are run
# Example: Setting up a test database
database_yml = <<-DB_CONFIG
test:
adapter: mysql
encoding: utf8
database: PROJECT_NAME_testbot_test<%= ENV['TEST_ENV_NUMBER'] %>
username: root
password:
host: localhost
DB_CONFIG
# database_file_path = "config/database.yml"
# File.open(database_file_path, 'w') { |f| f.write(database_yml) }
#
# # Setup databases for all instances
# 0.upto(ENV['TEST_INSTANCES'].to_i - 1) do |instance|
# test_env_number = (instance == 0) ? '' : instance + 1
# system "mysqladmin -u root -f drop PROJECT_NAME_testbot_test#{test_env_number} > /dev/null 2>&1"
# system "mysqladmin -u root -f create PROJECT_NAME_testbot_test#{test_env_number} > /dev/null 2>&1"
# system "export RAILS_ENV=test; export TEST_ENV_NUMBER=#{test_env_number}; rake db:test:load"
# end
# Example: Building gems
# system "rm vendor/gems/*/ext/**/*.o > /dev/null 2>&1"
# system "rake gems:build:force > /dev/null 2>&1"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment