diff options
Diffstat (limited to 'test/test_delete_manager.rb')
-rw-r--r-- | test/test_delete_manager.rb | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/test/test_delete_manager.rb b/test/test_delete_manager.rb index fd12c5acd2..ece2389d88 100644 --- a/test/test_delete_manager.rb +++ b/test/test_delete_manager.rb @@ -4,21 +4,29 @@ module Arel describe 'delete manager' do describe 'new' do it 'takes an engine' do - Arel::DeleteManager.new Table.engine + Arel::DeleteManager.new end end + it 'handles limit properly' do + table = Table.new(:users) + dm = Arel::DeleteManager.new + dm.take 10 + dm.from table + assert_match(/LIMIT 10/, dm.to_sql) + end + describe 'from' do it 'uses from' do table = Table.new(:users) - dm = Arel::DeleteManager.new Table.engine + dm = Arel::DeleteManager.new dm.from table dm.to_sql.must_be_like %{ DELETE FROM "users" } end it 'chains' do table = Table.new(:users) - dm = Arel::DeleteManager.new Table.engine + dm = Arel::DeleteManager.new dm.from(table).must_equal dm end end @@ -26,7 +34,7 @@ module Arel describe 'where' do it 'uses where values' do table = Table.new(:users) - dm = Arel::DeleteManager.new Table.engine + dm = Arel::DeleteManager.new dm.from table dm.where table[:id].eq(10) dm.to_sql.must_be_like %{ DELETE FROM "users" WHERE "users"."id" = 10} @@ -34,7 +42,7 @@ module Arel it 'chains' do table = Table.new(:users) - dm = Arel::DeleteManager.new Table.engine + dm = Arel::DeleteManager.new dm.where(table[:id].eq(10)).must_equal dm end end |