From d28e9aef5f7ea4a0432c154f2a3f89f28edcc4ba Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Mon, 14 Nov 2005 04:51:54 +0000 Subject: Oracle: test case for column default parsing. References #2788. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3019 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- activerecord/test/base_test.rb | 10 ++++++++++ activerecord/test/fixtures/db_definitions/oci.sql | 8 ++++++++ 2 files changed, 18 insertions(+) (limited to 'activerecord/test') diff --git a/activerecord/test/base_test.rb b/activerecord/test/base_test.rb index 7be6441f1d..2db2dbf837 100755 --- a/activerecord/test/base_test.rb +++ b/activerecord/test/base_test.rb @@ -17,6 +17,7 @@ class MasterCreditCard < ActiveRecord::Base; end class Post < ActiveRecord::Base; end class Computer < ActiveRecord::Base; end class NonExistentTable < ActiveRecord::Base; end +class TestOCIDefault < ActiveRecord::Base; end class LoosePerson < ActiveRecord::Base attr_protected :credit_rating, :administrator @@ -470,6 +471,15 @@ class BasicsTest < Test::Unit::TestCase topic = Topic.find(topic.id) assert topic.approved? assert_nil topic.last_read + + # Oracle has some funky default handling, so it requires a bit of + # extra testing. See ticket #2788. + if current_adapter?(:OCIAdapter) + test = TestOCIDefault.new + assert_equal "X", test.test_char + assert_equal "hello", test.test_string + assert_equal 3, test.test_int + end end def test_utc_as_time_zone diff --git a/activerecord/test/fixtures/db_definitions/oci.sql b/activerecord/test/fixtures/db_definitions/oci.sql index cedd92ad53..832396d0c7 100644 --- a/activerecord/test/fixtures/db_definitions/oci.sql +++ b/activerecord/test/fixtures/db_definitions/oci.sql @@ -261,3 +261,11 @@ create table keyboards ( ); create sequence keyboards_seq minvalue 10000; +create table test_oci_defaults ( + id integer not null primary key, + test_char char(1) default 'X' not null, + test_string varchar2(20) default 'hello' not null, + test_int integer default 3 not null +); +create sequence test_oci_defaults_seq minvalue 10000; + -- cgit v1.2.3