diff options
Diffstat (limited to 'spec')
-rw-r--r-- | spec/arel/insert_manager_spec.rb | 5 | ||||
-rw-r--r-- | spec/arel/select_manager_spec.rb | 15 |
2 files changed, 17 insertions, 3 deletions
diff --git a/spec/arel/insert_manager_spec.rb b/spec/arel/insert_manager_spec.rb index ed0725e79d..807f1324d2 100644 --- a/spec/arel/insert_manager_spec.rb +++ b/spec/arel/insert_manager_spec.rb @@ -88,7 +88,7 @@ module Arel manager = Arel::InsertManager.new Table.engine manager.into table - manager.values << 1 + manager.values = Nodes::Values.new [1] manager.to_sql.should be_like %{ INSERT INTO "users" VALUES (1) } @@ -101,8 +101,7 @@ module Arel manager = Arel::InsertManager.new Table.engine manager.into table - manager.values << 1 - manager.values << "aaron" + manager.values = Nodes::Values.new [1, 'aaron'] manager.columns << table[:id] manager.columns << table[:name] manager.to_sql.should be_like %{ diff --git a/spec/arel/select_manager_spec.rb b/spec/arel/select_manager_spec.rb index 0b45b8180c..883a518aca 100644 --- a/spec/arel/select_manager_spec.rb +++ b/spec/arel/select_manager_spec.rb @@ -22,9 +22,24 @@ module Arel end alias :update :execute alias :delete :execute + alias :insert :execute end describe 'select manager' do + describe 'insert' do + it 'uses the select FROM' do + engine = EngineProxy.new Table.engine + table = Table.new :users + manager = Arel::SelectManager.new engine + manager.from table + manager.insert 'VALUES(NULL)' + + engine.executed.last.should be_like %{ + INSERT INTO "users" VALUES(NULL) + } + end + end + describe 'lock' do # This should fail on other databases it 'adds a lock node' do |