spec/twitch/bot/client_spec.rb in twitch-bot-2.1.1 vs spec/twitch/bot/client_spec.rb in twitch-bot-3.1.0
- old
+ new
@@ -1,13 +1,19 @@
# frozen_string_literal: true
RSpec.describe Twitch::Bot::Client do
let!(:client) do
- connection = Twitch::Bot::Connection.new(
- nickname: "test", password: "test",
+ config = Twitch::Bot::Config.new(
+ settings: {
+ bot_user: "testuser",
+ adapter: "Twitch::Bot::Adapter::Terminal",
+ },
)
- described_class.new(connection: connection)
+ described_class.new(
+ config: config,
+ channel: "testchannel",
+ )
end
describe "#trigger" do
it "responds to a Ping message" do
ping_message_fake = Struct.new(:type, :hostname, :user)
@@ -45,8 +51,24 @@
allow(client).to receive(:remove_moderator)
client.dispatch(message)
expect(client).to have_received(:remove_moderator)
+ end
+ end
+
+ describe "#channel" do
+ it "returns the channel object" do
+ channel = client.channel
+
+ expect(channel.name).to eq "testchannel"
+ end
+ end
+
+ describe "#memory" do
+ it "stores and retrieves data" do
+ client.memory.store("foo", "bar")
+
+ expect(client.memory.retrieve("foo")).to eq "bar"
end
end
end