Sha256: fe74b6c6a52247aefe4b1ec7bbe80c22e6297f754cc5f0cc1e6c1803b72550c1

Contents?: true

Size: 1.01 KB

Versions: 3

Compression:

Stored size: 1.01 KB

Contents

# frozen_string_literal: true

RSpec.describe Twitch::Bot::Memory::Redis do
  describe "#store" do
    it "works with ENV connection details" do
      config = Twitch::Bot::Config.new(
        settings: {
          bot_user: "testuser",
        },
      )
      client = Twitch::Bot::Client.new(
        config: config,
        channel: "testchannel",
      )
      mem = described_class.new(client: client)

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

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

    it "works with config connection details" do
      url = URI.parse(ENV["REDIS_URL"])
      config = Twitch::Bot::Config.new(
        settings: {
          bot_user: "testuser",
          redis: {
            host: url.host,
            port: url.port,
          },
        },
      )
      client = Twitch::Bot::Client.new(
        config: config,
        channel: "testchannel",
      )
      mem = described_class.new(client: client)

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

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
twitch-bot-4.1.1 spec/twitch/bot/memory/redis_spec.rb
twitch-bot-4.1.0 spec/twitch/bot/memory/redis_spec.rb
twitch-bot-4.0.1 spec/twitch/bot/memory/redis_spec.rb