From 8c73dad0761980061ce45018172034cad34cd585 Mon Sep 17 00:00:00 2001 From: Tamir Duberstein Date: Sat, 13 Sep 2014 19:35:34 -0700 Subject: `Extract#as` should not mutate the receiver Fixes https://github.com/rails/rails/issues/16913 --- test/nodes/test_extract.rb | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'test') diff --git a/test/nodes/test_extract.rb b/test/nodes/test_extract.rb index 80bb465f24..eb98553268 100644 --- a/test/nodes/test_extract.rb +++ b/test/nodes/test_extract.rb @@ -15,6 +15,14 @@ describe Arel::Nodes::Extract do EXTRACT(DATE FROM "users"."timestamp") AS foo } end + + it 'should not mutate the extract' do + table = Arel::Table.new :users + extract = table[:timestamp].extract('date') + before = extract.dup + extract.as('foo') + assert_equal extract, before + end end describe 'equality' do -- cgit v1.2.3