Sha256: 65d8ecdcf5bc7cf35da6f1d79ffe2514a63d1dac0f3742b8ebf4caad0402eb5b
Contents?: true
Size: 1.02 KB
Versions: 4
Compression:
Stored size: 1.02 KB
Contents
# encoding: utf-8 require 'spec_helper' describe Optimizer::Function::Binary::ConstantOperands, '#optimizable?' do subject { object.optimizable? } let(:described_class) { Class.new(Optimizer) { include Optimizer::Function::Binary } } let(:function) { Class.new(Veritas::Function) { include Veritas::Function::Binary }.new(left, right) } let(:object) { described_class.new(function) } before do described_class.class_eval { include Optimizer::Function::Binary::ConstantOperands } end context 'when left and right are constants' do let(:left) { 1 } let(:right) { 1 } it { should be(true) } end context 'when left is a constant, and right is not a constant' do let(:left) { 1 } let(:right) { proc {} } it { should be(false) } end context 'when left is not a constant, and right is a constant' do let(:left) { proc {} } let(:right) { 1 } it { should be(false) } end end
Version data entries
4 entries across 4 versions & 1 rubygems