Sha256: 3979d4e1142f561a53ac4d3291d94ec1f075f39619759cfde345846c6903be14

Contents?: true

Size: 749 Bytes

Versions: 1

Compression:

Stored size: 749 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(Function) { include 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

1 entries across 1 versions & 1 rubygems

Version Path
axiom-optimizer-0.2.0 spec/unit/axiom/optimizer/function/unary/constant_operand/optimizable_predicate_spec.rb