1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/test/visitors/test_dot.rb

56 lines
1.4 KiB
Ruby
Raw Normal View History

2010-12-06 12:36:02 -05:00
require 'helper'
module Arel
module Visitors
class TestDot < MiniTest::Unit::TestCase
def setup
@visitor = Visitors::Dot.new
end
# unary ops
[
Arel::Nodes::Not,
Arel::Nodes::Group,
Arel::Nodes::On,
Arel::Nodes::Grouping,
Arel::Nodes::Offset,
Arel::Nodes::Having,
Arel::Nodes::UnqualifiedColumn,
].each do |klass|
define_method("test_#{klass.name.gsub('::', '_')}") do
op = klass.new(:a)
@visitor.accept op
end
end
2010-12-25 14:14:30 -05:00
# binary ops
[
Arel::Nodes::Assignment,
Arel::Nodes::Between,
Arel::Nodes::DoesNotMatch,
Arel::Nodes::Equality,
Arel::Nodes::GreaterThan,
Arel::Nodes::GreaterThanOrEqual,
Arel::Nodes::In,
Arel::Nodes::LessThan,
Arel::Nodes::LessThanOrEqual,
Arel::Nodes::Matches,
Arel::Nodes::NotEqual,
Arel::Nodes::NotIn,
Arel::Nodes::Or,
Arel::Nodes::TableAlias,
Arel::Nodes::Values,
Arel::Nodes::As,
Arel::Nodes::DeleteStatement,
Arel::Nodes::Ordering,
Arel::Nodes::JoinSource,
].each do |klass|
define_method("test_#{klass.name.gsub('::', '_')}") do
binary = klass.new(:a, :b)
@visitor.accept binary
end
end
2010-12-06 12:36:02 -05:00
end
end
end