diff options
author | Bryan Helmkamp <bryan@brynary.com> | 2008-01-14 10:50:46 -0500 |
---|---|---|
committer | Bryan Helmkamp <bryan@brynary.com> | 2008-01-14 10:50:46 -0500 |
commit | 553eb0ad490abc7f85d9836c3ba959ab771d3cf4 (patch) | |
tree | baa9714465488d77980e8d252a82849b32844d3b /spec/active_relation/relations/insertion_spec.rb | |
parent | 17a5fd13bc4ba8405d95e90d12b87dcd7e5bea5b (diff) | |
download | rails-553eb0ad490abc7f85d9836c3ba959ab771d3cf4.tar.gz rails-553eb0ad490abc7f85d9836c3ba959ab771d3cf4.tar.bz2 rails-553eb0ad490abc7f85d9836c3ba959ab771d3cf4.zip |
Remove ActiveRelation sub-modules and refactor specs
Diffstat (limited to 'spec/active_relation/relations/insertion_spec.rb')
-rw-r--r-- | spec/active_relation/relations/insertion_spec.rb | 40 |
1 files changed, 21 insertions, 19 deletions
diff --git a/spec/active_relation/relations/insertion_spec.rb b/spec/active_relation/relations/insertion_spec.rb index da39edf773..f16ab8cc23 100644 --- a/spec/active_relation/relations/insertion_spec.rb +++ b/spec/active_relation/relations/insertion_spec.rb @@ -1,26 +1,28 @@ require File.join(File.dirname(__FILE__), '..', '..', 'spec_helper') -describe ActiveRelation::Relations::Insertion do - before do - @relation = ActiveRelation::Relations::Table.new(:users) - end - - describe '#to_sql' do - it 'manufactures sql inserting the data for one item' do - ActiveRelation::Relations::Insertion.new(@relation, @relation[:name] => "nick").to_sql.should be_like(""" - INSERT - INTO `users` - (`users`.`name`) VALUES ('nick') - """) +module ActiveRelation + describe Insertion do + before do + @relation = Table.new(:users) end + + describe '#to_sql' do + it 'manufactures sql inserting the data for one item' do + Insertion.new(@relation, @relation[:name] => "nick").to_sql.should be_like(""" + INSERT + INTO `users` + (`users`.`name`) VALUES ('nick') + """) + end - it 'manufactures sql inserting the data for multiple items' do - nested_insertion = ActiveRelation::Relations::Insertion.new(@relation, @relation[:name] => "cobra") - ActiveRelation::Relations::Insertion.new(nested_insertion, nested_insertion[:name] => "commander").to_sql.should be_like(""" - INSERT - INTO `users` - (`users`.`name`) VALUES ('cobra'), ('commander') - """) + it 'manufactures sql inserting the data for multiple items' do + nested_insertion = Insertion.new(@relation, @relation[:name] => "cobra") + Insertion.new(nested_insertion, nested_insertion[:name] => "commander").to_sql.should be_like(""" + INSERT + INTO `users` + (`users`.`name`) VALUES ('cobra'), ('commander') + """) + end end end end
\ No newline at end of file |