aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2013-11-10 17:11:02 -0800
committerRafael Mendonça França <rafaelmfranca@gmail.com>2013-11-10 17:11:02 -0800
commit1dfe62640fc754903ba1c19d4fed3604b9069196 (patch)
treed706a1bded1a0d4f918452ae5fcc175ec7be4c1c /test
parent03f51687e204f03cdf8d8395350d4d0514a7f620 (diff)
parentfcb00d388c8afe25cdc8bd0fa5c762840921a8c9 (diff)
downloadrails-1dfe62640fc754903ba1c19d4fed3604b9069196.tar.gz
rails-1dfe62640fc754903ba1c19d4fed3604b9069196.tar.bz2
rails-1dfe62640fc754903ba1c19d4fed3604b9069196.zip
Merge pull request #216 from iantropov/issue_yaml
Add :encode_with to sql_literal for proper YAML serialization
Diffstat (limited to 'test')
-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