mirror of
https://github.com/discourse/discourse.git
synced 2024-12-13 00:33:42 +08:00
19 lines
565 B
Ruby
19 lines
565 B
Ruby
|
# frozen_string_literal: true
|
||
|
|
||
|
RSpec.describe ChatDraft do
|
||
|
before { SiteSetting.max_chat_draft_length = 100 }
|
||
|
|
||
|
it "errors when data.value is greater than `max_chat_draft_length`" do
|
||
|
draft =
|
||
|
described_class.create(
|
||
|
user_id: Fabricate(:user).id,
|
||
|
chat_channel_id: Fabricate(:chat_channel).id,
|
||
|
data: { value: "A" * (SiteSetting.max_chat_draft_length + 1) }.to_json,
|
||
|
)
|
||
|
|
||
|
expect(draft.errors.full_messages).to eq(
|
||
|
[I18n.t("chat.errors.draft_too_long", { maximum: SiteSetting.max_chat_draft_length })],
|
||
|
)
|
||
|
end
|
||
|
end
|