Sha256: ea6b89823c6c0411f14083a4d9d1d35ea4e7a5c2695d6c76819cc248267a775d

Contents?: true

Size: 1.59 KB

Versions: 3

Compression:

Stored size: 1.59 KB

Contents

require 'spec_helper'

describe Rambling::Trie::Configuration::Properties do
  let(:properties) { Rambling::Trie::Configuration::Properties.new }

  describe '.new' do
    it 'configures the serializers' do
      serializers = properties.serializers
      expect(serializers.keys).to match_array %i(marshal yaml yml zip)

      expect(serializers[:marshal]).to be_instance_of Rambling::Trie::Serializers::Marshal
      expect(serializers[:yaml]).to be_instance_of Rambling::Trie::Serializers::Yaml
      expect(serializers[:yml]).to be_instance_of Rambling::Trie::Serializers::Yaml
      expect(serializers[:zip]).to be_instance_of Rambling::Trie::Serializers::Zip
    end

    it 'configures the readers' do
      readers = properties.readers
      expect(readers.keys).to match_array %i(txt)

      expect(readers[:txt]).to be_instance_of Rambling::Trie::Readers::PlainText
    end

    it 'configures the compressor' do
      expect(properties.compressor).to be_instance_of Rambling::Trie::Compressor
    end

    it 'configures the root_builder' do
      expect(properties.root_builder.call).to be_instance_of Rambling::Trie::RawNode
    end
  end

  describe '#reset' do
    before do
      properties.serializers.add :test, 'test'
      properties.readers.add :test, 'test'
    end

    it 'resets the serializers and readers to initial values' do
      expect(properties.serializers.keys).to include :test
      expect(properties.readers.keys).to include :test

      properties.reset

      expect(properties.serializers.keys).not_to include :test
      expect(properties.readers.keys).not_to include :test
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rambling-trie-1.0.2 spec/lib/rambling/trie/configuration/properties_spec.rb
rambling-trie-1.0.1 spec/lib/rambling/trie/configuration/properties_spec.rb
rambling-trie-1.0.0 spec/lib/rambling/trie/configuration/properties_spec.rb