Skip to content

Commit

Permalink
Run Travis tests on Postgres.
Browse files Browse the repository at this point in the history
  • Loading branch information
jcoglan committed Oct 25, 2012
1 parent 42cc355 commit 2a36af3
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
12 changes: 10 additions & 2 deletions .travis.yml
Expand Up @@ -14,16 +14,24 @@ gemfile:

env:
- DB=mysql
- DB=postgres

matrix:
exclude:
- rvm: 1.9.2
- rvm: 1.9.2
gemfile: gemfiles/activerecord_2_2.gemfile
env: DB=mysql
- rvm: 1.9.3
gemfile: gemfiles/activerecord_2_2.gemfile
env: DB=mysql
- rvm: 1.9.2
gemfile: gemfiles/activerecord_2_2.gemfile
env: DB=postgres
- rvm: 1.9.3
gemfile: gemfiles/activerecord_2_2.gemfile
env: DB=postgres

before_script:
- mysql -e 'CREATE DATABASE IF NOT EXISTS oauth2_test;'
- sh -c "if [ '$DB' = 'mysql' ]; then mysql -e 'create database if not exists oauth2_test;'; fi"
- sh -c "if [ '$DB' = 'postgres' ]; then psql -c 'create database oauth2_tests;' -U postgres; fi"

1 change: 1 addition & 0 deletions songkick-oauth2-provider.gemspec
Expand Up @@ -20,6 +20,7 @@ spec = Gem::Specification.new do |s|
s.add_development_dependency("appraisal", "~> 0.4.0")
s.add_development_dependency("activerecord", "~> 3.2.0") # The SQLite adapter in 3.1 is broken
s.add_development_dependency("mysql") if ENV["DB"] == "mysql"
s.add_development_dependency("pg") if ENV["DB"] == "postgres"
s.add_development_dependency("rspec")
s.add_development_dependency("sqlite3")
s.add_development_dependency("sinatra", ">= 1.3.0")
Expand Down
6 changes: 6 additions & 0 deletions spec/spec_helper.rb
Expand Up @@ -11,6 +11,12 @@
:host => '127.0.0.1',
:user => 'root',
:database => 'oauth2_test')
when 'postgres'
ActiveRecord::Base.establish_connection(
:adapter => 'postgresql',
:host => '127.0.0.1',
:user => 'postgres',
:database => 'oauth2_test')
else
dbfile = File.expand_path('../test.sqlite3', __FILE__)
File.unlink(dbfile) if File.file?(dbfile)
Expand Down

0 comments on commit 2a36af3

Please sign in to comment.