diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-07-08 09:42:54 -0300 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-07-08 09:42:54 -0300 |
commit | 336be2bdf7dfa1b31879d0ab27e5f3101b351923 (patch) | |
tree | e48658928b4d9fc3b54330bac645d2b7949c3d58 /activerecord/test/cases/adapters | |
parent | e0c6b35dac32b6375c86d93e992a138dd627157e (diff) | |
parent | f6968bd601e38fb5060c7bc577331f97ed5e232c (diff) | |
download | rails-336be2bdf7dfa1b31879d0ab27e5f3101b351923.tar.gz rails-336be2bdf7dfa1b31879d0ab27e5f3101b351923.tar.bz2 rails-336be2bdf7dfa1b31879d0ab27e5f3101b351923.zip |
Merge pull request #16072 from sgrif/sg-xml-quoting
Don't rely on the sql type to quote XML columns in PG
Diffstat (limited to 'activerecord/test/cases/adapters')
-rw-r--r-- | activerecord/test/cases/adapters/postgresql/xml_test.rb | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/activerecord/test/cases/adapters/postgresql/xml_test.rb b/activerecord/test/cases/adapters/postgresql/xml_test.rb index 48c6eeb62c..4165dd5ac9 100644 --- a/activerecord/test/cases/adapters/postgresql/xml_test.rb +++ b/activerecord/test/cases/adapters/postgresql/xml_test.rb @@ -11,7 +11,7 @@ class PostgresqlXMLTest < ActiveRecord::TestCase begin @connection.transaction do @connection.create_table('xml_data_type') do |t| - t.xml 'payload', default: {} + t.xml 'payload' end end rescue ActiveRecord::StatementInvalid @@ -32,4 +32,17 @@ class PostgresqlXMLTest < ActiveRecord::TestCase @connection.execute %q|insert into xml_data_type (payload) VALUES(null)| assert_nil XmlDataType.first.payload end + + def test_round_trip + data = XmlDataType.new(payload: "<foo>bar</foo>") + assert_equal "<foo>bar</foo>", data.payload + data.save! + assert_equal "<foo>bar</foo>", data.reload.payload + end + + def test_update_all + data = XmlDataType.create! + XmlDataType.update_all(payload: "<bar>baz</bar>") + assert_equal "<bar>baz</bar>", data.reload.payload + end end |