mirror of
https://github.com/basecamp/once-campfire.git
synced 2026-10-08 07:40:08 +09:00
Merge branch 'main' into cursor/split-sidebar-membership-queries-8545
This commit is contained in:
@@ -6,6 +6,13 @@ class Messages::BoostsControllerTest < ActionDispatch::IntegrationTest
|
||||
@message = messages(:first)
|
||||
end
|
||||
|
||||
test "index wires the new boost link to the soft keyboard" do
|
||||
get message_boosts_url(@message)
|
||||
|
||||
assert_response :success
|
||||
assert_select ".message__boost-inline a.boost__action[data-action='soft-keyboard#open']"
|
||||
end
|
||||
|
||||
test "create" do
|
||||
assert_turbo_stream_broadcasts [ @message.room, :messages ], count: 1 do
|
||||
assert_difference -> { @message.boosts.count }, 1 do
|
||||
|
||||
@@ -20,6 +20,24 @@ class SearchesControllerTest < ActionDispatch::IntegrationTest
|
||||
assert_select ".message", text: /Hello world!/
|
||||
end
|
||||
|
||||
test "operator words are searched for as words" do
|
||||
rooms(:designers).messages.create! body: "Salt and pepper", client_message_id: "operators", creator: users(:david)
|
||||
|
||||
get searches_url, params: { q: "salt AND" }
|
||||
|
||||
assert_response :success
|
||||
assert_select ".message", text: /Salt and pepper/
|
||||
end
|
||||
|
||||
test "searching for an operator word alone doesn't fail" do
|
||||
%w[ AND OR NOT ].each do |word|
|
||||
get searches_url, params: { q: word }
|
||||
|
||||
assert_response :success
|
||||
assert_select ".message", count: 0
|
||||
end
|
||||
end
|
||||
|
||||
test "unreachable messages are not found" do
|
||||
memberships(:david_designers).destroy!
|
||||
|
||||
|
||||
@@ -65,6 +65,24 @@ class MessageTest < ActiveSupport::TestCase
|
||||
assert_equal room.messages.ordered.first(Message::Pagination::PAGE_SIZE).map(&:id), room.messages.first_page.map(&:id)
|
||||
end
|
||||
|
||||
test "paged? tells whether a room has more than a page of messages without counting them all" do
|
||||
room = Rooms::Closed.create!(name: "Paging", creator: users(:david))
|
||||
Message.insert_all Array.new(Message::Pagination::PAGE_SIZE) { |i| { room_id: room.id, creator_id: users(:david).id, client_message_id: "paging-#{i}" } }
|
||||
|
||||
assert_no_queries_match(/COUNT/i) do
|
||||
assert_not room.messages.paged?
|
||||
|
||||
Message.insert_all [ { room_id: room.id, creator_id: users(:david).id, client_message_id: "paging-next" } ]
|
||||
assert room.messages.paged?
|
||||
end
|
||||
end
|
||||
|
||||
test "search reads quotes and operator words in the query as text" do
|
||||
message = rooms(:designers).messages.create!(body: "Say hi, NOT bye", client_message_id: "quoted", creator: users(:david))
|
||||
|
||||
assert_equal [ message ], Message.search(%(say "hi NOT)).to_a
|
||||
end
|
||||
|
||||
private
|
||||
def create_new_message_in(room)
|
||||
room.messages.create!(creator: users(:jason), body: "Hello", client_message_id: "123")
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
require "application_system_test_case"
|
||||
|
||||
class StartingPingsTest < ApplicationSystemTestCase
|
||||
setup do
|
||||
sign_in "kevin@37signals.com"
|
||||
end
|
||||
|
||||
test "suggesting people to ping" do
|
||||
visit new_rooms_direct_url
|
||||
|
||||
find("[data-autocomplete-target='input']").send_keys("Jas")
|
||||
|
||||
assert_selector "suggestion-option[role='option']", text: "Jason"
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user