Sha256: 76242d0023c9996fa64cce1a498ab9e550f29a14e2c687cf8926ac3312792350

Contents?: true

Size: 1.11 KB

Versions: 39

Compression:

Stored size: 1.11 KB

Contents

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(["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(["value", "new_value"]))
        end

        it "should add value with array" do
          subject.add("key", ["value1", "value2"])
          expect(subject["key"]).to eq(Set.new(["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

39 entries across 39 versions & 2 rubygems

Version Path
bullet-5.6.0 spec/bullet/registry/base_spec.rb
bullet-5.5.1 spec/bullet/registry/base_spec.rb
bullet-5.5.0 spec/bullet/registry/base_spec.rb
bullet-5.4.3 spec/bullet/registry/base_spec.rb
bullet-5.4.2 spec/bullet/registry/base_spec.rb
bullet-5.4.1 spec/bullet/registry/base_spec.rb
bullet-5.4.0 spec/bullet/registry/base_spec.rb
bullet-5.3.0 spec/bullet/registry/base_spec.rb
bullet-5.2.1 spec/bullet/registry/base_spec.rb
bullet-5.2.0 spec/bullet/registry/base_spec.rb
bullet-5.1.1 spec/bullet/registry/base_spec.rb
bullet-5.1.0 spec/bullet/registry/base_spec.rb
bullet-5.0.0 spec/bullet/registry/base_spec.rb
bullet-4.14.10 spec/bullet/registry/base_spec.rb
bullet-4.14.9 spec/bullet/registry/base_spec.rb
bullet-4.14.8 spec/bullet/registry/base_spec.rb
bullet_instructure-4.14.8 spec/bullet/registry/base_spec.rb
bullet-4.14.7 spec/bullet/registry/base_spec.rb
bullet_instructure-4.14.7 spec/bullet/registry/base_spec.rb
bullet-4.14.6 spec/bullet/registry/base_spec.rb