Sha256: 5312dfa1317ffdb856bed3b948614c0516b585d4d14580a8b5f422609cab0d32

Contents?: true

Size: 1.07 KB

Versions: 2

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.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 be(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 be(object) }

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
axiom-0.2.0 spec/unit/axiom/function/connective/negation/methods/not_spec.rb
axiom-0.1.1 spec/unit/axiom/function/connective/negation/methods/not_spec.rb