From 6a9f47f33f853c6899bb50bf21e49da798bdd12e Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Sat, 3 Jun 2006 21:47:29 +0000 Subject: Make more Firebird tests pass (closes #5188) [kennethkunz@gmail.com] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4420 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- activerecord/test/aaa_create_tables_test.rb | 6 +++++- activerecord/test/abstract_unit.rb | 2 +- activerecord/test/associations_join_model_test.rb | 3 ++- activerecord/test/calculations_test.rb | 4 ++-- activerecord/test/fixtures/db_definitions/firebird.drop.sql | 1 + activerecord/test/fixtures/db_definitions/firebird.sql | 2 +- 6 files changed, 12 insertions(+), 6 deletions(-) (limited to 'activerecord') diff --git a/activerecord/test/aaa_create_tables_test.rb b/activerecord/test/aaa_create_tables_test.rb index 8ff6c64e55..2b456c1dd2 100644 --- a/activerecord/test/aaa_create_tables_test.rb +++ b/activerecord/test/aaa_create_tables_test.rb @@ -14,7 +14,11 @@ class AAACreateTablesTest < Test::Unit::TestCase end def test_load_schema - eval(File.read("#{File.dirname(__FILE__)}/fixtures/db_definitions/schema.rb")) + if ActiveRecord::Base.connection.supports_migrations? + eval(File.read("#{File.dirname(__FILE__)}/fixtures/db_definitions/schema.rb")) + else + recreate ActiveRecord::Base, '3' + end assert true end diff --git a/activerecord/test/abstract_unit.rb b/activerecord/test/abstract_unit.rb index 881d26fac8..761e29c741 100755 --- a/activerecord/test/abstract_unit.rb +++ b/activerecord/test/abstract_unit.rb @@ -58,7 +58,7 @@ ActiveRecord::Base.connection.class.class_eval do cattr_accessor :query_count # Array of regexes of queries that are not counted against query_count - @@ignore_list = [/^SELECT currval/] + @@ignore_list = [/^SELECT currval/, /^SELECT CAST/] alias_method :execute_without_query_counting, :execute def execute_with_query_counting(sql, name = nil) diff --git a/activerecord/test/associations_join_model_test.rb b/activerecord/test/associations_join_model_test.rb index be04df9c00..ede21785e7 100644 --- a/activerecord/test/associations_join_model_test.rb +++ b/activerecord/test/associations_join_model_test.rb @@ -301,7 +301,8 @@ class AssociationsJoinModelTest < Test::Unit::TestCase end def test_has_many_through_has_many_find_conditions - assert_equal comments(:does_it_hurt), authors(:david).comments.find(:first, :conditions => "comments.type='SpecialComment'", :order => 'comments.id') + options = { :conditions => "comments.#{QUOTED_TYPE}='SpecialComment'", :order => 'comments.id' } + assert_equal comments(:does_it_hurt), authors(:david).comments.find(:first, options) end def test_has_many_through_has_many_find_by_id diff --git a/activerecord/test/calculations_test.rb b/activerecord/test/calculations_test.rb index 785a4d10b4..67de1b9bd5 100644 --- a/activerecord/test/calculations_test.rb +++ b/activerecord/test/calculations_test.rb @@ -133,7 +133,7 @@ class CalculationsTest < Test::Unit::TestCase end def test_should_calculate_grouped_by_function - c = Company.count(:all, :group => 'UPPER(type)') + c = Company.count(:all, :group => "UPPER(#{QUOTED_TYPE})") assert_equal 2, c[nil] assert_equal 1, c['DEPENDENTFIRM'] assert_equal 3, c['CLIENT'] @@ -141,7 +141,7 @@ class CalculationsTest < Test::Unit::TestCase end def test_should_calculate_grouped_by_function_with_table_alias - c = Company.count(:all, :group => 'UPPER(companies.type)') + c = Company.count(:all, :group => "UPPER(companies.#{QUOTED_TYPE})") assert_equal 2, c[nil] assert_equal 1, c['DEPENDENTFIRM'] assert_equal 3, c['CLIENT'] diff --git a/activerecord/test/fixtures/db_definitions/firebird.drop.sql b/activerecord/test/fixtures/db_definitions/firebird.drop.sql index cb454c2971..807361ed45 100644 --- a/activerecord/test/fixtures/db_definitions/firebird.drop.sql +++ b/activerecord/test/fixtures/db_definitions/firebird.drop.sql @@ -56,3 +56,4 @@ DROP GENERATOR tasks_seq; DROP GENERATOR categories_seq; DROP GENERATOR keyboards_seq; DROP GENERATOR defaults_seq; +DROP GENERATOR legacy_things_seq; diff --git a/activerecord/test/fixtures/db_definitions/firebird.sql b/activerecord/test/fixtures/db_definitions/firebird.sql index 729c2097df..c523bfe7bb 100644 --- a/activerecord/test/fixtures/db_definitions/firebird.sql +++ b/activerecord/test/fixtures/db_definitions/firebird.sql @@ -1,4 +1,4 @@ -CREATE DOMAIN D_BOOLEAN AS SMALLINT CHECK (VALUE IN (0, 1)); +CREATE DOMAIN D_BOOLEAN AS SMALLINT CHECK (VALUE IN (0, 1) OR VALUE IS NULL); CREATE TABLE accounts ( id BIGINT NOT NULL, -- cgit v1.2.3