Merge pull request #172 from sanemat/feature/activerecord

Update gems, fix MysqlAdapter issue
This commit is contained in:
Ben Mabey 2013-01-09 07:50:48 -08:00
commit 737d2dc4a8
3 changed files with 70 additions and 61 deletions

View file

@ -23,7 +23,7 @@ group :development do
gem "couch_potato"
gem "sequel", "~>3.21.0"
#gem "ibm_db" # I don't want to add this dependency, even as a dev one since it requires DB2 to be installed
gem 'mysql'
gem 'mysql', '~> 2.8.1'
gem 'mysql2'
gem 'pg'

View file

@ -1,34 +1,35 @@
GEM
remote: http://rubygems.org/
specs:
actionpack (3.2.6)
activemodel (= 3.2.6)
activesupport (= 3.2.6)
actionpack (3.2.11)
activemodel (= 3.2.11)
activesupport (= 3.2.11)
builder (~> 3.0.0)
erubis (~> 2.7.0)
journey (~> 1.0.1)
journey (~> 1.0.4)
rack (~> 1.4.0)
rack-cache (~> 1.2)
rack-test (~> 0.6.1)
sprockets (~> 2.1.3)
activemodel (3.2.6)
activesupport (= 3.2.6)
sprockets (~> 2.2.1)
activemodel (3.2.11)
activesupport (= 3.2.11)
builder (~> 3.0.0)
activerecord (3.2.6)
activemodel (= 3.2.6)
activesupport (= 3.2.6)
activerecord (3.2.11)
activemodel (= 3.2.11)
activesupport (= 3.2.11)
arel (~> 3.0.2)
tzinfo (~> 0.3.29)
activesupport (3.2.6)
activesupport (3.2.11)
i18n (~> 0.6)
multi_json (~> 1.0)
addressable (2.2.8)
arel (3.0.2)
bcrypt-ruby (3.0.1)
bson (1.6.4)
bson_ext (1.6.4)
bson (~> 1.6.4)
bson (1.8.1)
bson_ext (1.8.1)
bson (~> 1.8.1)
builder (3.0.4)
coderay (1.0.8)
couch_potato (0.7.1)
activemodel
couchrest (>= 1.0.1)
@ -93,15 +94,17 @@ GEM
data_objects (= 0.10.11)
erubis (2.7.0)
fastercsv (1.5.5)
ffi (1.1.4)
gherkin (2.11.1)
gherkin (2.11.5)
json (>= 1.4.6)
git (1.2.5)
guard (1.3.0)
listen (>= 0.4.2)
guard (1.6.1)
listen (>= 0.6.0)
lumberjack (>= 1.0.2)
pry (>= 0.9.10)
thor (>= 0.14.6)
guard-rspec (1.2.1)
guard-rspec (2.3.3)
guard (>= 1.1)
rspec (~> 2.11)
hike (1.2.1)
i18n (0.6.1)
jeweler (1.8.4)
@ -112,80 +115,82 @@ GEM
journey (1.0.4)
json (1.7.6)
json_pure (1.7.6)
listen (0.4.7)
rb-fchange (~> 0.0.5)
rb-fsevent (~> 0.9.1)
rb-inotify (~> 0.8.8)
listen (0.7.1)
lumberjack (1.0.2)
method_source (0.8.1)
mime-types (1.19)
mongo (1.6.4)
bson (~> 1.6.4)
mongo (1.8.1)
bson (~> 1.8.1)
mongo_ext (0.19.3)
mongo_mapper (0.11.1)
mongo_mapper (0.12.0)
activemodel (~> 3.0)
activesupport (~> 3.0)
plucky (~> 0.4.0)
mongoid (3.0.1)
plucky (~> 0.5.2)
mongoid (3.0.16)
activemodel (~> 3.1)
moped (~> 1.1.1)
origin (~> 1.0.3)
moped (~> 1.1)
origin (~> 1.0)
tzinfo (~> 0.3.22)
moped (1.1.2)
moped (1.3.2)
multi_json (1.5.0)
mysql (2.8.1)
mysql2 (0.3.11)
origin (1.0.4)
pg (0.14.0)
plucky (0.4.4)
origin (1.0.11)
pg (0.14.1)
plucky (0.5.2)
mongo (~> 1.5)
rack (1.4.1)
pry (0.9.10)
coderay (~> 1.0.5)
method_source (~> 0.8)
slop (~> 3.3.1)
rack (1.4.3)
rack-cache (1.2)
rack (>= 0.4)
rack-ssl (1.3.2)
rack
rack-test (0.6.1)
rack-test (0.6.2)
rack (>= 1.0)
railties (3.2.6)
actionpack (= 3.2.6)
activesupport (= 3.2.6)
railties (3.2.11)
actionpack (= 3.2.11)
activesupport (= 3.2.11)
rack-ssl (~> 1.3.2)
rake (>= 0.8.7)
rdoc (~> 3.4)
thor (>= 0.14.6, < 2.0)
rake (0.9.2.2)
rb-fchange (0.0.5)
ffi
rb-fsevent (0.9.1)
rb-inotify (0.8.8)
ffi (>= 0.5.0)
rake (10.0.3)
rdoc (3.12)
json (~> 1.4)
rest-client (1.6.7)
mime-types (>= 1.16)
rspec (2.11.0)
rspec-core (~> 2.11.0)
rspec-expectations (~> 2.11.0)
rspec-mocks (~> 2.11.0)
rspec-core (2.11.1)
rspec-expectations (2.11.1)
rspec (2.12.0)
rspec-core (~> 2.12.0)
rspec-expectations (~> 2.12.0)
rspec-mocks (~> 2.12.0)
rspec-core (2.12.2)
rspec-expectations (2.12.1)
diff-lcs (~> 1.1.3)
rspec-mocks (2.11.1)
rspec-rails (2.11.0)
rspec-mocks (2.12.1)
rspec-rails (2.12.1)
actionpack (>= 3.0)
activesupport (>= 3.0)
railties (>= 3.0)
rspec (~> 2.11.0)
rspec-core (~> 2.12.0)
rspec-expectations (~> 2.12.0)
rspec-mocks (~> 2.12.0)
sequel (3.21.0)
sprockets (2.1.3)
slop (3.3.3)
sprockets (2.2.2)
hike (~> 1.2)
multi_json (~> 1.0)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
sqlite3 (1.3.6)
sqlite3-ruby (1.3.3)
sqlite3 (>= 1.3.3)
stringex (1.5.1)
thor (0.15.4)
thor (0.16.0)
tilt (1.3.3)
tzinfo (0.3.33)
tzinfo (0.3.35)
uuidtools (2.1.3)
PLATFORMS
@ -206,7 +211,7 @@ DEPENDENCIES
mongo_ext
mongo_mapper
mongoid
mysql
mysql (~> 2.8.1)
mysql2
pg
rake

View file

@ -55,7 +55,9 @@ module DatabaseCleaner
def row_count(table)
select_value("SELECT EXISTS (SELECT 1 FROM #{quote_table_name(table)} LIMIT 1)")
# Patch for MysqlAdapter with ActiveRecord 3.2.7 later
# select_value("SELECT 1") #=> "1"
select_value("SELECT EXISTS (SELECT 1 FROM #{quote_table_name(table)} LIMIT 1)").to_i
end
# Returns a boolean indicating if the given table has an auto-inc number higher than 0.
@ -66,7 +68,9 @@ module DatabaseCleaner
if row_count(table) > 0
true
else
select_value(<<-SQL) > 1 # returns nil if not present
# Patch for MysqlAdapter with ActiveRecord 3.2.7 later
# select_value("SELECT 1") #=> "1"
select_value(<<-SQL).to_i > 1 # returns nil if not present
SELECT Auto_increment
FROM information_schema.tables
WHERE table_name='#{table}';