Sha256: 8b8783b96bdfabd49e2552116851ba3957779993b176b6df3ecc86005ea38fe6
Contents?: true
Size: 1.06 KB
Versions: 1
Compression:
Stored size: 1.06 KB
Contents
# encoding: utf-8 require 'spec_helper' describe Optimizer::Optimizable, '#optimize' do subject { object.optimize } let(:described_class) { Class.new { include Optimizer::Optimizable, Adamantium } } let(:object) { described_class.new } context 'when there is no optimizer for the class' do it { should be(object) } it_should_behave_like 'an optimize method' end context 'when there is an optimizer for the class' do let(:optimized) { double('Optimized', :frozen? => true) } let(:optimizer) { double('Optimizer', call: optimized) } before do described_class.optimizer = optimizer optimized.stub(:optimize).and_return(optimized) end it { should be(optimized) } it 'calls the optimizer with the object' do optimizer.should_receive(:call).with(object).and_return(optimized) should be(optimized) end it '#optimize the optimized object' do optimized.should_receive(:optimize).with(no_args).and_return(optimized) should be(optimized) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
axiom-optimizer-0.1.1 | spec/unit/axiom/optimizer/optimizable/optimize_spec.rb |