aboutsummaryrefslogtreecommitdiffstats
path: root/test/nodes/test_select_core.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/nodes/test_select_core.rb')
-rw-r--r--test/nodes/test_select_core.rb38
1 files changed, 38 insertions, 0 deletions
diff --git a/test/nodes/test_select_core.rb b/test/nodes/test_select_core.rb
index 4382c79865..e4ed06b853 100644
--- a/test/nodes/test_select_core.rb
+++ b/test/nodes/test_select_core.rb
@@ -26,6 +26,44 @@ module Arel
viz = Arel::Visitors::ToSql.new Table.engine.connection_pool
assert_match 'DISTINCT', viz.accept(core)
end
+
+ def test_equality_with_same_ivars
+ core1 = SelectCore.new
+ core1.froms = %w[a b c]
+ core1.projections = %w[d e f]
+ core1.wheres = %w[g h i]
+ core1.groups = %w[j k l]
+ core1.windows = %w[m n o]
+ core1.having = %w[p q r]
+ core2 = SelectCore.new
+ core2.froms = %w[a b c]
+ core2.projections = %w[d e f]
+ core2.wheres = %w[g h i]
+ core2.groups = %w[j k l]
+ core2.windows = %w[m n o]
+ core2.having = %w[p q r]
+ array = [core1, core2]
+ assert_equal 1, array.uniq.size
+ end
+
+ def test_inequality_with_different_ivars
+ core1 = SelectCore.new
+ core1.froms = %w[a b c]
+ core1.projections = %w[d e f]
+ core1.wheres = %w[g h i]
+ core1.groups = %w[j k l]
+ core1.windows = %w[m n o]
+ core1.having = %w[p q r]
+ core2 = SelectCore.new
+ core2.froms = %w[a b c]
+ core2.projections = %w[d e f]
+ core2.wheres = %w[g h i]
+ core2.groups = %w[j k l]
+ core2.windows = %w[m n o]
+ core2.having = %w[l o l]
+ array = [core1, core2]
+ assert_equal 2, array.uniq.size
+ end
end
end
end