aboutsummaryrefslogtreecommitdiffstats
path: root/spec/algebra/integration/basic_spec.rb
blob: ae9da3a03763a2fb6b8093584557e1e0864f3f53 (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
require 'spec_helper'

module Arel
  describe "Relation" do
    before :all do
      @engine = Testing::Engine.new
      @relation = Model.build do |r|
        r.engine @engine

        r.attribute :id,   Attributes::Integer
        r.attribute :name, Attributes::String
        r.attribute :age,  Attributes::Integer
      end
    end

    describe "..." do
      before :all do
        @expected = (1..20).map { |i| @relation.insert([i, nil, 2 * i]) }
      end

      it_should_behave_like 'A Relation'
    end

    describe "#insert" do
      it "inserts the row into the engine" do
        @relation.insert([1, 'Foo', 10])
        @engine.rows.should == [[1, 'Foo', 10]]
      end
    end
  end
end