aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2014-09-16 10:38:20 -0300
committerRafael Mendonça França <rafaelmfranca@gmail.com>2014-09-16 10:38:20 -0300
commit016bce4ef10eac48fab44205dcf7961e5b0bc094 (patch)
tree12f140e8dcece55f591591f6da95d15b17db0780 /test
parentd23df0ec8a50b50024f8d4dc5d91a47509df9b1f (diff)
parent8c73dad0761980061ce45018172034cad34cd585 (diff)
downloadrails-016bce4ef10eac48fab44205dcf7961e5b0bc094.tar.gz
rails-016bce4ef10eac48fab44205dcf7961e5b0bc094.tar.bz2
rails-016bce4ef10eac48fab44205dcf7961e5b0bc094.zip
Merge pull request #311 from tamird/master
`Extract#as` should not mutate the receiver
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