aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_update_manager.rb
diff options
context:
space:
mode:
authorJon Leighton <j@jonathanleighton.com>2011-08-08 16:41:32 +0100
committerJon Leighton <j@jonathanleighton.com>2011-08-08 16:41:32 +0100
commit8fe010a5370f5249de962e1ad345d29a00aec70d (patch)
treeba2db9697983f43f01564c387a4833866c841f57 /test/test_update_manager.rb
parentac4fe778577c8b1eea641ef04b4d2b81fc54694d (diff)
downloadrails-8fe010a5370f5249de962e1ad345d29a00aec70d.tar.gz
rails-8fe010a5370f5249de962e1ad345d29a00aec70d.tar.bz2
rails-8fe010a5370f5249de962e1ad345d29a00aec70d.zip
Support update statements containing joins
Diffstat (limited to 'test/test_update_manager.rb')
-rw-r--r--test/test_update_manager.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/test_update_manager.rb b/test/test_update_manager.rb
index 62a2eccaf5..3099fb367e 100644
--- a/test/test_update_manager.rb
+++ b/test/test_update_manager.rb
@@ -62,6 +62,19 @@ module Arel
um = Arel::UpdateManager.new Table.engine
um.table(Table.new(:users)).must_equal um
end
+
+ it 'generates an update statement with joins' do
+ um = Arel::UpdateManager.new Table.engine
+
+ table = Table.new(:users)
+ join_source = Arel::Nodes::JoinSource.new(
+ table,
+ [table.create_join(Table.new(:posts))]
+ )
+
+ um.table join_source
+ um.to_sql.must_be_like %{ UPDATE "users" INNER JOIN "posts" }
+ end
end
describe 'where' do