Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Removed redundant xml override from pg adapter
Closes: #11706
- Loading branch information
Showing
3 changed files
with
47 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,39 @@ | |||
# encoding: utf-8 | |||
|
|||
require 'cases/helper' | |||
require 'active_record/base' | |||
require 'active_record/connection_adapters/postgresql_adapter' | |||
|
|||
class PostgresqlXMLTest < ActiveRecord::TestCase | |||
class XmlDataType < ActiveRecord::Base | |||
self.table_name = 'xml_data_type' | |||
end | |||
|
|||
def setup | |||
@connection = ActiveRecord::Base.connection | |||
begin | |||
@connection.transaction do | |||
@connection.create_table('xml_data_type') do |t| | |||
t.xml 'payload', default: {} | |||
end | |||
end | |||
rescue ActiveRecord::StatementInvalid | |||
return skip "do not test on PG without xml" | |||
end | |||
@column = XmlDataType.columns.find { |c| c.name == 'payload' } | |||
end | |||
|
|||
def teardown | |||
@connection.execute 'drop table if exists xml_data_type' | |||
end | |||
|
|||
def test_column | |||
assert_equal :xml, @column.type | |||
end | |||
|
|||
def test_null_xml | |||
@connection.execute %q|insert into xml_data_type (payload) VALUES(null)| | |||
x = XmlDataType.first | |||
assert_equal(nil, x.payload) | |||
end | |||
end |