blob: f782f56938f35b68a476fbb6e015a8eec58822e0 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
require 'spec_helper'
module Arel
describe Sql::Engine do
before do
@users = Table.new(:users)
@users.delete
end
describe "CRUD" do
describe "#create" do
it "inserts into the relation" do
@users.insert @users[:name] => "Bryan"
@users.first[@users[:name]].should == "Bryan"
end
end
describe "#read" do
it "reads from the relation" do
@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
@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
@users.insert @users[:name] => "Bryan"
@users.delete
@users.first.should == nil
end
end
end
end
end
|