Skip to content

Commit

Permalink
Merge pull request #45 from ariejan/multi-db
Browse files Browse the repository at this point in the history
Run travis against MySQL, Postgres and Sqlite
  • Loading branch information
ariejan committed Nov 11, 2012
2 parents ed11d47 + c19201f commit 88b2fc2
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 2 deletions.
12 changes: 10 additions & 2 deletions .travis.yml
Expand Up @@ -3,8 +3,16 @@ language: ruby
rvm:
- 1.9.2

env:
- DB=sqlite
- DB=mysql
- DB=postgres

before_script:
- "cp config/database.travis.yml config/database.yml"
- "psql -c 'create database firefly_test;' -U postgres"
- "cp config/database.$DB.travis.yml config/database.yml"

- sh -c "if [ '$DB' = 'postgres' ]; then psql -c 'create database firefly_test;' -U postgres; fi"
- sh -c "if [ '$DB' = 'mysql' ]; then mysql -e 'create database firefly_test;'; fi"

- "RACK_ENV=test bundle exec rake db:migrate"

3 changes: 3 additions & 0 deletions Gemfile
Expand Up @@ -5,6 +5,9 @@ gem 'haml', '~> 3.0.18'
gem 'escape_utils', '~> 0.2.3'

gem 'pg'
gem 'mysql2'
gem 'sqlite3'

gem 'sinatra-activerecord', '~> 1.1.2'

group :development, :test do
Expand Down
4 changes: 4 additions & 0 deletions Gemfile.lock
Expand Up @@ -35,6 +35,7 @@ GEM
haml (3.0.25)
i18n (0.6.1)
multi_json (1.3.7)
mysql2 (0.3.11)
pg (0.14.1)
rack (1.4.1)
rack-protection (1.2.0)
Expand All @@ -57,6 +58,7 @@ GEM
sinatra-activerecord (1.1.2)
activerecord (~> 3.0)
sinatra (~> 1.0)
sqlite3 (1.3.6)
tilt (1.3.3)
tzinfo (0.3.35)

Expand All @@ -68,9 +70,11 @@ DEPENDENCIES
dm-sqlite-adapter (~> 1.0.2)
escape_utils (~> 0.2.3)
haml (~> 3.0.18)
mysql2
pg
rack-test (~> 0.6)
rake (~> 0.9.2)
rspec (~> 2.11)
sinatra (~> 1.3)
sinatra-activerecord (~> 1.1.2)
sqlite3
6 changes: 6 additions & 0 deletions config/database.mysql.travis.yml
@@ -0,0 +1,6 @@
test:
adapter: mysql2
database: firefly_test
username:
encoding: utf8

Expand Up @@ -2,3 +2,4 @@ test:
adapter: postgresql
database: firefly_test
username: postgres

4 changes: 4 additions & 0 deletions config/database.sqlite.travis.yml
@@ -0,0 +1,4 @@
test:
adapter: sqlite3
database: test.db
timeout: 500

0 comments on commit 88b2fc2

Please sign in to comment.