Sha256: 93d794fdb82bfa962348ef1d94e2fc904c13a962d83c7094b91da75741aef9cd

Contents?: true

Size: 824 Bytes

Versions: 2

Compression:

Stored size: 824 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

describe Adamantium::Freezer, '.parse' do
  subject { object.parse(options) }

  let(:object)  { described_class     }
  let(:freezer) { mock('Freezer')     }

  context 'with empty options' do
    let(:options) { {}             }
    it            { should be(nil) }
  end

  context 'with :freezer key' do
    let(:options) { { :freezer => name } }
    let(:name)    { mock('Name')         }

    it 'should get freezer' do
      described_class.should_receive(:get).with(name).and_return(freezer)
      should be(freezer)
    end
  end

  context 'with any other key' do
    let(:options) { { :other => :key } }

    it 'should raise error' do
      expect { subject }.to raise_error(described_class::OptionError, 'Unknown option key(s) for memoizer [:other]')
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
adamantium-0.0.8 spec/unit/adamantium/freezer/class_methods/parse_spec.rb
adamantium-0.0.7 spec/unit/adamantium/freezer/class_methods/parse_spec.rb