Sha256: fd852d6c94bd6d24418ab7e1858889b92b31f8257a4f8099e9593fc207c64b6a

Contents?: true

Size: 1000 Bytes

Versions: 1

Compression:

Stored size: 1000 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

describe Relation::Operation::Insertion::Methods, '#insert' do
  subject { object.insert(other) }

  let(:object) { Relation.new([ [ :id, Integer ] ], [ [ 1 ] ]) }
  let(:tuples) { [ [ 2 ] ]                                     }

  context 'when other is a Relation' do
    let(:other) { Relation.new([ [ :id, Integer ] ], tuples) }

    it { should be_instance_of(Relation::Operation::Insertion) }

    its(:left) { should be(object) }

    its(:right) { should be(other) }

    it 'returns the expected tuples' do
      should == [ [ 1 ], [ 2 ] ]
    end
  end

  context 'when other is an Enumerable' do
    let(:other) { tuples }

    it { should be_instance_of(Relation::Operation::Insertion) }

    its(:left) { should be(object) }

    its(:right) { should_not be(other) }

    its(:right) { should be_kind_of(Relation) }

    its(:right) { should == other }

    it 'returns the expected tuples' do
      should == [ [ 1 ], [ 2 ] ]
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
axiom-0.1.0 spec/unit/axiom/relation/operation/insertion/methods/insert_spec.rb