Sha256: 00cd705f38772f79e068730fa79ab86bca8a3a1399b76555164824b4b2af3bba

Contents?: true

Size: 802 Bytes

Versions: 4

Compression:

Stored size: 802 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

describe Optimizer::Function::Unary::ConstantOperand, '#optimizable?' do
  subject { object.optimizable? }

  let(:described_class) { Class.new(Optimizer) { include Optimizer::Function::Unary }                    }
  let(:function)        { Class.new(Veritas::Function) { include Veritas::Function::Unary }.new(operand) }
  let(:object)          { described_class.new(function)                                                  }

  before do
    described_class.class_eval { include Optimizer::Function::Unary::ConstantOperand }
  end

  context 'when the operand is a constant' do
    let(:operand) { 1 }

    it { should be(true) }
  end

  context 'when the operand is not a constant' do
    let(:operand) { proc {} }

    it { should be(false) }
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
veritas-optimizer-0.0.7 spec/unit/veritas/optimizer/function/unary/constant_operand/optimizable_spec.rb
veritas-optimizer-0.0.6 spec/unit/veritas/optimizer/function/unary/constant_operand/optimizable_spec.rb
veritas-optimizer-0.0.5 spec/unit/veritas/optimizer/function/unary/constant_operand/optimizable_spec.rb
veritas-optimizer-0.0.4 spec/unit/veritas/optimizer/function/unary/constant_operand/optimizable_spec.rb