diff options
author | Bryan Helmkamp <bryan@brynary.com> | 2009-05-18 01:50:50 -0400 |
---|---|---|
committer | Bryan Helmkamp <bryan@brynary.com> | 2009-05-18 01:50:50 -0400 |
commit | 976fb01a5dd812bcb50cc7b576941c76657908f9 (patch) | |
tree | fb79b6867535bbb6487677d1c6bcf00905c2925a | |
parent | eede6962a8c1ee86b49907c1937fb0e3a38cf819 (diff) | |
download | rails-976fb01a5dd812bcb50cc7b576941c76657908f9.tar.gz rails-976fb01a5dd812bcb50cc7b576941c76657908f9.tar.bz2 rails-976fb01a5dd812bcb50cc7b576941c76657908f9.zip |
Expand sql engine CRUD specs
-rw-r--r-- | spec/arel/engines/sql/unit/engine_spec.rb | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/spec/arel/engines/sql/unit/engine_spec.rb b/spec/arel/engines/sql/unit/engine_spec.rb index 67a5d62320..c607abcfa1 100644 --- a/spec/arel/engines/sql/unit/engine_spec.rb +++ b/spec/arel/engines/sql/unit/engine_spec.rb @@ -3,32 +3,41 @@ require File.join(File.dirname(__FILE__), '..', '..', '..', '..', 'spec_helper') module Arel describe Sql::Engine do before do - @relation = Table.new(:users) + @users = Table.new(:users) + @users.delete end describe "CRUD" do describe "#create" do it "inserts into the relation" do - @relation.insert @relation[:name] => "Bryan" + @users.insert @users[:name] => "Bryan" + @users.first[@users[:name]].should == "Bryan" end end describe "#read" do it "reads from the relation" do - @relation.each do |row| + @users.insert @users[:name] => "Bryan" + + @users.each do |row| + row[@users[:name]].should == "Bryan" end end end describe "#update" do it "updates the relation" do - @relation.update @relation[:name] => "Bryan" + @users.insert @users[:name] => "Nick" + @users.update @users[:name] => "Bryan" + @users.first[@users[:name]].should == "Bryan" end end describe "#delete" do it "deletes from the relation" do - @relation.delete + @users.insert @users[:name] => "Bryan" + @users.delete + @users.first.should == nil end end end |