Sha256: 3cb9bb6616eddb8e40670ca04e5bb9fea7606e2ec00c1f88551ba08418c8a1de

Contents?: true

Size: 1.07 KB

Versions: 1

Compression:

Stored size: 1.07 KB

Contents

# encoding: utf-8

require 'spec_helper'
require File.expand_path('../fixtures/classes', __FILE__)

[ :not, :- ].each do |method|
  describe Function::Connective::Negation::Methods, "##{method}" do
    let(:described_class) { NegationMethodsSpecs::Object               }
    let(:header)          { Relation::Header.new([ [ :id, Integer ] ]) }
    let(:object)          { described_class.new                        }

    before do
      def object.eql?(other)
        equal?(other)
      end
      object.freeze
    end

    context 'with no arguments' do
      subject { object.send(method) }

      it { should be_kind_of(Function::Connective::Negation) }

      its(:operand) { should equal(object) }
    end

    context 'when a function is provided' do
      subject { object.send(method, predicate) }

      let(:predicate) { Function::Predicate::Equality.new(header[:id], 1) }

      it { should be_kind_of(Function::Connective::Conjunction) }

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

      its(:right) { should eql(Function::Connective::Negation.new(predicate)) }
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
veritas-0.0.4 spec/unit/veritas/function/connective/negation/methods/not_spec.rb