diff options
-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 |