Sha256: fbbad4f672af73ca7208d0464cd7ddd7af6d3f05bfd724738eafb5a939d39c1f

Contents?: true

Size: 686 Bytes

Versions: 4

Compression:

Stored size: 686 Bytes

Contents

require 'update_helper'
module Alf
  module Update
    describe Inserter, 'group' do

      let(:expr)     { group(suppliers, [:foo], :bar) }
      let(:inserted) { [
        {:name => "Jones", :bar => Relation(:foo => [12, 13]) },
        {:name => "Smith", :bar => Relation(:foo => [15])     }
      ] }
      let(:expected) { [
        {:name => "Jones", :foo => 12},
        {:name => "Jones", :foo => 13},
        {:name => "Smith", :foo => 15}
      ] }

      subject{ insert(expr, inserted) }

      it 'requests the insertion of the tuples on :suppliers' do
        subject
        db_context.requests.should eq([ [:insert, :suppliers, expected] ])
      end

    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
alf-core-0.15.0 spec/unit/alf-update/inserter/test_group.rb
alf-core-0.14.0 spec/unit/alf-update/inserter/test_group.rb
alf-core-0.13.1 spec/unit/alf-update/inserter/test_group.rb
alf-core-0.13.0 spec/unit/alf-update/inserter/test_group.rb