aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2012-02-20 17:57:37 -0800
committerAaron Patterson <aaron.patterson@gmail.com>2012-02-20 17:57:37 -0800
commit33f03c5557526d54c2b0053c79ea0e837016aef5 (patch)
tree2f98fab9b03e76a84195345c2a4571177b618960 /test
parentcbdc7e72ba48672f6c43627de1d081e61c6c10b0 (diff)
downloadrails-33f03c5557526d54c2b0053c79ea0e837016aef5.tar.gz
rails-33f03c5557526d54c2b0053c79ea0e837016aef5.tar.bz2
rails-33f03c5557526d54c2b0053c79ea0e837016aef5.zip
bind parameters can be differentiated from sql literals
Diffstat (limited to 'test')
-rw-r--r--test/nodes/test_node.rb1
-rw-r--r--test/visitors/test_to_sql.rb6
2 files changed, 7 insertions, 0 deletions
diff --git a/test/nodes/test_node.rb b/test/nodes/test_node.rb
index b8d06b9ccc..335cba8aab 100644
--- a/test/nodes/test_node.rb
+++ b/test/nodes/test_node.rb
@@ -11,6 +11,7 @@ module Arel
Nodes.const_get(k)
}.grep(Class).each do |klass|
next if Nodes::SqlLiteral == klass
+ next if Nodes::BindParam == klass
next if klass.name =~ /^Arel::Nodes::Test/
assert klass.ancestors.include?(Nodes::Node), klass.name
end
diff --git a/test/visitors/test_to_sql.rb b/test/visitors/test_to_sql.rb
index 9b86a89300..f832bdf925 100644
--- a/test/visitors/test_to_sql.rb
+++ b/test/visitors/test_to_sql.rb
@@ -9,6 +9,12 @@ module Arel
@attr = @table[:id]
end
+ it 'works with BindParams' do
+ node = Nodes::BindParam.new 'omg'
+ sql = @visitor.accept node
+ sql.must_be_like 'omg'
+ end
+
it 'can define a dispatch method' do
visited = false
viz = Class.new(Arel::Visitors::Visitor) {