Permalink
Browse files

Support for running tests on postgresql.

  • Loading branch information...
1 parent 3e6b8c3 commit 9505d284f6a20d85bbfdced0b03a425b0cf0f0d9 @pwnall committed May 9, 2012
Showing with 73 additions and 55 deletions.
  1. +5 −3 Gemfile
  2. +54 −50 Gemfile.lock
  3. +14 −2 test/helpers/db_setup.rb
View
8 Gemfile
@@ -1,13 +1,15 @@
source :rubygems
gem 'fbgraph_rails', '>= 0.2.2'
-gem 'rails', '>= 3.2.0'
+gem 'rails', '>= 3.2.3'
group :development do
- gem 'bundler', '>= 1.0.0'
+ gem 'bundler', '>= 1.1.0'
gem 'flexmock', '>= 0.9.0'
gem 'jeweler', '>= 1.8.0'
gem 'rcov', '>= 0', :platform => :mri_18
gem 'simplecov', '>= 0', :platform => :mri_19
- gem 'sqlite3', '>= 1.3.5'
+ gem 'mysql2', '>= 0.3.11'
+ gem 'pg', '>= 0.13.2'
+ gem 'sqlite3', '>= 1.3.6'
end
View
104 Gemfile.lock
@@ -1,42 +1,39 @@
GEM
remote: http://rubygems.org/
specs:
- actionmailer (3.2.1)
- actionpack (= 3.2.1)
- mail (~> 2.4.0)
- actionpack (3.2.1)
- activemodel (= 3.2.1)
- activesupport (= 3.2.1)
+ actionmailer (3.2.3)
+ actionpack (= 3.2.3)
+ mail (~> 2.4.4)
+ actionpack (3.2.3)
+ activemodel (= 3.2.3)
+ activesupport (= 3.2.3)
builder (~> 3.0.0)
erubis (~> 2.7.0)
journey (~> 1.0.1)
rack (~> 1.4.0)
- rack-cache (~> 1.1)
+ rack-cache (~> 1.2)
rack-test (~> 0.6.1)
sprockets (~> 2.1.2)
- activemodel (3.2.1)
- activesupport (= 3.2.1)
+ activemodel (3.2.3)
+ activesupport (= 3.2.3)
builder (~> 3.0.0)
- activerecord (3.2.1)
- activemodel (= 3.2.1)
- activesupport (= 3.2.1)
- arel (~> 3.0.0)
+ activerecord (3.2.3)
+ activemodel (= 3.2.3)
+ activesupport (= 3.2.3)
+ arel (~> 3.0.2)
tzinfo (~> 0.3.29)
- activeresource (3.2.1)
- activemodel (= 3.2.1)
- activesupport (= 3.2.1)
- activesupport (3.2.1)
+ activeresource (3.2.3)
+ activemodel (= 3.2.3)
+ activesupport (= 3.2.3)
+ activesupport (3.2.3)
i18n (~> 0.6)
multi_json (~> 1.0)
- addressable (2.2.6)
- arel (3.0.0)
+ arel (3.0.2)
builder (3.0.0)
erubis (2.7.0)
- faraday (0.7.6)
- addressable (~> 2.2)
+ faraday (0.8.0)
multipart-post (~> 1.1)
- rack (~> 1.1)
- fbgraph (1.9.0)
+ fbgraph (1.10.0)
activesupport
faraday (>= 0.7.5)
hashie (>= 1.0.0)
@@ -54,43 +51,48 @@ GEM
git (1.2.5)
hashie (1.2.0)
hike (1.2.1)
+ httpauth (0.1)
i18n (0.6.0)
jeweler (1.8.3)
bundler (~> 1.0)
git (>= 1.2.5)
rake
rdoc
- journey (1.0.1)
- json (1.6.5)
- mail (2.4.1)
+ journey (1.0.3)
+ json (1.7.1)
+ mail (2.4.4)
i18n (>= 0.4.0)
mime-types (~> 1.16)
treetop (~> 1.4.8)
- mime-types (1.17.2)
- multi_json (1.0.4)
- multipart-post (1.1.4)
- oauth2 (0.5.2)
- faraday (~> 0.7)
+ mime-types (1.18)
+ multi_json (1.3.4)
+ multipart-post (1.1.5)
+ mysql2 (0.3.11)
+ oauth2 (0.7.1)
+ faraday (~> 0.8)
+ httpauth (~> 0.1)
multi_json (~> 1.0)
+ rack (~> 1.4)
+ pg (0.13.2)
polyglot (0.3.3)
rack (1.4.1)
- rack-cache (1.1)
+ rack-cache (1.2)
rack (>= 0.4)
rack-ssl (1.3.2)
rack
rack-test (0.6.1)
rack (>= 1.0)
- rails (3.2.1)
- actionmailer (= 3.2.1)
- actionpack (= 3.2.1)
- activerecord (= 3.2.1)
- activeresource (= 3.2.1)
- activesupport (= 3.2.1)
+ rails (3.2.3)
+ actionmailer (= 3.2.3)
+ actionpack (= 3.2.3)
+ activerecord (= 3.2.3)
+ activeresource (= 3.2.3)
+ activesupport (= 3.2.3)
bundler (~> 1.0)
- railties (= 3.2.1)
- railties (3.2.1)
- actionpack (= 3.2.1)
- activesupport (= 3.2.1)
+ railties (= 3.2.3)
+ railties (3.2.3)
+ actionpack (= 3.2.3)
+ activesupport (= 3.2.3)
rack-ssl (~> 1.3.2)
rake (>= 0.8.7)
rdoc (~> 3.4)
@@ -101,31 +103,33 @@ GEM
json (~> 1.4)
rest-client (1.6.7)
mime-types (>= 1.16)
- simplecov (0.5.4)
- multi_json (~> 1.0.3)
+ simplecov (0.6.2)
+ multi_json (~> 1.3)
simplecov-html (~> 0.5.3)
simplecov-html (0.5.3)
- sprockets (2.1.2)
+ sprockets (2.1.3)
hike (~> 1.2)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
- sqlite3 (1.3.5)
+ sqlite3 (1.3.6)
thor (0.14.6)
tilt (1.3.3)
treetop (1.4.10)
polyglot
polyglot (>= 0.3.1)
- tzinfo (0.3.31)
+ tzinfo (0.3.33)
PLATFORMS
ruby
DEPENDENCIES
- bundler (>= 1.0.0)
+ bundler (>= 1.1.0)
fbgraph_rails (>= 0.2.2)
flexmock (>= 0.9.0)
jeweler (>= 1.8.0)
- rails (>= 3.2.0)
+ mysql2 (>= 0.3.11)
+ pg (>= 0.13.2)
+ rails (>= 3.2.3)
rcov
simplecov
- sqlite3 (>= 1.3.5)
+ sqlite3 (>= 1.3.6)
View
16 test/helpers/db_setup.rb
@@ -1,5 +1,17 @@
-ActiveRecord::Base.establish_connection :adapter => 'sqlite3',
- :database => ':memory:'
+case ENV['DB']
+when /mysql/i
+ `mysql -u root -e "DROP DATABASE IF EXISTS plugin_dev; CREATE DATABASE plugin_dev;"`
+ ActiveRecord::Base.establish_connection :adapter => 'mysql2',
+ :database => 'plugin_dev', :username => 'root', :password => ''
+when /pg/i
+ `psql -d postgres -c "DROP DATABASE IF EXISTS plugin_dev;"`
+ `psql -d postgres -c "CREATE DATABASE plugin_dev;"`
+ ActiveRecord::Base.establish_connection :adapter => 'postgresql',
+ :database => 'plugin_dev', :username => ENV['USER'], :password => ''
+else
+ ActiveRecord::Base.establish_connection :adapter => 'sqlite3',
+ :database => ':memory:'
+end
ActiveRecord::Base.configurations = true
ActiveRecord::Migration.verbose = false

0 comments on commit 9505d28

Please sign in to comment.