aboutsummaryrefslogtreecommitdiffstats
path: root/spec/arel/delete_manager_spec.rb
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2010-08-18 11:32:44 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2010-08-18 11:32:44 -0700
commit0403efa4c6ad926a61dd0d134d63d962238e2c4f (patch)
tree20b815921da4a85f18b8251037eed313f3268eda /spec/arel/delete_manager_spec.rb
parente9a22ec1afa62ed6be75427315a3a650fc41e629 (diff)
downloadrails-0403efa4c6ad926a61dd0d134d63d962238e2c4f.tar.gz
rails-0403efa4c6ad926a61dd0d134d63d962238e2c4f.tar.bz2
rails-0403efa4c6ad926a61dd0d134d63d962238e2c4f.zip
delete manager added
Diffstat (limited to 'spec/arel/delete_manager_spec.rb')
-rw-r--r--spec/arel/delete_manager_spec.rb42
1 files changed, 42 insertions, 0 deletions
diff --git a/spec/arel/delete_manager_spec.rb b/spec/arel/delete_manager_spec.rb
new file mode 100644
index 0000000000..88d4df061a
--- /dev/null
+++ b/spec/arel/delete_manager_spec.rb
@@ -0,0 +1,42 @@
+require 'spec_helper'
+
+module Arel
+ describe 'delete manager' do
+ describe 'new' do
+ it 'takes an engine' do
+ Arel::DeleteManager.new Table.engine
+ end
+ end
+
+ describe 'from' do
+ it 'uses from' do
+ table = Table.new(:users)
+ dm = Arel::DeleteManager.new Table.engine
+ dm.from table
+ dm.to_sql.should be_like %{ DELETE FROM "users" }
+ end
+
+ it 'chains' do
+ table = Table.new(:users)
+ dm = Arel::DeleteManager.new Table.engine
+ check dm.from(table).should == dm
+ end
+ end
+
+ describe 'where' do
+ it 'uses where values' do
+ table = Table.new(:users)
+ dm = Arel::DeleteManager.new Table.engine
+ dm.from table
+ dm.where table[:id].eq(10)
+ dm.to_sql.should be_like %{ DELETE FROM "users" WHERE "users"."id" = 10}
+ end
+
+ it 'chains' do
+ table = Table.new(:users)
+ dm = Arel::DeleteManager.new Table.engine
+ check dm.where(table[:id].eq(10)).should == dm
+ end
+ end
+ end
+end