aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorTamir Duberstein <tamird@squareup.com>2014-09-13 19:35:34 -0700
committerTamir Duberstein <tamird@squareup.com>2014-09-13 20:04:34 -0700
commit8c73dad0761980061ce45018172034cad34cd585 (patch)
tree12f140e8dcece55f591591f6da95d15b17db0780 /test
parentd23df0ec8a50b50024f8d4dc5d91a47509df9b1f (diff)
downloadrails-8c73dad0761980061ce45018172034cad34cd585.tar.gz
rails-8c73dad0761980061ce45018172034cad34cd585.tar.bz2
rails-8c73dad0761980061ce45018172034cad34cd585.zip
`Extract#as` should not mutate the receiver
Fixes https://github.com/rails/rails/issues/16913
Diffstat (limited to 'test')
-rw-r--r--test/nodes/test_extract.rb8
1 files changed, 8 insertions, 0 deletions
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