Sha256: 4df78e27146840b7b92fead04a6ed3b31993edde9434009efa953eae661cd130

Contents?: true

Size: 621 Bytes

Versions: 1

Compression:

Stored size: 621 Bytes

Contents

require 'spec_helper'

describe Whisperer::Serializers do
  describe '.fetch' do
    before do
      described_class.register(:test_json, 'My test class')
    end

    context 'when there is not such serializer' do
      it 'raises an error' do
        expect { described_class.fetch(:mytest) }.to raise_error(
          ArgumentError,
          'There is not serializer registered with "mytest" name'
        )
      end
    end

    context 'when there is such serializer' do
      it 'returns the registered class' do
        expect(described_class.fetch(:test_json)).to eq('My test class')
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
whisperer-0.0.2 spec/unit/serializers_spec.rb