Sha256: 0d9a43af255260236938e8c1b922e1a72843bb8981ca99d74da2eafa5ca3e49f

Contents?: true

Size: 860 Bytes

Versions: 4

Compression:

Stored size: 860 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

describe Optimizer::Optimizable::ClassMethods, '#optimizer' do
  subject { object.optimizer }

  let(:object) { Class.new { include Optimizer::Optimizable, Immutable } }

  context 'when the optimizer is not set' do
    it { should be_nil }
  end

  context 'when the optimizer is set' do
    let(:optimizer) { mock('Optimizer') }

    before do
      object.optimizer = optimizer
    end

    it { should equal(optimizer) }
  end
end

describe Optimizer::Optimizable::ClassMethods, '#optimizer=' do
  subject { object.optimizer = optimizer }

  let(:optimizer) { mock('Optimizer')                                       }
  let(:object)    { Class.new { include Optimizer::Optimizable, Immutable } }

  it 'sets the optimizer' do
    expect { subject }.to change { object.optimizer }.from(nil).to(optimizer)
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
veritas-optimizer-0.0.7 spec/unit/veritas/optimizer/optimizable/class_methods/optimizer_spec.rb
veritas-optimizer-0.0.6 spec/unit/veritas/optimizer/optimizable/class_methods/optimizer_spec.rb
veritas-optimizer-0.0.5 spec/unit/veritas/optimizer/optimizable/class_methods/optimizer_spec.rb
veritas-optimizer-0.0.4 spec/unit/veritas/optimizer/optimizable/class_methods/optimizer_spec.rb