From 112617766915b0068027b4ac809dad8129c88e81 Mon Sep 17 00:00:00 2001 From: Dimko Date: Tue, 18 Sep 2012 12:27:33 +0400 Subject: added a visitor for Set objects --- test/visitors/test_depth_first.rb | 8 ++++++++ test/visitors/test_to_sql.rb | 5 +++++ 2 files changed, 13 insertions(+) (limited to 'test/visitors') diff --git a/test/visitors/test_depth_first.rb b/test/visitors/test_depth_first.rb index 05360ff6e8..38d12b487c 100644 --- a/test/visitors/test_depth_first.rb +++ b/test/visitors/test_depth_first.rb @@ -1,4 +1,5 @@ require 'helper' +require 'set' module Arel module Visitors @@ -159,6 +160,13 @@ module Arel assert_equal [:a, :b, node, list], @collector.calls end + def test_set + node = Nodes::Or.new(:a, :b) + set = Set.new([node]) + @visitor.accept set + assert_equal [:a, :b, node, set], @collector.calls + end + def test_hash node = Nodes::Or.new(:a, :b) hash = { node => node } diff --git a/test/visitors/test_to_sql.rb b/test/visitors/test_to_sql.rb index 1caedacd45..2164e68cb7 100644 --- a/test/visitors/test_to_sql.rb +++ b/test/visitors/test_to_sql.rb @@ -1,4 +1,5 @@ require 'helper' +require 'set' module Arel module Visitors @@ -114,6 +115,10 @@ module Arel @visitor.accept({:a => 1}) end + it "should visit_Set" do + @visitor.accept Set.new([1, 2]) + end + it "should visit_BigDecimal" do @visitor.accept BigDecimal.new('2.14') end -- cgit v1.2.3