Sha256: 46f85173d52c813907300e6502ac31cfdf3d7652f25e76f3a3167f65fda26edd
Contents?: true
Size: 930 Bytes
Versions: 4
Compression:
Stored size: 930 Bytes
Contents
# encoding: utf-8 require 'spec_helper' describe Function, '#optimize' do subject { object.optimize(*args) } let(:described_class) { Class.new(Function) } let(:object) { described_class.new } before do described_class.class_eval do def eql?(other) instance_of?(other.class) end end end context 'with no optimizer' do let(:args) { [] } it 'calls self.class.optimizer' do described_class.should_receive(:optimizer).and_return(nil) subject end it 'returns self' do should equal(object) end it_should_behave_like 'an optimize method' end context 'with an optimizer' do let(:optimized) { described_class.new } let(:args) { [ lambda { |relation| optimized } ] } it 'returns an optimized expression' do should equal(optimized) end it_should_behave_like 'an optimize method' end end
Version data entries
4 entries across 4 versions & 1 rubygems