diff options
author | Ranjay Krishna <rak248@cornell.edu> | 2013-02-12 02:10:48 -0500 |
---|---|---|
committer | Ranjay Krishna <rak248@cornell.edu> | 2013-02-12 02:10:48 -0500 |
commit | c321b309a9a90bbfa0912832c11b3fef52e71840 (patch) | |
tree | e56d8f336a2d445113327b27020a66317b69ffe1 /activerecord/test/cases/adapters | |
parent | bbcebb6ab276c71be88c3ae0548bb7bf4e18630d (diff) | |
download | rails-c321b309a9a90bbfa0912832c11b3fef52e71840.tar.gz rails-c321b309a9a90bbfa0912832c11b3fef52e71840.tar.bz2 rails-c321b309a9a90bbfa0912832c11b3fef52e71840.zip |
checking in the abstractions for valid type checking:
Diffstat (limited to 'activerecord/test/cases/adapters')
3 files changed, 27 insertions, 0 deletions
diff --git a/activerecord/test/cases/adapters/mysql/mysql_adapter_test.rb b/activerecord/test/cases/adapters/mysql/mysql_adapter_test.rb index 0eb1cc511e..0b017dc4a0 100644 --- a/activerecord/test/cases/adapters/mysql/mysql_adapter_test.rb +++ b/activerecord/test/cases/adapters/mysql/mysql_adapter_test.rb @@ -16,6 +16,15 @@ module ActiveRecord eosql end + def test_valid_column + column = @conn.column('ex').find { |col| col.name == 'id' } + assert @conn.valid_type?(column.type) + end + + def test_invalid_column + assert !@conn.valid_type?(:foobar) + end + def test_client_encoding assert_equal Encoding::UTF_8, @conn.client_encoding end diff --git a/activerecord/test/cases/adapters/postgresql/postgresql_adapter_test.rb b/activerecord/test/cases/adapters/postgresql/postgresql_adapter_test.rb index 872204c644..d33e360bd4 100644 --- a/activerecord/test/cases/adapters/postgresql/postgresql_adapter_test.rb +++ b/activerecord/test/cases/adapters/postgresql/postgresql_adapter_test.rb @@ -10,6 +10,15 @@ module ActiveRecord @connection.exec_query('create table ex(id serial primary key, number integer, data character varying(255))') end + def test_valid_column + column = @connection.column('ex').find { |col| col.name == 'id' } + assert @connection.valid_type?(column.type) + end + + def test_invalid_column + assert !@connection.valid_type?(:foobar) + end + def test_primary_key assert_equal 'id', @connection.primary_key('ex') end diff --git a/activerecord/test/cases/adapters/sqlite3/sqlite3_adapter_test.rb b/activerecord/test/cases/adapters/sqlite3/sqlite3_adapter_test.rb index 003052bac4..64af49acec 100644 --- a/activerecord/test/cases/adapters/sqlite3/sqlite3_adapter_test.rb +++ b/activerecord/test/cases/adapters/sqlite3/sqlite3_adapter_test.rb @@ -25,6 +25,15 @@ module ActiveRecord @conn.intercepted = true end + def test_valid_column + column = @conn.column('items').find { |col| col.name == 'id' } + assert @conn.valid_type?(column.type) + end + + def test_invalid_column + assert @conn.valid_type?(:foobar) + end + def teardown @conn.intercepted = false @conn.logged = [] |