Sha256: 78760148f4a842186b67ba4996fe0abd3ea204c1e541380c9f9ade889267f36a

Contents?: true

Size: 1.08 KB

Versions: 1

Compression:

Stored size: 1.08 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.coerce([ [ :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_instance_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_instance_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
axiom-0.1.0 spec/unit/axiom/function/connective/negation/methods/not_spec.rb