diff options
author | Emilio Tagua <miloops@gmail.com> | 2009-04-24 17:10:52 -0300 |
---|---|---|
committer | Emilio Tagua <miloops@gmail.com> | 2009-04-24 17:10:52 -0300 |
commit | 1b1fc880bf7129a422901417bd6b9fede292aa7e (patch) | |
tree | 62fa68b6edeed1a61ab13887fa6fafe804abfc8d /spec/arel/unit/relations/update_spec.rb | |
parent | a454d45403cd0b8a24b05b7ff37021e307905825 (diff) | |
download | rails-1b1fc880bf7129a422901417bd6b9fede292aa7e.tar.gz rails-1b1fc880bf7129a422901417bd6b9fede292aa7e.tar.bz2 rails-1b1fc880bf7129a422901417bd6b9fede292aa7e.zip |
Removed table quotings to be SQLite3 compliant. Delete and update will returrn the size of modified records to prevent addional queries to be done.
Diffstat (limited to 'spec/arel/unit/relations/update_spec.rb')
-rw-r--r-- | spec/arel/unit/relations/update_spec.rb | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/spec/arel/unit/relations/update_spec.rb b/spec/arel/unit/relations/update_spec.rb index 08c6da7901..b67369251f 100644 --- a/spec/arel/unit/relations/update_spec.rb +++ b/spec/arel/unit/relations/update_spec.rb @@ -5,32 +5,32 @@ module Arel before do @relation = Table.new(:users) end - + describe '#to_sql' do it "manufactures sql updating attributes when given multiple attributes" do Update.new(@relation, @relation[:id] => 1, @relation[:name] => "nick").to_sql.should be_like(" UPDATE `users` - SET `users`.`id` = 1, `users`.`name` = 'nick' + SET `id` = 1, `name` = 'nick' ") end - + it "manufactures sql updating attributes when given a ranged relation" do Update.new(@relation.take(1), @relation[:name] => "nick").to_sql.should be_like(" UPDATE `users` - SET `users`.`name` = 'nick' + SET `name` = 'nick' LIMIT 1 ") end - + describe 'when given values whose types correspond to the types of the attributes' do before do @update = Update.new(@relation, @relation[:name] => "nick") end - + it 'manufactures sql updating attributes' do @update.to_sql.should be_like(" UPDATE `users` - SET `users`.`name` = 'nick' + SET `name` = 'nick' ") end end @@ -39,15 +39,15 @@ module Arel before do @update = Update.new(@relation, @relation[:id] => '1-asdf') end - + it 'manufactures sql updating attributes' do @update.to_sql.should be_like(" UPDATE `users` - SET `users`.`id` = 1 + SET `id` = 1 ") end end - + describe 'when the relation is a where' do before do @update = Update.new( @@ -55,27 +55,27 @@ module Arel @relation[:name] => "nick" ) end - + it 'manufactures sql updating a where relation' do @update.to_sql.should be_like(" UPDATE `users` - SET `users`.`name` = 'nick' + SET `name` = 'nick' WHERE `users`.`id` = 1 ") end end end - + describe '#call' do before do @update = Update.new(@relation, @relation[:name] => "nick") end - + it 'executes an update on the connection' do mock(connection = Object.new).update(@update.to_sql) @update.call(connection) end end - + end -end
\ No newline at end of file +end |