Sha256: d3d8feed2a3cde68741185a048437d8bdd399ed0534684374019cc26ac0ebda5

Contents?: true

Size: 817 Bytes

Versions: 2

Compression:

Stored size: 817 Bytes

Contents

describe Slack::Message do
  describe "#parse" do
    it "initializes a new message with a JSON string" do
      message = described_class.parse '{ "id": "1234", "type": "blah" }'

      expect(message).to be_a Slack::Message
      expect(message.id).to eq "1234"
      expect(message.type).to eq :blah
    end
  end

  describe "#generate" do
    it "generates a new message with a random id and type" do
      message = described_class.generate text: "This is a test"

      expect(message.id).to_not be_empty
      expect(message.type).to eq :message
      expect(message.text).to eq "This is a test"
    end

    it "can have an id specified" do
      expect(described_class).to_not receive(:generate_id)

      message = described_class.generate id: 12345

      expect(message.id).to eq 12345
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
laziness-0.2.6 spec/laziness/message_spec.rb
laziness-0.2.5 spec/laziness/message_spec.rb