Sha256: 1be080405c317bddc72849092725ca563e47608d99b4f4424974e6859a8a5a7c

Contents?: true

Size: 808 Bytes

Versions: 4

Compression:

Stored size: 808 Bytes

Contents

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

      let(:conn){ sap_conn }

      context 'with the result is not empty' do
        subject{ conn.assert!{ suppliers } }

        it{ should be_true }
      end

      context 'with the result is empty' do
        subject{ conn.assert!{ restrict(suppliers, ->{false}) } }

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

      context 'with an error message' do
        subject{ conn.assert!("foo"){ restrict(suppliers, ->{false}) } }

        it 'raises a AssertionError' do
          lambda{
            subject
          }.should raise_error(FactAssertionError, /foo/)
        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_assert.rb
alf-core-0.14.0 spec/unit/alf-database/connection/test_assert.rb
alf-core-0.13.1 spec/unit/alf-database/connection/test_assert.rb
alf-core-0.13.0 spec/unit/alf-database/connection/test_assert.rb