mirror of
https://github.com/discourse/discourse.git
synced 2025-02-17 22:03:30 +08:00
![Alan Guo Xiang Tan](/assets/img/avatar_default.png)
What is the problem? We were calling out to methods that calls `has_css?` or `has_selector?` which returns a boolean. Since we are not using the return value, it means the methods can be deemed unnecessary. However, we do want those checks and this commit adds the necessarily assertions to make use of the return values.
26 lines
857 B
Ruby
26 lines
857 B
Ruby
# frozen_string_literal: true
|
|
|
|
RSpec.describe "Message errors", type: :system, js: true do
|
|
fab!(:current_user) { Fabricate(:admin) }
|
|
let(:chat_page) { PageObjects::Pages::Chat.new }
|
|
let(:channel_page) { PageObjects::Pages::ChatChannel.new }
|
|
let(:max_length) { SiteSetting.chat_maximum_message_length }
|
|
|
|
before { chat_system_bootstrap }
|
|
|
|
context "when message is too long" do
|
|
fab!(:channel) { Fabricate(:chat_channel) }
|
|
|
|
it "only shows the error, not the message" do
|
|
channel.add(current_user)
|
|
sign_in(current_user)
|
|
chat_page.visit_channel(channel)
|
|
|
|
channel_page.send_message("atoolongmessage" + "a" * max_length, check_message_presence: false)
|
|
|
|
expect(page).to have_no_content("atoolongmessage")
|
|
expect(page).to have_content(I18n.t("chat.errors.message_too_long", count: max_length))
|
|
end
|
|
end
|
|
end
|