Sha256: 9b353aa0ec88f1b387dfea4a2b942f0b2bbbac65656612ce8522e36d59832b28

Contents?: true

Size: 1.13 KB

Versions: 14

Compression:

Stored size: 1.13 KB

Contents

# frozen_string_literal: true

require 'spec_helper'

module Bullet
  module Registry
    describe Base do
      subject { Base.new.tap { |base| base.add('key', 'value') } }

      context '#[]' do
        it 'should get value by key' do
          expect(subject['key']).to eq(Set.new(%w[value]))
        end
      end

      context '#delete' do
        it 'should delete key' do
          subject.delete('key')
          expect(subject['key']).to be_nil
        end
      end

      context '#add' do
        it 'should add value with string' do
          subject.add('key', 'new_value')
          expect(subject['key']).to eq(Set.new(%w[value new_value]))
        end

        it 'should add value with array' do
          subject.add('key', %w[value1 value2])
          expect(subject['key']).to eq(Set.new(%w[value value1 value2]))
        end
      end

      context '#include?' do
        it 'should include key/value' do
          expect(subject.include?('key', 'value')).to eq true
        end

        it 'should not include wrong key/value' do
          expect(subject.include?('key', 'val')).to eq false
        end
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
bullet-7.0.7 spec/bullet/registry/base_spec.rb
bullet-7.0.6 spec/bullet/registry/base_spec.rb
bullet-7.0.5 spec/bullet/registry/base_spec.rb
bullet-7.0.4 spec/bullet/registry/base_spec.rb
bullet-7.0.3 spec/bullet/registry/base_spec.rb
bullet-7.0.2 spec/bullet/registry/base_spec.rb
bullet-7.0.1 spec/bullet/registry/base_spec.rb
bullet-7.0.0 spec/bullet/registry/base_spec.rb
bullet-6.1.5 spec/bullet/registry/base_spec.rb
bullet-6.1.4 spec/bullet/registry/base_spec.rb
bullet-6.1.3 spec/bullet/registry/base_spec.rb
bullet-6.1.2 spec/bullet/registry/base_spec.rb
bullet-6.1.1 spec/bullet/registry/base_spec.rb
bullet-6.1.0 spec/bullet/registry/base_spec.rb