diff options
author | Emilio Tagua <miloops@gmail.com> | 2009-08-17 19:46:32 -0300 |
---|---|---|
committer | Emilio Tagua <miloops@gmail.com> | 2009-08-17 19:46:32 -0300 |
commit | 4b339f44bdaa307004db2345ac9c950d9f508814 (patch) | |
tree | 855748bc8f1df1a8b1d327810be229af05ee522e /activerecord/test | |
parent | c01c8967a02537f132d437d5ae15332982119651 (diff) | |
parent | 25e5b0c4a8d0045715a6ad11e2898585826e4e9b (diff) | |
download | rails-4b339f44bdaa307004db2345ac9c950d9f508814.tar.gz rails-4b339f44bdaa307004db2345ac9c950d9f508814.tar.bz2 rails-4b339f44bdaa307004db2345ac9c950d9f508814.zip |
Merge commit 'rails/master'
Diffstat (limited to 'activerecord/test')
-rwxr-xr-x | activerecord/test/cases/base_test.rb | 18 | ||||
-rw-r--r-- | activerecord/test/connections/native_sqlite/connection.rb | 25 |
2 files changed, 8 insertions, 35 deletions
diff --git a/activerecord/test/cases/base_test.rb b/activerecord/test/cases/base_test.rb index 26a475b964..df15c1a797 100755 --- a/activerecord/test/cases/base_test.rb +++ b/activerecord/test/cases/base_test.rb @@ -1775,17 +1775,15 @@ class BasicsTest < ActiveRecord::TestCase assert_equal res4, res5 - unless current_adapter?(:SQLite2Adapter, :DeprecatedSQLiteAdapter) - res6 = Post.count_by_sql "SELECT COUNT(DISTINCT p.id) FROM posts p, comments co WHERE p.#{QUOTED_TYPE} = 'Post' AND p.id=co.post_id" - res7 = nil - assert_nothing_raised do - res7 = Post.count(:conditions => "p.#{QUOTED_TYPE} = 'Post' AND p.id=co.post_id", - :joins => "p, comments co", - :select => "p.id", - :distinct => true) - end - assert_equal res6, res7 + res6 = Post.count_by_sql "SELECT COUNT(DISTINCT p.id) FROM posts p, comments co WHERE p.#{QUOTED_TYPE} = 'Post' AND p.id=co.post_id" + res7 = nil + assert_nothing_raised do + res7 = Post.count(:conditions => "p.#{QUOTED_TYPE} = 'Post' AND p.id=co.post_id", + :joins => "p, comments co", + :select => "p.id", + :distinct => true) end + assert_equal res6, res7 end def test_clear_association_cache_stored diff --git a/activerecord/test/connections/native_sqlite/connection.rb b/activerecord/test/connections/native_sqlite/connection.rb deleted file mode 100644 index fea985d8a3..0000000000 --- a/activerecord/test/connections/native_sqlite/connection.rb +++ /dev/null @@ -1,25 +0,0 @@ -print "Using native SQlite\n" -require_dependency 'models/course' -require 'logger' -ActiveRecord::Base.logger = Logger.new("debug.log") - -class SqliteError < StandardError -end - -BASE_DIR = FIXTURES_ROOT -sqlite_test_db = "#{BASE_DIR}/fixture_database.sqlite" -sqlite_test_db2 = "#{BASE_DIR}/fixture_database_2.sqlite" - -def make_connection(clazz, db_file) - ActiveRecord::Base.configurations = { clazz.name => { :adapter => 'sqlite', :database => db_file } } - unless File.exist?(db_file) - puts "SQLite database not found at #{db_file}. Rebuilding it." - sqlite_command = %Q{sqlite "#{db_file}" "create table a (a integer); drop table a;"} - puts "Executing '#{sqlite_command}'" - raise SqliteError.new("Seems that there is no sqlite executable available") unless system(sqlite_command) - end - clazz.establish_connection(clazz.name) -end - -make_connection(ActiveRecord::Base, sqlite_test_db) -make_connection(Course, sqlite_test_db2) |