mirror of
https://github.com/basecamp/once-campfire.git
synced 2026-10-08 07:40:08 +09:00
Merge upstream main into reuse-pinned-push-connections
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Bj8KnxpTf9sj2Ysa8aLAVa
This commit is contained in:
@@ -8,7 +8,7 @@ class UnreadRoomsChannelTest < ActionCable::Channel::TestCase
|
||||
|
||||
assert subscription.confirmed?
|
||||
assert_has_stream "user_#{users(:jz).id}_unreads"
|
||||
assert_not_includes subscription.streams, "unread_rooms"
|
||||
assert_not_includes subscription.stream_names, "unread_rooms"
|
||||
end
|
||||
|
||||
test "an outsider is not told about activity in a room they can't see" do
|
||||
@@ -37,7 +37,7 @@ class UnreadRoomsChannelTest < ActionCable::Channel::TestCase
|
||||
stub_connection(current_user: user)
|
||||
subscribe
|
||||
|
||||
stream = subscription.streams.sole
|
||||
stream = subscription.stream_names.sole
|
||||
before = ActionCable.server.pubsub.broadcasts(stream).size
|
||||
|
||||
yield
|
||||
|
||||
@@ -10,6 +10,16 @@ class AccountsControllerTest < ActionDispatch::IntegrationTest
|
||||
assert_response :ok
|
||||
end
|
||||
|
||||
test "edit shows whether room creation is restricted to administrators" do
|
||||
get edit_account_url
|
||||
assert_select "label.switch input.switch__input[type=checkbox]:not([checked])"
|
||||
|
||||
accounts(:signal).update!(settings: { restrict_room_creation_to_administrators: true })
|
||||
|
||||
get edit_account_url
|
||||
assert_select "label.switch input.switch__input[type=checkbox][checked][data-action='change->form#submit']"
|
||||
end
|
||||
|
||||
test "edit groups administrators separately from members with a divider" do
|
||||
get edit_account_url
|
||||
|
||||
|
||||
@@ -15,6 +15,21 @@ class RoomsControllerTest < ActionDispatch::IntegrationTest
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "show renders notification help for each platform" do
|
||||
{
|
||||
"Firefox on Android" => "Mozilla/5.0 (Android 14; Mobile; rv:131.0) Gecko/131.0 Firefox/131.0",
|
||||
"Chrome on Android" => "Mozilla/5.0 (Linux; Android 14; Pixel 8) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Mobile Safari/537.36",
|
||||
"Firefox on desktop" => "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:131.0) Gecko/20100101 Firefox/131.0",
|
||||
"Chrome on desktop" => "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36",
|
||||
"Safari on macOS" => "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.0 Safari/605.1.15"
|
||||
}.each do |platform, user_agent|
|
||||
get room_url(users(:david).rooms.last), headers: { "User-Agent" => user_agent }
|
||||
|
||||
assert_response :success, platform
|
||||
assert_select ".notifications-help ol", { minimum: 1 }, platform
|
||||
end
|
||||
end
|
||||
|
||||
test "shows records the last room visited in a cookie" do
|
||||
get room_url(users(:david).rooms.last)
|
||||
assert response.cookies[:last_room] = users(:david).rooms.last.id
|
||||
|
||||
@@ -11,6 +11,13 @@ class Users::ProfilesControllerTest < ActionDispatch::IntegrationTest
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "show includes install instructions for Edge" do
|
||||
get user_profile_url, headers: { "User-Agent" => "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36 Edge/18.18363" }
|
||||
|
||||
assert_response :success
|
||||
assert_select ".pwa__instructions img[src*='install-edge']"
|
||||
end
|
||||
|
||||
test "update" do
|
||||
put user_profile_url, params: { user: { name: "John Doe", bio: "Acrobat" } }
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
<% password_digest = BCrypt::Password.create("secret123456") %>
|
||||
<% password_digest = BCrypt::Password.create("secret123456", cost: BCrypt::Engine::MIN_COST) %>
|
||||
|
||||
david:
|
||||
name: David
|
||||
|
||||
@@ -20,6 +20,21 @@ class Message::SearchableTest < ActiveSupport::TestCase
|
||||
assert_equal messages, rooms(:designers).messages.search("cat")
|
||||
end
|
||||
|
||||
test "the last page of matches holds the newest ones, read off the index without sorting every match" do
|
||||
messages = [ "first cat", "second cat", "third cat" ].map do |body|
|
||||
rooms(:designers).messages.create! body: body, client_message_id: body, creator: users(:david)
|
||||
end
|
||||
|
||||
queries = []
|
||||
collect = ->(*, payload) { queries << payload[:sql] if payload[:sql].include?("message_search_index") }
|
||||
page = ActiveSupport::Notifications.subscribed(collect, "sql.active_record") do
|
||||
rooms(:designers).messages.search("cat").last_page_of_matches(2)
|
||||
end
|
||||
|
||||
assert_equal messages.last(2), page
|
||||
assert_no_match(/TEMP B-TREE/, Message.connection.select_rows("EXPLAIN QUERY PLAN #{queries.sole}").map(&:last).join(" | "))
|
||||
end
|
||||
|
||||
test "rich text body is converted to plain text for indexing" do
|
||||
message = rooms(:designers).messages.create! body: "<span>My hovercraft is full of eels</span>", client_message_id: "earth", creator: users(:david)
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ class WebhookTest < ActiveSupport::TestCase
|
||||
|
||||
test "delivery with error reply" do
|
||||
assert_no_difference -> { Message.count } do
|
||||
WebMock.stub_request(:post, webhooks(:bender).url).to_return(status: 500, body: "Internal Error!", headers: {})
|
||||
WebMock.stub_request(:post, webhooks(:bender).url).to_return(status: 500, body: "<h1>Internal Error!</h1>", headers: { "Content-Type" => "text/html" })
|
||||
response = webhooks(:bender).deliver(messages(:first))
|
||||
end
|
||||
end
|
||||
|
||||
@@ -2,7 +2,6 @@ ENV["RAILS_ENV"] ||= "test"
|
||||
require_relative "../config/environment"
|
||||
|
||||
require "rails/test_help"
|
||||
require "minitest/unit"
|
||||
require "mocha/minitest"
|
||||
require "webmock/minitest"
|
||||
require "turbo/broadcastable/test_helper"
|
||||
|
||||
Reference in New Issue
Block a user