Sha256: f3cd6bfcdacfa0cf62d9fe41a15d32ad41a925125d96f2f4d3a46281abf28a6e

Contents?: true

Size: 762 Bytes

Versions: 6

Compression:

Stored size: 762 Bytes

Contents

require 'spec_helper'

module Arel
  describe Array do
    before do
      @relation = Array.new([
        [1, 'duck' ],
        [2, 'duck' ],
        [3, 'goose']
      ], [:id, :name])
    end

    describe '#attributes' do
      it 'manufactures attributes corresponding to the names given on construction' do
        @relation.attributes.should == [
          Attribute.new(@relation, :id),
          Attribute.new(@relation, :name)
        ]
      end
    end

    describe '#call' do
      it "manufactures an array of hashes of attributes to values" do
        @relation.call.should == [
          Row.new(@relation, [1, 'duck']),
          Row.new(@relation, [2, 'duck']),
          Row.new(@relation, [3, 'goose'])
        ]
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
arel-0.3.1 spec/arel/engines/memory/unit/relations/array_spec.rb
arel-0.3.0 spec/arel/engines/memory/unit/relations/array_spec.rb
arel-0.2.1 spec/arel/engines/memory/unit/relations/array_spec.rb
arel-0.2.0 spec/arel/engines/memory/unit/relations/array_spec.rb
arel-0.2.pre spec/arel/engines/memory/unit/relations/array_spec.rb
arel-0.1.2 spec/arel/engines/memory/unit/relations/array_spec.rb