Sha256: 67261c8be2a4246396bbc2d547cd39a561057dda22434fd9745baf1a3c1d7f4b

Contents?: true

Size: 645 Bytes

Versions: 3

Compression:

Stored size: 645 Bytes

Contents

require 'spec_helper'

RSpec.describe Yaks::Serializer do
  after do
    Yaks::Serializer.instance_variable_set("@serializers", nil)
  end

  it 'allows registering serializers' do
    Yaks::Serializer.register(:some_format, :some_serializer)
    expect(Yaks::Serializer.all[:some_format]).to equal :some_serializer
  end

  it 'should by default have a serializer for JSON' do
    expect(Yaks::Serializer.all[:json].call([1,2,3])).to eql "[\n  1,\n  2,\n  3\n]"
  end

  it 'should warn when registering a key again' do
    expect { Yaks::Serializer.register(:json, :foo) }.to raise_exception /Serializer for json already registered/
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
yaks-0.6.2 spec/unit/yaks/serializer_spec.rb
yaks-0.6.1 spec/unit/yaks/serializer_spec.rb
yaks-0.6.0 spec/unit/yaks/serializer_spec.rb