Sha256: 69a1a858f7f736f9d1a58a98accc28ff6380ffd43e4b6db42b5d8fafd2e7b9cb

Contents?: true

Size: 968 Bytes

Versions: 2

Compression:

Stored size: 968 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

2 entries across 2 versions & 1 rubygems

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