Sha256: ed595d8965d9cb24c931e422d27ff65b85a27c1cf513862283139f5379a018ff
Contents?: true
Size: 1.35 KB
Versions: 4
Compression:
Stored size: 1.35 KB
Contents
require 'spec_helper' module Arel describe Deletion do before do @relation = Table.new(:users) end describe '#to_sql' do it 'manufactures sql deleting a table relation' do sql = Deletion.new(@relation).to_sql adapter_is :mysql do sql.should be_like(%Q{DELETE FROM `users`}) end adapter_is_not :mysql do sql.should be_like(%Q{DELETE FROM "users"}) end end it 'manufactures sql deleting a where relation' do sql = Deletion.new(@relation.where(@relation[:id].eq(1))).to_sql adapter_is :mysql do sql.should be_like(%Q{ DELETE FROM `users` WHERE `users`.`id` = 1 }) end adapter_is_not :mysql do sql.should be_like(%Q{ DELETE FROM "users" WHERE "users"."id" = 1 }) end end it "manufactures sql deleting a ranged relation" do sql = Deletion.new(@relation.take(1)).to_sql adapter_is :mysql do sql.should be_like(%Q{ DELETE FROM `users` LIMIT 1 }) end adapter_is_not :mysql do sql.should be_like(%Q{ DELETE FROM "users" LIMIT 1 }) end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems