aboutsummaryrefslogtreecommitdiffstats
path: root/test/nodes/test_sql_literal.rb
diff options
context:
space:
mode:
authorIvan Antropov <antropov.ivan@gmail.com>2013-11-09 10:16:19 +0700
committerIvan Antropov <antropov.ivan@gmail.com>2013-11-09 10:16:19 +0700
commitfcb00d388c8afe25cdc8bd0fa5c762840921a8c9 (patch)
treedd6f888849febb205c602859482598affbe0ccb2 /test/nodes/test_sql_literal.rb
parent9e53488b1d8d535182a989bd38fbb171aebbeef5 (diff)
downloadrails-fcb00d388c8afe25cdc8bd0fa5c762840921a8c9.tar.gz
rails-fcb00d388c8afe25cdc8bd0fa5c762840921a8c9.tar.bz2
rails-fcb00d388c8afe25cdc8bd0fa5c762840921a8c9.zip
Add :encode_with for proper YAML serialization
Diffstat (limited to 'test/nodes/test_sql_literal.rb')
-rw-r--r--test/nodes/test_sql_literal.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/nodes/test_sql_literal.rb b/test/nodes/test_sql_literal.rb
index 9deb8e5d8d..085c5dad6b 100644
--- a/test/nodes/test_sql_literal.rb
+++ b/test/nodes/test_sql_literal.rb
@@ -1,4 +1,5 @@
require 'helper'
+require 'yaml'
module Arel
module Nodes
@@ -56,6 +57,13 @@ module Arel
@visitor.accept(node).must_be_like %{ (foo = 1 AND foo = 2) }
end
end
+
+ describe 'serialization' do
+ it 'serializes into YAML' do
+ yaml_literal = SqlLiteral.new('foo').to_yaml
+ assert_equal('foo', YAML.load(yaml_literal))
+ end
+ end
end
end
end