diff options
author | Matthew Draper <matthew@trebex.net> | 2018-02-24 17:04:15 +1030 |
---|---|---|
committer | Matthew Draper <matthew@trebex.net> | 2018-02-24 17:15:32 +1030 |
commit | 17ca17072dcdff11b3702a6b45f2fb0c8f8fe9a4 (patch) | |
tree | 38afd3ed74f8afda1c2959fefbc13f70b2e448e2 /activerecord/test/cases/arel/nodes/window_test.rb | |
parent | 5ecbeda0e225e4961977b5c516088cf12d92319f (diff) | |
parent | eb3f968b5ffdd3b343e7d190f1aa0b36864f56a2 (diff) | |
download | rails-17ca17072dcdff11b3702a6b45f2fb0c8f8fe9a4.tar.gz rails-17ca17072dcdff11b3702a6b45f2fb0c8f8fe9a4.tar.bz2 rails-17ca17072dcdff11b3702a6b45f2fb0c8f8fe9a4.zip |
Merge Arel into Active Record
Diffstat (limited to 'activerecord/test/cases/arel/nodes/window_test.rb')
-rw-r--r-- | activerecord/test/cases/arel/nodes/window_test.rb | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/activerecord/test/cases/arel/nodes/window_test.rb b/activerecord/test/cases/arel/nodes/window_test.rb new file mode 100644 index 0000000000..81ecd5ced8 --- /dev/null +++ b/activerecord/test/cases/arel/nodes/window_test.rb @@ -0,0 +1,80 @@ +# frozen_string_literal: true +require_relative '../helper' + +module Arel + module Nodes + describe 'Window' do + describe 'equality' do + it 'is equal with equal ivars' do + window1 = Window.new + window1.orders = [1, 2] + window1.partitions = [1] + window1.frame 3 + window2 = Window.new + window2.orders = [1, 2] + window2.partitions = [1] + window2.frame 3 + array = [window1, window2] + assert_equal 1, array.uniq.size + end + + it 'is not equal with different ivars' do + window1 = Window.new + window1.orders = [1, 2] + window1.partitions = [1] + window1.frame 3 + window2 = Window.new + window2.orders = [1, 2] + window1.partitions = [1] + window2.frame 4 + array = [window1, window2] + assert_equal 2, array.uniq.size + end + end + end + + describe 'NamedWindow' do + describe 'equality' do + it 'is equal with equal ivars' do + window1 = NamedWindow.new 'foo' + window1.orders = [1, 2] + window1.partitions = [1] + window1.frame 3 + window2 = NamedWindow.new 'foo' + window2.orders = [1, 2] + window2.partitions = [1] + window2.frame 3 + array = [window1, window2] + assert_equal 1, array.uniq.size + end + + it 'is not equal with different ivars' do + window1 = NamedWindow.new 'foo' + window1.orders = [1, 2] + window1.partitions = [1] + window1.frame 3 + window2 = NamedWindow.new 'bar' + window2.orders = [1, 2] + window2.partitions = [1] + window2.frame 3 + array = [window1, window2] + assert_equal 2, array.uniq.size + end + end + end + + describe 'CurrentRow' do + describe 'equality' do + it 'is equal to other current row nodes' do + array = [CurrentRow.new, CurrentRow.new] + assert_equal 1, array.uniq.size + end + + it 'is not equal with other nodes' do + array = [CurrentRow.new, Node.new] + assert_equal 2, array.uniq.size + end + end + end + end +end |