Sha256: b4f3387c86910381de4515913d98dbce31edf5c41873edb911af3e49c4e954eb
Contents?: true
Size: 997 Bytes
Versions: 2
Compression:
Stored size: 997 Bytes
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(Function) { include 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
2 entries across 2 versions & 1 rubygems