Sha256: 6970259ac1abef4e2df8718e9614806ce3b216062af0bbdae7222caf98f6316a

Contents?: true

Size: 741 Bytes

Versions: 2

Compression:

Stored size: 741 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

describe Optimizer::Function::Connective::Binary::EqualOperands, '#optimizable?' do
  subject { object.optimizable? }

  let(:attribute)  { Attribute::Integer.new(:id)     }
  let(:connective) { left.and(right)                 }
  let(:object)     { described_class.new(connective) }

  before do
    expect(object.operation).to be_kind_of(Function::Connective::Binary)
  end

  context 'when left and right are equivalent' do
    let(:left)  { attribute.eq(1) }
    let(:right) { attribute.eq(1) }

    it { should be(true) }
  end

  context 'when left and right are not equivalent' do
    let(:left)  { attribute.eq(1) }
    let(:right) { attribute.ne(1) }

    it { should be(false) }
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
axiom-optimizer-0.2.0 spec/unit/axiom/optimizer/function/connective/binary/equal_operands/optimizable_predicate_spec.rb
axiom-optimizer-0.1.1 spec/unit/axiom/optimizer/function/connective/binary/equal_operands/optimizable_predicate_spec.rb