Permalink
Browse files

add UpdateManager#key method to access the key

  • Loading branch information...
1 parent 4f416f4 commit 160917526a8d038d4fbb4d90635e26a9df8d8871 @jonleighton jonleighton committed Aug 11, 2011
Showing with 20 additions and 0 deletions.
  1. +4 −0 lib/arel/update_manager.rb
  2. +16 −0 test/test_update_manager.rb
@@ -15,6 +15,10 @@ def key= key
@ast.key = key
end
+ def key
+ @ast.key
+ end
+
def order *expr
@ast.orders = expr
self
@@ -95,5 +95,21 @@ module Arel
um.where(table[:id].eq(1)).must_equal um
end
end
+
+ describe 'key' do
+ before do
+ @table = Table.new :users
+ @um = Arel::UpdateManager.new Table.engine
+ @um.key = @table[:foo]
+ end
+
+ it 'can be set' do
+ @um.ast.key.must_equal @table[:foo]
+ end
+
+ it 'can be accessed' do
+ @um.key.must_equal @table[:foo]
+ end
+ end
end
end

0 comments on commit 1609175

Please sign in to comment.