Skip to content

Commit

Permalink
Setting up MySQL in the Travis CI test enviro.
Browse files Browse the repository at this point in the history
  • Loading branch information
bouchard committed Mar 7, 2012
1 parent a884dcb commit 10da60b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
language: ruby
before_script:
- "mysql -e 'create database thumbs_up_test;'"
22 changes: 15 additions & 7 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,21 @@

require 'active_record'

config = {
:adapter => 'mysql2',
:database => 'thumbs_up_test',
:username => 'test',
:password => 'test',
:socket => '/tmp/mysql.sock'
}
if ENV['TRAVIS']
config = {
:adapter => 'mysql2',
:database => 'thumbs_up_test',
:username => 'root'
}
else
config = {
:adapter => 'mysql2',
:database => 'thumbs_up_test',
:username => 'test',
:password => 'test',
:socket => '/tmp/mysql.sock'
}
end

ActiveRecord::Base.establish_connection(config)
ActiveRecord::Base.connection.drop_database config[:database] rescue nil
Expand Down

0 comments on commit 10da60b

Please sign in to comment.