Permalink
Browse files

Depend on mysql2 gem for database testing operations instead of sqlite

SQLite was having incompatibility issues with Ruby 1.9.3.  This makes
for a higher barrier to entry when testing carrier wave locally but
ensure that tests can pass on TravisCI.
  • Loading branch information...
1 parent 5783c36 commit de123f14b7715586de1ff86575b2300c73e0debc @bensie bensie committed Jan 20, 2012
Showing with 16 additions and 23 deletions.
  1. +3 −0 .travis.yml
  2. +1 −7 carrierwave.gemspec
  3. +6 −8 features/support/activerecord.rb
  4. +5 −3 spec/orm/activerecord_spec.rb
  5. +1 −5 spec/spec_helper.rb
View
@@ -20,3 +20,6 @@ matrix:
gemfile: gemfiles/rails_master.gemfile
- rvm: rbx-18mode
gemfile: gemfiles/rails_master.gemfile
+
+before_script:
+ - "mysql -e 'create database carrierwave_test;'"
View
@@ -24,13 +24,7 @@ Gem::Specification.new do |s|
s.add_dependency "activesupport", ">= 3.2.0.rc2"
- if defined?(JRUBY_VERSION)
- s.add_development_dependency "activerecord-jdbc-adapter"
- s.add_development_dependency "jdbc-sqlite3"
- else
- s.add_development_dependency "sqlite3"
- end
-
+ s.add_development_dependency "mysql2"
s.add_development_dependency "rails", ">= 3.2.0.rc2"
s.add_development_dependency "cucumber", "1.1.4"
s.add_development_dependency "json"
@@ -1,19 +1,17 @@
# encoding: utf-8
-unless defined?(JRUBY_VERSION)
- # not sure why we need to do this
- require 'sqlite3/sqlite3_native'
- require 'sqlite3'
-end
+require 'mysql2'
require 'active_record'
require 'carrierwave/mount'
require 'carrierwave/orm/activerecord'
-# change this if sqlite is unavailable
+# Change this if MySQL is unavailable
dbconfig = {
- :adapter => 'sqlite3',
- :database => ':memory:'
+ :adapter => 'mysql2',
+ :database => 'carrierwave_test',
+ :username => 'root',
+ :encoding => 'utf8'
}
ActiveRecord::Base.establish_connection(dbconfig)
@@ -4,10 +4,12 @@
require 'carrierwave/orm/activerecord'
-# change this if sqlite is unavailable
+# Change this if MySQL is unavailable
dbconfig = {
- :adapter => 'sqlite3',
- :database => ':memory:'
+ :adapter => 'mysql2',
+ :database => 'carrierwave_test',
+ :username => 'root',
+ :encoding => 'utf8'
}
ActiveRecord::Base.establish_connection(dbconfig)
View
@@ -12,11 +12,7 @@
require 'open-uri'
require 'sham_rack'
-unless defined?(JRUBY_VERSION)
- # not sure why we need to do this
- require 'sqlite3/sqlite3_native'
- require 'sqlite3'
-end
+require 'mysql2'
require 'fog'
require 'storage/fog_helper'

0 comments on commit de123f1

Please sign in to comment.