Sha256: 739679de9550eb20513765ea5cf65cbb306c316381c044eac63fc7b2bf60f9de

Contents?: true

Size: 877 Bytes

Versions: 4

Compression:

Stored size: 877 Bytes

Contents

require 'spec_helper'
module Alf
  class Database
    describe Connection, "tuple_extract" do

      let(:conn){ sap_conn }

      context 'when more than one tuple' do
        subject{ conn.tuple_extract{ suppliers } }

        it 'raises a NoSuchTupleError' do
          lambda{
            subject
          }.should raise_error(NoSuchTupleError)
        end
      end

      context 'when zero tuple' do
        subject{ conn.tuple_extract{ restrict(suppliers, ->{ false }) } }

        it 'raises a NoSuchTupleError' do
          lambda{
            subject
          }.should raise_error(NoSuchTupleError)
        end
      end

      context 'when exactly one tuple' do
        subject{ conn.tuple_extract{ restrict(suppliers, ->{ sid == 'S1' }) } }

        it 'returns a Tuple instance' do
          subject.should be_a(Tuple)
        end
      end

    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
alf-core-0.15.0 spec/unit/alf-database/connection/test_tuple_extract.rb
alf-core-0.14.0 spec/unit/alf-database/connection/test_tuple_extract.rb
alf-core-0.13.1 spec/unit/alf-database/connection/test_tuple_extract.rb
alf-core-0.13.0 spec/unit/alf-database/connection/test_tuple_extract.rb