Sha256: e60a34a02f4e658c54e96a9abe66a7d3e3a65faeb65bd40998a1e190ced5f45a
Contents?: true
Size: 1.47 KB
Versions: 2
Compression:
Stored size: 1.47 KB
Contents
# frozen_string_literal: true RSpec.describe Twitch::Bot::Client do let!(:client) do connection = Twitch::Bot::Connection.new( nickname: "test", password: "test", ) described_class.new(connection: connection) end describe "#trigger" do it "responds to a Ping message" do ping_message_fake = Struct.new(:type, :hostname, :user) message = ping_message_fake.new(:ping, "test.twitch", nil) allow(client).to receive(:send_data) client.dispatch(message) expect(client).to have_received(:send_data) end it "responds to an Authenticate message" do fake_message_class = Struct.new(:type) message = fake_message_class.new(:authenticated) allow(client).to receive(:join_default_channel) client.dispatch(message) expect(client).to have_received(:join_default_channel) end it "responds to a +o message" do fake_message_class = Struct.new(:type, :user, :mode) message = fake_message_class.new(:mode, "Test", :add_moderator) allow(client).to receive(:add_moderator) client.dispatch(message) expect(client).to have_received(:add_moderator) end it "responds to a -o message" do fake_message_class = Struct.new(:type, :user, :mode) message = fake_message_class.new(:mode, "Test", :remove_moderator) allow(client).to receive(:remove_moderator) client.dispatch(message) expect(client).to have_received(:remove_moderator) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
twitch-bot-2.1.1 | spec/twitch/bot/client_spec.rb |
twitch-bot-2.1.0 | spec/twitch/bot/client_spec.rb |