Sha256: 0f66ec114966833f406bf7731b407cdca73e3083ad3a7099425cc3f14c4690c8

Contents?: true

Size: 766 Bytes

Versions: 7

Compression:

Stored size: 766 Bytes

Contents

# frozen_string_literal: true

RSpec.describe Twitch::Bot::Memory::Hash do
  describe "#store" do
    it "persists a value for a key" do
      mem = described_class.new(client: nil)

      mem.store("foo", "bar")

      expect(mem.retrieve("foo")).to eq "bar"
    end

    it "persists an Array" do
      mem = described_class.new(client: nil)

      mem.store("foo", [1, 2])

      result = mem.retrieve("foo")
      expect(result).to be_an Array
      expect(result[0]).to eq 1
      expect(result[1]).to eq 2
    end

    it "persists a Hash" do
      mem = described_class.new(client: nil)

      mem.store("foo", { "bar" => "baz" })

      result = mem.retrieve("foo")
      expect(result).to be_a Hash
      expect(result["bar"]).to eq "baz"
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
twitch-bot-6.0.0 spec/twitch/bot/memory/hash_spec.rb
twitch-bot-5.0.6 spec/twitch/bot/memory/hash_spec.rb
twitch-bot-5.0.5 spec/twitch/bot/memory/hash_spec.rb
twitch-bot-5.0.4 spec/twitch/bot/memory/hash_spec.rb
twitch-bot-5.0.2 spec/twitch/bot/memory/hash_spec.rb
twitch-bot-5.0.1 spec/twitch/bot/memory/hash_spec.rb
twitch-bot-5.0.0 spec/twitch/bot/memory/hash_spec.rb