Sha256: e2ef8390d3ddfc7a0475ad59aac328931c75c00391d99d907e2fc222810a48db
Contents?: true
Size: 1.73 KB
Versions: 1
Compression:
Stored size: 1.73 KB
Contents
require File.expand_path('test_helper', File.dirname(__FILE__)) class DB2SimpleTest < Test::Unit::TestCase include SimpleTestMethods include ActiveRecord3TestMethods include DirtyAttributeTests include XmlColumnTests def xml_sql_type; 'XML'; end # For backwards compatibility with how the DB2 code in # jdbc_adapter 0.9.x handled booleans. # # The old DB2 jdbc_db2.rb driver was broken enough that # applications were exposed to the underlying type (was DECIMAL) # and used 0 and 1 as false and true, respectively. # # This driver now uses SMALLINT as a boolean, and properly # type cast's it to a Ruby boolean. Need to make sure we don't # break existing apps! def test_boolean_as_integer e = DbType.first # true e.sample_boolean = 1 assert_equal true, e.sample_boolean assert_equal true, e.sample_boolean? e.save! e = DbType.first assert_equal true, e.sample_boolean assert_equal true, e.sample_boolean? # false e.sample_boolean = 0 assert_equal false, e.sample_boolean assert_equal false, e.sample_boolean? e.save! e = DbType.first assert_equal false, e.sample_boolean assert_equal false, e.sample_boolean? end def test_find_by_sql_WITH_statement user = User.create! :login => 'ferko' Entry.create! :title => 'aaa', :user_id => user.id entries = Entry.find_by_sql '' + 'WITH EntryAndUser (title, login, updated_on) AS ' + '(' + ' SELECT e.title, u.login, e.updated_on ' + ' FROM entries e INNER JOIN users u ON e.user_id = u.id ' + ')' + ' ' + 'SELECT * FROM EntryAndUser ORDER BY title ASC' assert entries.first assert entries.first.title assert entries.first.login end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
activerecord-jdbc-adapter-1.3.0.beta1 | test/db/db2/simple_test.rb |