File: channels_spec.rb

package info (click to toggle)
ruby-slack-messenger 2.3.5-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 208 kB
  • sloc: ruby: 1,156; makefile: 7
file content (20 lines) | stat: -rw-r--r-- 623 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# frozen_string_literal: true

RSpec.describe Slack::Messenger::PayloadMiddleware::Channels do
  it "leaves string channels alone" do
    subject = described_class.new(:messenger)
    payload = { text: "hello", channel: "hodor" }

    expect(subject.call(payload)).to eq text: "hello", channel: "hodor"
  end

  it "splits payload into multiple if given an array of channels" do
    subject = described_class.new(:messenger)
    payload = { text: "hello", channel: %w[foo hodor] }

    expect(subject.call(payload)).to eq [
      { text: "hello", channel: "foo" },
      { text: "hello", channel: "hodor" }
    ]
  end
end