repo stringlengths 5 92 | file_url stringlengths 80 287 | file_path stringlengths 5 197 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:37:27 2026-01-04 17:58:21 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
basecamp/once-campfire | https://github.com/basecamp/once-campfire/blob/1852adb06c125ac45253f2f0785ce3747694f448/db/migrate/20251126130131_add_account_settings.rb | db/migrate/20251126130131_add_account_settings.rb | class AddAccountSettings < ActiveRecord::Migration[7.2]
def change
add_column :accounts, :settings, :json
end
end
| ruby | MIT | 1852adb06c125ac45253f2f0785ce3747694f448 | 2026-01-04T15:48:40.201016Z | false |
basecamp/once-campfire | https://github.com/basecamp/once-campfire/blob/1852adb06c125ac45253f2f0785ce3747694f448/db/migrate/20240131105830_alter_users_set_password_digest_not_null.rb | db/migrate/20240131105830_alter_users_set_password_digest_not_null.rb | class AlterUsersSetPasswordDigestNotNull < ActiveRecord::Migration[7.2]
def change
execute <<-SQL
update users set password_digest = '' where password_digest is null;
SQL
change_column_null :users, :password_digest, false
end
end
| ruby | MIT | 1852adb06c125ac45253f2f0785ce3747694f448 | 2026-01-04T15:48:40.201016Z | false |
basecamp/once-campfire | https://github.com/basecamp/once-campfire/blob/1852adb06c125ac45253f2f0785ce3747694f448/db/migrate/20251126115722_change_active_to_status_on_users.rb | db/migrate/20251126115722_change_active_to_status_on_users.rb | class ChangeActiveToStatusOnUsers < ActiveRecord::Migration[8.1]
def change
add_column :users, :status, :integer, default: 0, null: false
reversible do |dir|
dir.up do
execute "UPDATE users SET status = 1 WHERE active = 0"
end
end
remove_column :users, :active, :boolean
end
end... | ruby | MIT | 1852adb06c125ac45253f2f0785ce3747694f448 | 2026-01-04T15:48:40.201016Z | false |
basecamp/once-campfire | https://github.com/basecamp/once-campfire/blob/1852adb06c125ac45253f2f0785ce3747694f448/db/migrate/20250825100959_remove_not_null_on_active_storage_blobs_checksum.active_storage.rb | db/migrate/20250825100959_remove_not_null_on_active_storage_blobs_checksum.active_storage.rb | # This migration comes from active_storage (originally 20211119233751)
class RemoveNotNullOnActiveStorageBlobsChecksum < ActiveRecord::Migration[6.0]
def change
return unless table_exists?(:active_storage_blobs)
change_column_null(:active_storage_blobs, :checksum, true)
end
end
| ruby | MIT | 1852adb06c125ac45253f2f0785ce3747694f448 | 2026-01-04T15:48:40.201016Z | false |
basecamp/once-campfire | https://github.com/basecamp/once-campfire/blob/1852adb06c125ac45253f2f0785ce3747694f448/db/migrate/20240110071740_create_sessions.rb | db/migrate/20240110071740_create_sessions.rb | class CreateSessions < ActiveRecord::Migration[7.2]
def change
create_table :sessions do |t|
t.references :user, null: false, foreign_key: true, index: true
t.string :token, null: false
t.string :ip_address
t.string :user_agent
t.datetime :last_active_at, null: false
t.timesta... | ruby | MIT | 1852adb06c125ac45253f2f0785ce3747694f448 | 2026-01-04T15:48:40.201016Z | false |
basecamp/once-campfire | https://github.com/basecamp/once-campfire/blob/1852adb06c125ac45253f2f0785ce3747694f448/db/migrate/20251212154340_add_singleton_constraint_to_accounts.rb | db/migrate/20251212154340_add_singleton_constraint_to_accounts.rb | class AddSingletonConstraintToAccounts < ActiveRecord::Migration[8.2]
def change
add_column :accounts, :singleton_guard, :integer, default: 0, null: false
add_index :accounts, :singleton_guard, unique: true
end
end
| ruby | MIT | 1852adb06c125ac45253f2f0785ce3747694f448 | 2026-01-04T15:48:40.201016Z | false |
basecamp/once-campfire | https://github.com/basecamp/once-campfire/blob/1852adb06c125ac45253f2f0785ce3747694f448/db/migrate/20231220143106_add_bio_to_users.rb | db/migrate/20231220143106_add_bio_to_users.rb | class AddBioToUsers < ActiveRecord::Migration[7.2]
def change
change_table :users do |t|
t.text :bio
end
end
end
| ruby | MIT | 1852adb06c125ac45253f2f0785ce3747694f448 | 2026-01-04T15:48:40.201016Z | false |
basecamp/once-campfire | https://github.com/basecamp/once-campfire/blob/1852adb06c125ac45253f2f0785ce3747694f448/db/migrate/20240115124901_remove_owner_role.rb | db/migrate/20240115124901_remove_owner_role.rb | class RemoveOwnerRole < ActiveRecord::Migration[7.2]
def change
# Migrate existing owner to administrator
execute "update users set role = 1 where role = 2"
end
end
| ruby | MIT | 1852adb06c125ac45253f2f0785ce3747694f448 | 2026-01-04T15:48:40.201016Z | false |
basecamp/once-campfire | https://github.com/basecamp/once-campfire/blob/1852adb06c125ac45253f2f0785ce3747694f448/db/migrate/20250825100958_create_active_storage_variant_records.active_storage.rb | db/migrate/20250825100958_create_active_storage_variant_records.active_storage.rb | # This migration comes from active_storage (originally 20191206030411)
class CreateActiveStorageVariantRecords < ActiveRecord::Migration[6.0]
def change
return unless table_exists?(:active_storage_blobs)
# Use Active Record's configured type for primary key
create_table :active_storage_variant_records, i... | ruby | MIT | 1852adb06c125ac45253f2f0785ce3747694f448 | 2026-01-04T15:48:40.201016Z | false |
basecamp/once-campfire | https://github.com/basecamp/once-campfire/blob/1852adb06c125ac45253f2f0785ce3747694f448/db/migrate/20240130213001_add_custom_styles_to_accounts.rb | db/migrate/20240130213001_add_custom_styles_to_accounts.rb | class AddCustomStylesToAccounts < ActiveRecord::Migration[7.2]
def change
add_column :accounts, :custom_styles, :text
end
end
| ruby | MIT | 1852adb06c125ac45253f2f0785ce3747694f448 | 2026-01-04T15:48:40.201016Z | false |
basecamp/once-campfire | https://github.com/basecamp/once-campfire/blob/1852adb06c125ac45253f2f0785ce3747694f448/db/migrate/20250825100957_add_service_name_to_active_storage_blobs.active_storage.rb | db/migrate/20250825100957_add_service_name_to_active_storage_blobs.active_storage.rb | # This migration comes from active_storage (originally 20190112182829)
class AddServiceNameToActiveStorageBlobs < ActiveRecord::Migration[6.0]
def up
return unless table_exists?(:active_storage_blobs)
unless column_exists?(:active_storage_blobs, :service_name)
add_column :active_storage_blobs, :service... | ruby | MIT | 1852adb06c125ac45253f2f0785ce3747694f448 | 2026-01-04T15:48:40.201016Z | false |
basecamp/once-campfire | https://github.com/basecamp/once-campfire/blob/1852adb06c125ac45253f2f0785ce3747694f448/test/application_system_test_case.rb | test/application_system_test_case.rb | require "test_helper"
WebMock.disable!
class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
driven_by :selenium, using: :headless_chrome, screen_size: [ 1400, 1400 ]
include SystemTestHelper
end
| ruby | MIT | 1852adb06c125ac45253f2f0785ce3747694f448 | 2026-01-04T15:48:40.201016Z | false |
basecamp/once-campfire | https://github.com/basecamp/once-campfire/blob/1852adb06c125ac45253f2f0785ce3747694f448/test/test_helper.rb | test/test_helper.rb | 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"
WebMock.enable!
class ActiveSupport::TestCase
include ActiveJob::TestHelper
parallelize(workers: :n... | ruby | MIT | 1852adb06c125ac45253f2f0785ce3747694f448 | 2026-01-04T15:48:40.201016Z | false |
basecamp/once-campfire | https://github.com/basecamp/once-campfire/blob/1852adb06c125ac45253f2f0785ce3747694f448/test/system/boosting_messages_test.rb | test/system/boosting_messages_test.rb | require "application_system_test_case"
class BoostingMessagesTest < ApplicationSystemTestCase
setup do
sign_in "kevin@37signals.com"
join_room rooms(:designers)
end
test "boosting a message" do
within_message messages(:third) do
reveal_message_actions
fill_in_boost_input "Good morning"
... | ruby | MIT | 1852adb06c125ac45253f2f0785ce3747694f448 | 2026-01-04T15:48:40.201016Z | false |
basecamp/once-campfire | https://github.com/basecamp/once-campfire/blob/1852adb06c125ac45253f2f0785ce3747694f448/test/system/unread_rooms_test.rb | test/system/unread_rooms_test.rb | require "application_system_test_case"
class UnreadRoomsTest < ApplicationSystemTestCase
setup do
sign_in "jz@37signals.com"
end
test "sending messages between two users" do
designers_room = rooms(:designers)
hq_room = rooms(:hq)
join_room hq_room
assert_room_read hq_room
using_session... | ruby | MIT | 1852adb06c125ac45253f2f0785ce3747694f448 | 2026-01-04T15:48:40.201016Z | false |
basecamp/once-campfire | https://github.com/basecamp/once-campfire/blob/1852adb06c125ac45253f2f0785ce3747694f448/test/system/sending_messages_test.rb | test/system/sending_messages_test.rb | require "application_system_test_case"
class SendingMessagesTest < ApplicationSystemTestCase
setup do
sign_in "jz@37signals.com"
join_room rooms(:designers)
end
test "sending messages between two users" do
using_session("Kevin") do
sign_in "kevin@37signals.com"
join_room rooms(:designers... | ruby | MIT | 1852adb06c125ac45253f2f0785ce3747694f448 | 2026-01-04T15:48:40.201016Z | false |
basecamp/once-campfire | https://github.com/basecamp/once-campfire/blob/1852adb06c125ac45253f2f0785ce3747694f448/test/helpers/content_filters_test.rb | test/helpers/content_filters_test.rb | require "test_helper"
class ContentFiltersTest < ActionView::TestCase
test "entire message contains an unfurled URL" do
text = "https://basecamp.com/"
message = Message.create! room: rooms(:pets), body: unfurled_message_body_for_basecamp(text), client_message_id: "0015", creator: users(:jason)
filtered ... | ruby | MIT | 1852adb06c125ac45253f2f0785ce3747694f448 | 2026-01-04T15:48:40.201016Z | false |
basecamp/once-campfire | https://github.com/basecamp/once-campfire/blob/1852adb06c125ac45253f2f0785ce3747694f448/test/controllers/accounts_controller_test.rb | test/controllers/accounts_controller_test.rb | require "test_helper"
class AccountsControllerTest < ActionDispatch::IntegrationTest
setup do
sign_in :david
end
test "edit" do
get edit_account_url
assert_response :ok
end
test "edit groups administrators separately from members with a divider" do
get edit_account_url
assert_response ... | ruby | MIT | 1852adb06c125ac45253f2f0785ce3747694f448 | 2026-01-04T15:48:40.201016Z | false |
basecamp/once-campfire | https://github.com/basecamp/once-campfire/blob/1852adb06c125ac45253f2f0785ce3747694f448/test/controllers/unfurl_links_controller_test.rb | test/controllers/unfurl_links_controller_test.rb | require "test_helper"
class UnfurlLinksControllerTest < ActionDispatch::IntegrationTest
setup do
sign_in :david
end
test "create" do
stub_successful_request
post unfurl_link_url, params: { url: "https://www.example.com" }
assert_response :success
json_response = JSON.parse(response.body)
... | ruby | MIT | 1852adb06c125ac45253f2f0785ce3747694f448 | 2026-01-04T15:48:40.201016Z | false |
basecamp/once-campfire | https://github.com/basecamp/once-campfire/blob/1852adb06c125ac45253f2f0785ce3747694f448/test/controllers/sessions_controller_test.rb | test/controllers/sessions_controller_test.rb | require "test_helper"
class SessionsControllerTest < ActionDispatch::IntegrationTest
ALLOWED_BROWSER = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.2 Safari/605.1.15"
DISALLOWED_BROWSER = "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 ... | ruby | MIT | 1852adb06c125ac45253f2f0785ce3747694f448 | 2026-01-04T15:48:40.201016Z | false |
basecamp/once-campfire | https://github.com/basecamp/once-campfire/blob/1852adb06c125ac45253f2f0785ce3747694f448/test/controllers/messages_controller_test.rb | test/controllers/messages_controller_test.rb | require "test_helper"
class MessagesControllerTest < ActionDispatch::IntegrationTest
setup do
host! "once.campfire.test"
sign_in :david
@room = rooms(:watercooler)
@messages = @room.messages.ordered.to_a
end
test "index returns the last page by default" do
get room_messages_url(@room)
... | ruby | MIT | 1852adb06c125ac45253f2f0785ce3747694f448 | 2026-01-04T15:48:40.201016Z | false |
basecamp/once-campfire | https://github.com/basecamp/once-campfire/blob/1852adb06c125ac45253f2f0785ce3747694f448/test/controllers/rooms_controller_test.rb | test/controllers/rooms_controller_test.rb | require "test_helper"
class RoomsControllerTest < ActionDispatch::IntegrationTest
setup do
sign_in :david
end
test "index redirects to the user's last room" do
get rooms_url
assert_redirected_to room_url(users(:david).rooms.last)
end
test "show" do
get room_url(users(:david).rooms.last)
... | ruby | MIT | 1852adb06c125ac45253f2f0785ce3747694f448 | 2026-01-04T15:48:40.201016Z | false |
basecamp/once-campfire | https://github.com/basecamp/once-campfire/blob/1852adb06c125ac45253f2f0785ce3747694f448/test/controllers/searches_controller_test.rb | test/controllers/searches_controller_test.rb | require "test_helper"
class SearchesControllerTest < ActionDispatch::IntegrationTest
setup do
sign_in :david
@message = rooms(:designers).messages.create! body: "Hello world!", client_message_id: "search", creator: users(:david)
end
test "index initial view" do
get searches_url
assert_response ... | ruby | MIT | 1852adb06c125ac45253f2f0785ce3747694f448 | 2026-01-04T15:48:40.201016Z | false |
basecamp/once-campfire | https://github.com/basecamp/once-campfire/blob/1852adb06c125ac45253f2f0785ce3747694f448/test/controllers/welcome_controller_test.rb | test/controllers/welcome_controller_test.rb | require "test_helper"
class WelcomeControllerTest < ActionDispatch::IntegrationTest
setup do
sign_in :david
end
test "redirects to the first created visible room the user has access to" do
get root_url
assert_redirected_to room_url(users(:david).rooms.original)
end
test "redirects to the last ... | ruby | MIT | 1852adb06c125ac45253f2f0785ce3747694f448 | 2026-01-04T15:48:40.201016Z | false |
basecamp/once-campfire | https://github.com/basecamp/once-campfire/blob/1852adb06c125ac45253f2f0785ce3747694f448/test/controllers/users_controller_test.rb | test/controllers/users_controller_test.rb | require "test_helper"
class UsersControllerTest < ActionDispatch::IntegrationTest
setup do
@join_code = accounts(:signal).join_code
end
test "show" do
sign_in :david
get user_url(users(:david))
assert_response :ok
end
test "new" do
get join_url(@join_code)
assert_response :success
... | ruby | MIT | 1852adb06c125ac45253f2f0785ce3747694f448 | 2026-01-04T15:48:40.201016Z | false |
basecamp/once-campfire | https://github.com/basecamp/once-campfire/blob/1852adb06c125ac45253f2f0785ce3747694f448/test/controllers/first_runs_controller_test.rb | test/controllers/first_runs_controller_test.rb | require "test_helper"
class FirstRunsControllerTest < ActionDispatch::IntegrationTest
setup do
Account.destroy_all
User.destroy_all
Room.destroy_all
end
test "new is permitted when no other users exit" do
get first_run_url
assert_response :success
end
test "new is not permitted when acc... | ruby | MIT | 1852adb06c125ac45253f2f0785ce3747694f448 | 2026-01-04T15:48:40.201016Z | false |
basecamp/once-campfire | https://github.com/basecamp/once-campfire/blob/1852adb06c125ac45253f2f0785ce3747694f448/test/controllers/qr_code_controller_test.rb | test/controllers/qr_code_controller_test.rb | require "test_helper"
class QrCodeControllerTest < ActionDispatch::IntegrationTest
test "show renders a QR code as a cacheable SVG image" do
id = Base64.urlsafe_encode64("http://example.com")
get qr_code_path(id)
assert_response :success
assert_includes response.content_type, "image/svg+xml"
a... | ruby | MIT | 1852adb06c125ac45253f2f0785ce3747694f448 | 2026-01-04T15:48:40.201016Z | false |
basecamp/once-campfire | https://github.com/basecamp/once-campfire/blob/1852adb06c125ac45253f2f0785ce3747694f448/test/controllers/concerns/block_banned_requests_test.rb | test/controllers/concerns/block_banned_requests_test.rb | require "test_helper"
class BlockBannedRequestsTest < ActionDispatch::IntegrationTest
setup do
sign_in :david
@room = rooms(:watercooler)
Ban.create!(user: users(:kevin), ip_address: "203.0.113.1")
end
test "POST requests from banned IPs are blocked with 429" do
post room_messages_url(@room),
... | ruby | MIT | 1852adb06c125ac45253f2f0785ce3747694f448 | 2026-01-04T15:48:40.201016Z | false |
basecamp/once-campfire | https://github.com/basecamp/once-campfire/blob/1852adb06c125ac45253f2f0785ce3747694f448/test/controllers/rooms/closeds_controller_test.rb | test/controllers/rooms/closeds_controller_test.rb | require "test_helper"
class Rooms::ClosedsControllerTest < ActionDispatch::IntegrationTest
setup do
sign_in :david
end
test "show redirects to get general show" do
get rooms_open_url(users(:david).rooms.closeds.last)
assert_redirected_to room_url(users(:david).rooms.closeds.last)
end
test "new"... | ruby | MIT | 1852adb06c125ac45253f2f0785ce3747694f448 | 2026-01-04T15:48:40.201016Z | false |
basecamp/once-campfire | https://github.com/basecamp/once-campfire/blob/1852adb06c125ac45253f2f0785ce3747694f448/test/controllers/rooms/opens_controller_test.rb | test/controllers/rooms/opens_controller_test.rb | require "test_helper"
class Rooms::OpensControllerTest < ActionDispatch::IntegrationTest
setup do
sign_in :david
end
test "show redirects to get general show" do
get rooms_open_url(users(:david).rooms.opens.last)
assert_redirected_to room_url(users(:david).rooms.opens.last)
end
test "new" do
... | ruby | MIT | 1852adb06c125ac45253f2f0785ce3747694f448 | 2026-01-04T15:48:40.201016Z | false |
basecamp/once-campfire | https://github.com/basecamp/once-campfire/blob/1852adb06c125ac45253f2f0785ce3747694f448/test/controllers/rooms/refreshes_controller_test.rb | test/controllers/rooms/refreshes_controller_test.rb | require "test_helper"
class Rooms::RefreshesControllerTest < ActionDispatch::IntegrationTest
setup do
sign_in :david
end
test "refresh includes new messages since the last known" do
travel_to 1.day.ago do
@old_message = rooms(:hq).messages.create!(creator: users(:jason), body: "Old message", clien... | ruby | MIT | 1852adb06c125ac45253f2f0785ce3747694f448 | 2026-01-04T15:48:40.201016Z | false |
basecamp/once-campfire | https://github.com/basecamp/once-campfire/blob/1852adb06c125ac45253f2f0785ce3747694f448/test/controllers/rooms/directs_controller_test.rb | test/controllers/rooms/directs_controller_test.rb | require "test_helper"
class Rooms::DirectsControllerTest < ActionDispatch::IntegrationTest
setup do
sign_in :david
end
test "create" do
post rooms_directs_url, params: { user_ids: [ users(:jz).id ] }
room = Room.last
assert_redirected_to room_url(room)
assert room.users.include?(users(:davi... | ruby | MIT | 1852adb06c125ac45253f2f0785ce3747694f448 | 2026-01-04T15:48:40.201016Z | false |
basecamp/once-campfire | https://github.com/basecamp/once-campfire/blob/1852adb06c125ac45253f2f0785ce3747694f448/test/controllers/rooms/involvements_controller_test.rb | test/controllers/rooms/involvements_controller_test.rb | require "test_helper"
class Rooms::InvolvementsControllerTest < ActionDispatch::IntegrationTest
setup do
sign_in :david
end
test "show" do
get room_involvement_url(rooms(:designers))
assert_response :success
end
test "update involvement sends turbo update when becoming visible and when going in... | ruby | MIT | 1852adb06c125ac45253f2f0785ce3747694f448 | 2026-01-04T15:48:40.201016Z | false |
basecamp/once-campfire | https://github.com/basecamp/once-campfire/blob/1852adb06c125ac45253f2f0785ce3747694f448/test/controllers/messages/boosts_controller_test.rb | test/controllers/messages/boosts_controller_test.rb | require "test_helper"
class Messages::BoostsControllerTest < ActionDispatch::IntegrationTest
setup do
sign_in :david
@message = messages(:first)
end
test "create" do
assert_turbo_stream_broadcasts [ @message.room, :messages ], count: 1 do
assert_difference -> { @message.boosts.count }, 1 do
... | ruby | MIT | 1852adb06c125ac45253f2f0785ce3747694f448 | 2026-01-04T15:48:40.201016Z | false |
basecamp/once-campfire | https://github.com/basecamp/once-campfire/blob/1852adb06c125ac45253f2f0785ce3747694f448/test/controllers/messages/by_bots_controller_test.rb | test/controllers/messages/by_bots_controller_test.rb | require "test_helper"
class Messages::ByBotsControlleTest < ActionDispatch::IntegrationTest
setup do
@room = rooms(:watercooler)
end
test "create" do
assert_difference -> { Message.count }, +1 do
post room_bot_messages_url(@room, users(:bender).bot_key), params: +"Hello Bot World!"
assert_eq... | ruby | MIT | 1852adb06c125ac45253f2f0785ce3747694f448 | 2026-01-04T15:48:40.201016Z | false |
basecamp/once-campfire | https://github.com/basecamp/once-campfire/blob/1852adb06c125ac45253f2f0785ce3747694f448/test/controllers/autocompletable/users_controller_test.rb | test/controllers/autocompletable/users_controller_test.rb | require "test_helper"
class Autocompletable::UsersControllerTest < ActionDispatch::IntegrationTest
setup do
sign_in :david
end
test "search returns matching users" do
get autocompletable_users_url(format: :json), params: { query: "da" }
assert_response :success
assert_equal "David", response.pa... | ruby | MIT | 1852adb06c125ac45253f2f0785ce3747694f448 | 2026-01-04T15:48:40.201016Z | false |
basecamp/once-campfire | https://github.com/basecamp/once-campfire/blob/1852adb06c125ac45253f2f0785ce3747694f448/test/controllers/sessions/transfers_controller_test.rb | test/controllers/sessions/transfers_controller_test.rb | require "test_helper"
class Sessions::TransfersControllerTest < ActionDispatch::IntegrationTest
test "show renders when not signed in" do
get session_transfer_url("some-token")
assert_response :success
end
test "update establishes a session when the code is valid" do
user = users(:david)
put s... | ruby | MIT | 1852adb06c125ac45253f2f0785ce3747694f448 | 2026-01-04T15:48:40.201016Z | false |
basecamp/once-campfire | https://github.com/basecamp/once-campfire/blob/1852adb06c125ac45253f2f0785ce3747694f448/test/controllers/accounts/join_codes_controller_test.rb | test/controllers/accounts/join_codes_controller_test.rb | require "test_helper"
class Accounts::JoinCodesControllerTest < ActionDispatch::IntegrationTest
setup do
sign_in :david
end
test "create new join code" do
assert_changes -> { accounts(:signal).reload.join_code } do
post account_join_code_url
assert_redirected_to edit_account_url
end
en... | ruby | MIT | 1852adb06c125ac45253f2f0785ce3747694f448 | 2026-01-04T15:48:40.201016Z | false |
basecamp/once-campfire | https://github.com/basecamp/once-campfire/blob/1852adb06c125ac45253f2f0785ce3747694f448/test/controllers/accounts/custom_styles_controller_test.rb | test/controllers/accounts/custom_styles_controller_test.rb | require "test_helper"
class Accounts::CustomStylesControllerTest < ActionDispatch::IntegrationTest
setup do
sign_in :david
end
test "edit" do
get edit_account_custom_styles_url
assert_response :ok
end
test "update" do
assert users(:david).administrator?
put account_custom_styles_url, p... | ruby | MIT | 1852adb06c125ac45253f2f0785ce3747694f448 | 2026-01-04T15:48:40.201016Z | false |
basecamp/once-campfire | https://github.com/basecamp/once-campfire/blob/1852adb06c125ac45253f2f0785ce3747694f448/test/controllers/accounts/bots_controller_test.rb | test/controllers/accounts/bots_controller_test.rb | require "test_helper"
class Accounts::BotsControllerTest < ActionDispatch::IntegrationTest
setup do
sign_in :david
end
test "index" do
get account_bots_url
assert_response :ok
end
test "create" do
get new_account_bot_url
assert_response :ok
post account_bots_url, params: { user: { ... | ruby | MIT | 1852adb06c125ac45253f2f0785ce3747694f448 | 2026-01-04T15:48:40.201016Z | false |
basecamp/once-campfire | https://github.com/basecamp/once-campfire/blob/1852adb06c125ac45253f2f0785ce3747694f448/test/controllers/accounts/users_controller_test.rb | test/controllers/accounts/users_controller_test.rb | require "test_helper"
class Accounts::UsersControllerTest < ActionDispatch::IntegrationTest
setup do
sign_in :david
end
test "update" do
assert users(:david).administrator?
put account_user_url(users(:david)), params: { user: { role: "administrator" } }
assert_redirected_to edit_account_url
... | ruby | MIT | 1852adb06c125ac45253f2f0785ce3747694f448 | 2026-01-04T15:48:40.201016Z | false |
basecamp/once-campfire | https://github.com/basecamp/once-campfire/blob/1852adb06c125ac45253f2f0785ce3747694f448/test/controllers/accounts/logos_controller_test.rb | test/controllers/accounts/logos_controller_test.rb | require "test_helper"
require "vips"
class Accounts::LogosControllerTest < ActionDispatch::IntegrationTest
setup do
sign_in :david
end
test "show stock" do
get account_logo_url
assert_valid_png_response size: 512
end
test "show stock small size" do
get account_logo_url(size: :small)
ass... | ruby | MIT | 1852adb06c125ac45253f2f0785ce3747694f448 | 2026-01-04T15:48:40.201016Z | false |
basecamp/once-campfire | https://github.com/basecamp/once-campfire/blob/1852adb06c125ac45253f2f0785ce3747694f448/test/controllers/accounts/bots/keys_controller_test.rb | test/controllers/accounts/bots/keys_controller_test.rb | require "test_helper"
class Accounts::Bots::KeysControllerTest < ActionDispatch::IntegrationTest
setup do
sign_in :david
end
test "update" do
assert_changes -> { users(:bender).reload.bot_token } do
put account_bot_key_url(users(:bender))
assert_redirected_to account_bots_url
end
end
e... | ruby | MIT | 1852adb06c125ac45253f2f0785ce3747694f448 | 2026-01-04T15:48:40.201016Z | false |
basecamp/once-campfire | https://github.com/basecamp/once-campfire/blob/1852adb06c125ac45253f2f0785ce3747694f448/test/controllers/users/bans_controller_test.rb | test/controllers/users/bans_controller_test.rb | require "test_helper"
class Users::BansControllerTest < ActionDispatch::IntegrationTest
setup do
sign_in :david
end
test "create bans user and creates ban records from sessions" do
user = users(:kevin)
user.sessions.create!(ip_address: "203.0.113.1", user_agent: "Test")
user.sessions.create!(ip_... | ruby | MIT | 1852adb06c125ac45253f2f0785ce3747694f448 | 2026-01-04T15:48:40.201016Z | false |
basecamp/once-campfire | https://github.com/basecamp/once-campfire/blob/1852adb06c125ac45253f2f0785ce3747694f448/test/controllers/users/sidebars_controller_test.rb | test/controllers/users/sidebars_controller_test.rb | require "test_helper"
class Users::SidebarsControllerTest < ActionDispatch::IntegrationTest
setup do
sign_in :david
end
test "show" do
get user_sidebar_url
users(:david).rooms.opens.each do |room|
assert_match /#{room.name}/, @response.body
end
end
test "unread directs" do
rooms(... | ruby | MIT | 1852adb06c125ac45253f2f0785ce3747694f448 | 2026-01-04T15:48:40.201016Z | false |
basecamp/once-campfire | https://github.com/basecamp/once-campfire/blob/1852adb06c125ac45253f2f0785ce3747694f448/test/controllers/users/avatars_controller_test.rb | test/controllers/users/avatars_controller_test.rb | require "test_helper"
class Users::AvatarsControllerTest < ActionDispatch::IntegrationTest
setup do
sign_in :david
end
test "show initials" do
get user_avatar_url(users(:kevin).avatar_token)
assert_select "text", text: "K"
end
test "show image" do
users(:kevin).update! avatar: fixture_file_... | ruby | MIT | 1852adb06c125ac45253f2f0785ce3747694f448 | 2026-01-04T15:48:40.201016Z | false |
basecamp/once-campfire | https://github.com/basecamp/once-campfire/blob/1852adb06c125ac45253f2f0785ce3747694f448/test/controllers/users/push_subscriptions_controller_test.rb | test/controllers/users/push_subscriptions_controller_test.rb | require "test_helper"
class Users::PushSubscriptionsControllerTest < ActionDispatch::IntegrationTest
setup do
sign_in :david
end
test "create new push subscription" do
subscription_params = { "endpoint" => "https://apple", "p256dh_key" => "123", "auth_key" => "456" }
post user_push_subscriptions_ur... | ruby | MIT | 1852adb06c125ac45253f2f0785ce3747694f448 | 2026-01-04T15:48:40.201016Z | false |
basecamp/once-campfire | https://github.com/basecamp/once-campfire/blob/1852adb06c125ac45253f2f0785ce3747694f448/test/controllers/users/profiles_controller_test.rb | test/controllers/users/profiles_controller_test.rb | require "test_helper"
class Users::ProfilesControllerTest < ActionDispatch::IntegrationTest
setup do
sign_in :david
end
test "show" do
get user_profile_url
assert_response :success
end
test "update" do
put user_profile_url, params: { user: { name: "John Doe", bio: "Acrobat" } }
assert... | ruby | MIT | 1852adb06c125ac45253f2f0785ce3747694f448 | 2026-01-04T15:48:40.201016Z | false |
basecamp/once-campfire | https://github.com/basecamp/once-campfire/blob/1852adb06c125ac45253f2f0785ce3747694f448/test/models/action_text_attachment_test.rb | test/models/action_text_attachment_test.rb | require "test_helper"
class ActionTextAttachmentTest < ActiveSupport::TestCase
setup do
@user = users(:david)
end
test "lookup user attachable with invalid sgid" do
message, signature = @user.attachable_sgid.split("--")
html = %Q(<action-text-attachment sgid="#{message}--invalid"></action-text-atta... | ruby | MIT | 1852adb06c125ac45253f2f0785ce3747694f448 | 2026-01-04T15:48:40.201016Z | false |
basecamp/once-campfire | https://github.com/basecamp/once-campfire/blob/1852adb06c125ac45253f2f0785ce3747694f448/test/models/user_test.rb | test/models/user_test.rb | require "test_helper"
class UserTest < ActiveSupport::TestCase
test "user does not prevent very long passwords" do
users(:david).update(password: "secret" * 50)
assert users(:david).valid?
end
test "creating users grants membership to the open rooms" do
assert_difference -> { Membership.count }, +Ro... | ruby | MIT | 1852adb06c125ac45253f2f0785ce3747694f448 | 2026-01-04T15:48:40.201016Z | false |
basecamp/once-campfire | https://github.com/basecamp/once-campfire/blob/1852adb06c125ac45253f2f0785ce3747694f448/test/models/first_run_test.rb | test/models/first_run_test.rb | require "test_helper"
class FirstRunTest < ActiveSupport::TestCase
setup do
Account.destroy_all
Room.destroy_all
User.destroy_all
end
test "creating makes first user an administrator" do
user = create_first_run_user
assert user.administrator?
end
test "first user has access to first roo... | ruby | MIT | 1852adb06c125ac45253f2f0785ce3747694f448 | 2026-01-04T15:48:40.201016Z | false |
basecamp/once-campfire | https://github.com/basecamp/once-campfire/blob/1852adb06c125ac45253f2f0785ce3747694f448/test/models/account_test.rb | test/models/account_test.rb | require "test_helper"
class AccountTest < ActiveSupport::TestCase
test "settings" do
accounts(:signal).settings.restrict_room_creation_to_administrators = true
assert accounts(:signal).settings.restrict_room_creation_to_administrators?
assert_equal({ "restrict_room_creation_to_administrators" => true }, ... | ruby | MIT | 1852adb06c125ac45253f2f0785ce3747694f448 | 2026-01-04T15:48:40.201016Z | false |
basecamp/once-campfire | https://github.com/basecamp/once-campfire/blob/1852adb06c125ac45253f2f0785ce3747694f448/test/models/membership_test.rb | test/models/membership_test.rb | require "test_helper"
class MembershipTest < ActiveSupport::TestCase
setup do
@membership = memberships(:david_watercooler)
end
test "connected scope" do
@membership.connected
assert Membership.connected.exists?(@membership.id)
@membership.disconnected
assert_not Membership.connected.exists... | ruby | MIT | 1852adb06c125ac45253f2f0785ce3747694f448 | 2026-01-04T15:48:40.201016Z | false |
basecamp/once-campfire | https://github.com/basecamp/once-campfire/blob/1852adb06c125ac45253f2f0785ce3747694f448/test/models/room_test.rb | test/models/room_test.rb | require "test_helper"
class RoomTest < ActiveSupport::TestCase
test "grant membership to user" do
rooms(:watercooler).memberships.grant_to(users(:kevin))
assert rooms(:watercooler).users.include?(users(:kevin))
end
test "revoke membership from user" do
rooms(:watercooler).memberships.revoke_from(use... | ruby | MIT | 1852adb06c125ac45253f2f0785ce3747694f448 | 2026-01-04T15:48:40.201016Z | false |
basecamp/once-campfire | https://github.com/basecamp/once-campfire/blob/1852adb06c125ac45253f2f0785ce3747694f448/test/models/message_test.rb | test/models/message_test.rb | require "test_helper"
class MessageTest < ActiveSupport::TestCase
include ActionCable::TestHelper, ActiveJob::TestHelper
test "creating a message enqueues to push later" do
assert_enqueued_jobs 1, only: [ Room::PushMessageJob ] do
create_new_message_in rooms(:designers)
end
end
test "all emoji"... | ruby | MIT | 1852adb06c125ac45253f2f0785ce3747694f448 | 2026-01-04T15:48:40.201016Z | false |
basecamp/once-campfire | https://github.com/basecamp/once-campfire/blob/1852adb06c125ac45253f2f0785ce3747694f448/test/models/webhook_test.rb | test/models/webhook_test.rb | require "test_helper"
class WebhookTest < ActiveSupport::TestCase
test "payload" do
message = messages(:first)
message_path = Rails.application.routes.url_helpers.room_at_message_path(message.room, message)
bot_messages_path = Rails.application.routes.url_helpers.room_bot_messages_path(message.room, user... | ruby | MIT | 1852adb06c125ac45253f2f0785ce3747694f448 | 2026-01-04T15:48:40.201016Z | false |
basecamp/once-campfire | https://github.com/basecamp/once-campfire/blob/1852adb06c125ac45253f2f0785ce3747694f448/test/models/room/push_test.rb | test/models/room/push_test.rb | require "test_helper"
class Room::PushTest < ActiveSupport::TestCase
include ActiveJob::TestHelper
test "deliver new message to other room users with push subscriptions" do
task_count = Push::Subscription.count - users(:david).push_subscriptions.count
perform_enqueued_jobs only: Room::PushMessageJob do
... | ruby | MIT | 1852adb06c125ac45253f2f0785ce3747694f448 | 2026-01-04T15:48:40.201016Z | false |
basecamp/once-campfire | https://github.com/basecamp/once-campfire/blob/1852adb06c125ac45253f2f0785ce3747694f448/test/models/user/role_test.rb | test/models/user/role_test.rb | require "test_helper"
class User::RoleTest < ActiveSupport::TestCase
test "creating subsequent users makes them members" do
assert User.create!(name: "User", email_address: "user@example.com", password: "secret123456").member?
end
test "can_administer?" do
assert User.new(role: :administrator).can_admin... | ruby | MIT | 1852adb06c125ac45253f2f0785ce3747694f448 | 2026-01-04T15:48:40.201016Z | false |
basecamp/once-campfire | https://github.com/basecamp/once-campfire/blob/1852adb06c125ac45253f2f0785ce3747694f448/test/models/user/bot_test.rb | test/models/user/bot_test.rb | require "test_helper"
class User::BotTest < ActiveSupport::TestCase
test "create bot" do
token = "5M0aLYwQyBXOXa5Wsz6NZb11EE4tW2"
SecureRandom.stubs(:alphanumeric).returns(token)
uuid = "3574925f-479d-44f8-82b7-fc039af5367c"
Random.stubs(:uuid).returns(uuid)
bot = User.create_bot!(name: "Bender... | ruby | MIT | 1852adb06c125ac45253f2f0785ce3747694f448 | 2026-01-04T15:48:40.201016Z | false |
basecamp/once-campfire | https://github.com/basecamp/once-campfire/blob/1852adb06c125ac45253f2f0785ce3747694f448/test/models/rooms/open_test.rb | test/models/rooms/open_test.rb | require "test_helper"
class Rooms::OpenTest < ActiveSupport::TestCase
test "grants access to all users after creation" do
room = Rooms::Open.create!(name: "My open room with everyone!", creator: users(:david))
assert_equal User.count, room.users.count
end
test "grants access to all users after becoming ... | ruby | MIT | 1852adb06c125ac45253f2f0785ce3747694f448 | 2026-01-04T15:48:40.201016Z | false |
basecamp/once-campfire | https://github.com/basecamp/once-campfire/blob/1852adb06c125ac45253f2f0785ce3747694f448/test/models/rooms/direct_test.rb | test/models/rooms/direct_test.rb | require "test_helper"
class Rooms::DirectTest < ActiveSupport::TestCase
test "create room for same users" do
room = Rooms::Direct.find_or_create_for([ users(:david), users(:kevin) ])
assert room.users.include?(users(:david))
assert room.users.include?(users(:kevin))
assert_not room.users.include?(use... | ruby | MIT | 1852adb06c125ac45253f2f0785ce3747694f448 | 2026-01-04T15:48:40.201016Z | false |
basecamp/once-campfire | https://github.com/basecamp/once-campfire/blob/1852adb06c125ac45253f2f0785ce3747694f448/test/models/account/joinable_test.rb | test/models/account/joinable_test.rb | require "test_helper"
class Account::JoinableTest < ActiveSupport::TestCase
test "new accounts get a joinable code" do
Account.destroy_all
account = Account.create!(name: "Chat")
assert_match /\w{4}-\w{4}-\w{4}/, account.join_code
end
test "accounts can reset join code" do
assert_changes -> { ac... | ruby | MIT | 1852adb06c125ac45253f2f0785ce3747694f448 | 2026-01-04T15:48:40.201016Z | false |
basecamp/once-campfire | https://github.com/basecamp/once-campfire/blob/1852adb06c125ac45253f2f0785ce3747694f448/test/models/opengraph/metadata_test.rb | test/models/opengraph/metadata_test.rb | require "test_helper"
class Opengraph::MetadataTest < ActiveSupport::TestCase
test "successful fetch" do
body = <<~HTML
<html>
<head>
<meta property="og:url" content="https://example.com">
<meta property="og:title" content="Hey!">
<meta property="og:description" conten... | ruby | MIT | 1852adb06c125ac45253f2f0785ce3747694f448 | 2026-01-04T15:48:40.201016Z | false |
basecamp/once-campfire | https://github.com/basecamp/once-campfire/blob/1852adb06c125ac45253f2f0785ce3747694f448/test/models/opengraph/fetch_test.rb | test/models/opengraph/fetch_test.rb | require "test_helper"
require "restricted_http/private_network_guard"
class Opengraph::FetchTest < ActiveSupport::TestCase
setup do
@fetch = Opengraph::Fetch.new
@url = URI.parse("https://www.example.com")
end
test "#fetch_document fetches valid HTML" do
WebMock.stub_request(:get, "https://www.examp... | ruby | MIT | 1852adb06c125ac45253f2f0785ce3747694f448 | 2026-01-04T15:48:40.201016Z | false |
basecamp/once-campfire | https://github.com/basecamp/once-campfire/blob/1852adb06c125ac45253f2f0785ce3747694f448/test/models/opengraph/document_test.rb | test/models/opengraph/document_test.rb | require "test_helper"
class Opengraph::DocumentTest < ActiveSupport::TestCase
test "extract opengraph tags using property attribute" do
document = Opengraph::Document.new("<html><head><meta property=\"og:url\" content=\"https://example.com\"><meta property=\"og:title\" content=\"Hey!\"><meta property=\"og:descri... | ruby | MIT | 1852adb06c125ac45253f2f0785ce3747694f448 | 2026-01-04T15:48:40.201016Z | false |
basecamp/once-campfire | https://github.com/basecamp/once-campfire/blob/1852adb06c125ac45253f2f0785ce3747694f448/test/models/opengraph/location_test.rb | test/models/opengraph/location_test.rb | require "test_helper"
require "restricted_http/private_network_guard"
class Opengraph::LocationTest < ActiveSupport::TestCase
test "url validations" do
assert Opengraph::Location.new("https://www.example.com").valid?
assert Opengraph::Location.new("http://www.example.com").valid?
assert_not Opengraph::L... | ruby | MIT | 1852adb06c125ac45253f2f0785ce3747694f448 | 2026-01-04T15:48:40.201016Z | false |
basecamp/once-campfire | https://github.com/basecamp/once-campfire/blob/1852adb06c125ac45253f2f0785ce3747694f448/test/models/message/attachment_test.rb | test/models/message/attachment_test.rb | require "test_helper"
class Message::AttachmentTest < ActiveSupport::TestCase
include ActiveJob::TestHelper
include ActionDispatch::TestProcess
test "creating a message creates image thumbnail" do
message = create_attachment_message("moon.jpg", "image/jpeg")
assert message.attachment.representation(:thu... | ruby | MIT | 1852adb06c125ac45253f2f0785ce3747694f448 | 2026-01-04T15:48:40.201016Z | false |
basecamp/once-campfire | https://github.com/basecamp/once-campfire/blob/1852adb06c125ac45253f2f0785ce3747694f448/test/models/message/searchable_test.rb | test/models/message/searchable_test.rb | require "test_helper"
class Message::SearchableTest < ActiveSupport::TestCase
test "message body is indexed and searchable" do
message = rooms(:designers).messages.create! body: "My hovercraft is full of eels", client_message_id: "earth", creator: users(:david)
assert_equal [ message ], rooms(:designers).mes... | ruby | MIT | 1852adb06c125ac45253f2f0785ce3747694f448 | 2026-01-04T15:48:40.201016Z | false |
basecamp/once-campfire | https://github.com/basecamp/once-campfire/blob/1852adb06c125ac45253f2f0785ce3747694f448/test/performance/create_dummy_cookies.rb | test/performance/create_dummy_cookies.rb | key_generator = ActiveSupport::KeyGenerator.new("dummy", iterations: 1000)
signed_cookie_secret = key_generator.generate_key("signed cookie")
signed_cookie_verifier = ActiveSupport::MessageVerifier.new(signed_cookie_secret, digest: "SHA1", serializer: ActiveSupport::MessageEncryptor::NullSerializer)
(1..10000).each do... | ruby | MIT | 1852adb06c125ac45253f2f0785ce3747694f448 | 2026-01-04T15:48:40.201016Z | false |
basecamp/once-campfire | https://github.com/basecamp/once-campfire/blob/1852adb06c125ac45253f2f0785ce3747694f448/test/test_helpers/system_test_helper.rb | test/test_helpers/system_test_helper.rb | module SystemTestHelper
def sign_in(email_address, password = "secret123456")
visit root_url
fill_in "email_address", with: email_address
fill_in "password", with: password
click_on "log_in"
assert_selector "a.btn", text: "Designers"
end
def wait_for_cable_connection
assert_selector "tu... | ruby | MIT | 1852adb06c125ac45253f2f0785ce3747694f448 | 2026-01-04T15:48:40.201016Z | false |
basecamp/once-campfire | https://github.com/basecamp/once-campfire/blob/1852adb06c125ac45253f2f0785ce3747694f448/test/test_helpers/turbo_test_helper.rb | test/test_helpers/turbo_test_helper.rb | module TurboTestHelper
def assert_rendered_turbo_stream_broadcast(*streambles, action:, target:, &block)
streams = find_broadcasts_for(*streambles)
target = ActionView::RecordIdentifier.dom_id(*target)
assert_select Nokogiri::HTML.fragment(streams), %(turbo-stream[action="#{action}"][target="#{target}"]),... | ruby | MIT | 1852adb06c125ac45253f2f0785ce3747694f448 | 2026-01-04T15:48:40.201016Z | false |
basecamp/once-campfire | https://github.com/basecamp/once-campfire/blob/1852adb06c125ac45253f2f0785ce3747694f448/test/test_helpers/mention_test_helper.rb | test/test_helpers/mention_test_helper.rb | module MentionTestHelper
def mention_attachment_for(name)
user = users(name)
attachment_body = ApplicationController.render partial: "users/mention", locals: { user: user }
"<action-text-attachment sgid=\"#{user.attachable_sgid}\" content-type=\"application/vnd.campfire.mention\" content=\"#{attachment_bo... | ruby | MIT | 1852adb06c125ac45253f2f0785ce3747694f448 | 2026-01-04T15:48:40.201016Z | false |
basecamp/once-campfire | https://github.com/basecamp/once-campfire/blob/1852adb06c125ac45253f2f0785ce3747694f448/test/test_helpers/session_test_helper.rb | test/test_helpers/session_test_helper.rb | module SessionTestHelper
def parsed_cookies
ActionDispatch::Cookies::CookieJar.build(request, cookies.to_hash)
end
def sign_in(user)
user = users(user) unless user.is_a? User
post session_url, params: { email_address: user.email_address, password: "secret123456" }
assert cookies[:session_token].p... | ruby | MIT | 1852adb06c125ac45253f2f0785ce3747694f448 | 2026-01-04T15:48:40.201016Z | false |
basecamp/once-campfire | https://github.com/basecamp/once-campfire/blob/1852adb06c125ac45253f2f0785ce3747694f448/test/lib/restricted_http/private_network_guard_test.rb | test/lib/restricted_http/private_network_guard_test.rb | require "test_helper"
require "restricted_http/private_network_guard"
class RestrictedHTTP::PrivateNetworkGuardTest < ActiveSupport::TestCase
test "private_ip? returns true for 'This' network (RFC1700)" do
assert_private_ip "0.0.0.0"
assert_private_ip "0.255.255.255"
end
test "private_ip? returns true f... | ruby | MIT | 1852adb06c125ac45253f2f0785ce3747694f448 | 2026-01-04T15:48:40.201016Z | false |
basecamp/once-campfire | https://github.com/basecamp/once-campfire/blob/1852adb06c125ac45253f2f0785ce3747694f448/test/lib/rails_ext/action_text_attachables_test.rb | test/lib/rails_ext/action_text_attachables_test.rb | require "test_helper"
class ActionText::AttachmentTest < ActiveSupport::TestCase
setup do
@user = users(:david)
end
test "from_node" do
html = %Q(<action-text-attachment sgid="#{@user.attachable_sgid}"></action-text-attachment>)
node = ActionText::Fragment.wrap(html).find_all(ActionText::Attachment.... | ruby | MIT | 1852adb06c125ac45253f2f0785ce3747694f448 | 2026-01-04T15:48:40.201016Z | false |
basecamp/once-campfire | https://github.com/basecamp/once-campfire/blob/1852adb06c125ac45253f2f0785ce3747694f448/test/channels/presence_channel_test.rb | test/channels/presence_channel_test.rb | require "test_helper"
class PresenceChannelTest < ActionCable::Channel::TestCase
setup do
stub_connection(current_user: users(:david))
end
test "subscribes" do
room = users(:david).rooms.first
subscribe room_id: room.id
assert subscription.confirmed?
assert_has_stream_for room
end
tes... | ruby | MIT | 1852adb06c125ac45253f2f0785ce3747694f448 | 2026-01-04T15:48:40.201016Z | false |
basecamp/once-campfire | https://github.com/basecamp/once-campfire/blob/1852adb06c125ac45253f2f0785ce3747694f448/test/channels/application_cable/connection_test.rb | test/channels/application_cable/connection_test.rb | require "test_helper"
class ApplicationCable::ConnectionTest < ActionCable::Connection::TestCase
test "connects with valid user_id cookie" do
cookies.signed[:session_token] = sessions(:david_safari).token
connect
assert_equal users(:david), connection.current_user
end
test "rejects connection with... | ruby | MIT | 1852adb06c125ac45253f2f0785ce3747694f448 | 2026-01-04T15:48:40.201016Z | false |
basecamp/once-campfire | https://github.com/basecamp/once-campfire/blob/1852adb06c125ac45253f2f0785ce3747694f448/lib/web_push/pool.rb | lib/web_push/pool.rb | # This is in lib so we can use it in a thread pool without the Rails executor
class WebPush::Pool
attr_reader :delivery_pool, :invalidation_pool, :connection, :invalid_subscription_handler
def initialize(invalid_subscription_handler:)
@delivery_pool = Concurrent::ThreadPoolExecutor.new(max_threads: 50, queue_s... | ruby | MIT | 1852adb06c125ac45253f2f0785ce3747694f448 | 2026-01-04T15:48:40.201016Z | false |
basecamp/once-campfire | https://github.com/basecamp/once-campfire/blob/1852adb06c125ac45253f2f0785ce3747694f448/lib/web_push/notification.rb | lib/web_push/notification.rb | class WebPush::Notification
def initialize(title:, body:, path:, badge:, endpoint:, p256dh_key:, auth_key:)
@title, @body, @path, @badge = title, body, path, badge
@endpoint, @p256dh_key, @auth_key = endpoint, p256dh_key, auth_key
end
def deliver(connection: nil)
WebPush.payload_send \
message:... | ruby | MIT | 1852adb06c125ac45253f2f0785ce3747694f448 | 2026-01-04T15:48:40.201016Z | false |
basecamp/once-campfire | https://github.com/basecamp/once-campfire/blob/1852adb06c125ac45253f2f0785ce3747694f448/lib/restricted_http/private_network_guard.rb | lib/restricted_http/private_network_guard.rb | require "resolv"
module RestrictedHTTP
class Violation < StandardError; end
module PrivateNetworkGuard
extend self
LOCAL_IP = IPAddr.new("0.0.0.0/8") # "This" network
def resolve(hostname)
Resolv.getaddress(hostname).tap do |ip|
raise Violation.new("Attempt to access private IP via #{h... | ruby | MIT | 1852adb06c125ac45253f2f0785ce3747694f448 | 2026-01-04T15:48:40.201016Z | false |
basecamp/once-campfire | https://github.com/basecamp/once-campfire/blob/1852adb06c125ac45253f2f0785ce3747694f448/lib/rails_ext/actiontext_opengraph_embeds.rb | lib/rails_ext/actiontext_opengraph_embeds.rb | class ActionText::Attachment::OpengraphEmbed
include ActiveModel::Model
OPENGRAPH_EMBED_CONTENT_TYPE = "application/vnd.actiontext.opengraph-embed"
class << self
def from_node(node)
if node["content-type"]
if matches = node["content-type"].match(OPENGRAPH_EMBED_CONTENT_TYPE)
attachme... | ruby | MIT | 1852adb06c125ac45253f2f0785ce3747694f448 | 2026-01-04T15:48:40.201016Z | false |
basecamp/once-campfire | https://github.com/basecamp/once-campfire/blob/1852adb06c125ac45253f2f0785ce3747694f448/lib/rails_ext/filter.rb | lib/rails_ext/filter.rb | class ActionText::Content::Filter
class << self
def apply(content)
filter = new(content)
filter.applicable? ? ActionText::Content.new(filter.apply, canonicalize: false) : content
end
end
def initialize(content)
@content = content
end
def applicable?
raise NotImplementedError
en... | ruby | MIT | 1852adb06c125ac45253f2f0785ce3747694f448 | 2026-01-04T15:48:40.201016Z | false |
basecamp/once-campfire | https://github.com/basecamp/once-campfire/blob/1852adb06c125ac45253f2f0785ce3747694f448/lib/rails_ext/string.rb | lib/rails_ext/string.rb | class String
def all_emoji?
self.match? /\A(\p{Emoji_Presentation}|\p{Extended_Pictographic}|\uFE0F)+\z/u
end
end
| ruby | MIT | 1852adb06c125ac45253f2f0785ce3747694f448 | 2026-01-04T15:48:40.201016Z | false |
basecamp/once-campfire | https://github.com/basecamp/once-campfire/blob/1852adb06c125ac45253f2f0785ce3747694f448/lib/rails_ext/filters.rb | lib/rails_ext/filters.rb | class ActionText::Content::Filters
def initialize(*filters)
@filters = filters
end
def apply(content)
filters.reduce(content) { |content, filter| filter.apply(content) }
end
private
attr_reader :filters
end
| ruby | MIT | 1852adb06c125ac45253f2f0785ce3747694f448 | 2026-01-04T15:48:40.201016Z | false |
basecamp/once-campfire | https://github.com/basecamp/once-campfire/blob/1852adb06c125ac45253f2f0785ce3747694f448/lib/rails_ext/action_text_attachables.rb | lib/rails_ext/action_text_attachables.rb | ActiveSupport.on_load(:action_text_content) do
class ActionText::Attachment
class << self
def from_node(node, attachable = nil)
new(node, attachable || ActionText::Attachment::OpengraphEmbed.from_node(node) || attachable_from_possibly_expired_sgid(node["sgid"]) || ActionText::Attachable.from_node(no... | ruby | MIT | 1852adb06c125ac45253f2f0785ce3747694f448 | 2026-01-04T15:48:40.201016Z | false |
basecamp/once-campfire | https://github.com/basecamp/once-campfire/blob/1852adb06c125ac45253f2f0785ce3747694f448/config/ci.rb | config/ci.rb | # Run using bin/ci
CI.run do
step "Setup", "bin/setup --skip-server"
step "Style: Ruby", "bin/rubocop"
step "Security: Gem audit", "bin/bundler-audit"
step "Security: Importmap vulnerability audit", "bin/importmap audit"
step "Security: Brakeman code analysis", "bin/brakeman --quiet --no-pager --exit-on-wa... | ruby | MIT | 1852adb06c125ac45253f2f0785ce3747694f448 | 2026-01-04T15:48:40.201016Z | false |
basecamp/once-campfire | https://github.com/basecamp/once-campfire/blob/1852adb06c125ac45253f2f0785ce3747694f448/config/application.rb | config/application.rb | require_relative "boot"
require "rails/all"
Bundler.require(*Rails.groups)
module Campfire
class Application < Rails::Application
# Initialize configuration defaults for originally generated Rails version.
config.load_defaults 8.2
# Please, add to the `ignore` list any other `lib` subdirectories that ... | ruby | MIT | 1852adb06c125ac45253f2f0785ce3747694f448 | 2026-01-04T15:48:40.201016Z | false |
basecamp/once-campfire | https://github.com/basecamp/once-campfire/blob/1852adb06c125ac45253f2f0785ce3747694f448/config/environment.rb | config/environment.rb | # Load the Rails application.
require_relative "application"
# Initialize the Rails application.
Rails.application.initialize!
| ruby | MIT | 1852adb06c125ac45253f2f0785ce3747694f448 | 2026-01-04T15:48:40.201016Z | false |
basecamp/once-campfire | https://github.com/basecamp/once-campfire/blob/1852adb06c125ac45253f2f0785ce3747694f448/config/puma.rb | config/puma.rb | require File.expand_path("../config/environment", File.dirname(__FILE__))
# Puma can serve each request in a thread from an internal thread pool.
# The `threads` method setting takes two numbers: a minimum and maximum.
# Any libraries that use thread pools should be configured to match
# the maximum value specified fo... | ruby | MIT | 1852adb06c125ac45253f2f0785ce3747694f448 | 2026-01-04T15:48:40.201016Z | false |
basecamp/once-campfire | https://github.com/basecamp/once-campfire/blob/1852adb06c125ac45253f2f0785ce3747694f448/config/routes.rb | config/routes.rb | Rails.application.routes.draw do
root "welcome#show"
resource :first_run
resource :session do
scope module: "sessions" do
resources :transfers, only: %i[ show update ]
end
end
resource :account do
scope module: "accounts" do
resources :users
resources :bots do
scope m... | ruby | MIT | 1852adb06c125ac45253f2f0785ce3747694f448 | 2026-01-04T15:48:40.201016Z | false |
basecamp/once-campfire | https://github.com/basecamp/once-campfire/blob/1852adb06c125ac45253f2f0785ce3747694f448/config/importmap.rb | config/importmap.rb | pin "application"
pin "@hotwired/stimulus", to: "stimulus.min.js"
pin "@hotwired/stimulus-loading", to: "stimulus-loading.js"
pin "@hotwired/turbo-rails", to: "turbo.js"
pin "@rails/actioncable", to: "actioncable.esm.js"
pin "@rails/request.js", to: "@rails--request.js" # @0.0.8
pin "trix", to: "trix.esm.min.js" # @2.... | ruby | MIT | 1852adb06c125ac45253f2f0785ce3747694f448 | 2026-01-04T15:48:40.201016Z | false |
basecamp/once-campfire | https://github.com/basecamp/once-campfire/blob/1852adb06c125ac45253f2f0785ce3747694f448/config/boot.rb | config/boot.rb | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
require "bundler/setup" # Set up gems listed in the Gemfile.
| ruby | MIT | 1852adb06c125ac45253f2f0785ce3747694f448 | 2026-01-04T15:48:40.201016Z | false |
basecamp/once-campfire | https://github.com/basecamp/once-campfire/blob/1852adb06c125ac45253f2f0785ce3747694f448/config/puma_dev.rb | config/puma_dev.rb | require File.expand_path("../config/environment", File.dirname(__FILE__))
Signal.trap :SIGPROF do
Thread.list.each do |t|
puts t
puts t.backtrace
puts
end
end
| ruby | MIT | 1852adb06c125ac45253f2f0785ce3747694f448 | 2026-01-04T15:48:40.201016Z | false |
basecamp/once-campfire | https://github.com/basecamp/once-campfire/blob/1852adb06c125ac45253f2f0785ce3747694f448/config/initializers/content_security_policy.rb | config/initializers/content_security_policy.rb | # Be sure to restart your server when you modify this file.
# Define an application-wide content security policy.
# See the Securing Rails Applications Guide for more information:
# https://guides.rubyonrails.org/security.html#content-security-policy-header
# Rails.application.configure do
# config.content_security... | ruby | MIT | 1852adb06c125ac45253f2f0785ce3747694f448 | 2026-01-04T15:48:40.201016Z | false |
basecamp/once-campfire | https://github.com/basecamp/once-campfire/blob/1852adb06c125ac45253f2f0785ce3747694f448/config/initializers/filter_parameter_logging.rb | config/initializers/filter_parameter_logging.rb | # Be sure to restart your server when you modify this file.
# Configure parameters to be filtered from the log file. Use this to limit dissemination of
# sensitive information. See the ActiveSupport::ParameterFilter documentation for supported
# notations and behaviors.
Rails.application.config.filter_parameters += [
... | ruby | MIT | 1852adb06c125ac45253f2f0785ce3747694f448 | 2026-01-04T15:48:40.201016Z | false |
basecamp/once-campfire | https://github.com/basecamp/once-campfire/blob/1852adb06c125ac45253f2f0785ce3747694f448/config/initializers/version.rb | config/initializers/version.rb | Rails.application.config.app_version = ENV.fetch("APP_VERSION", "0")
Rails.application.config.git_revision = ENV["GIT_REVISION"]
| ruby | MIT | 1852adb06c125ac45253f2f0785ce3747694f448 | 2026-01-04T15:48:40.201016Z | false |
basecamp/once-campfire | https://github.com/basecamp/once-campfire/blob/1852adb06c125ac45253f2f0785ce3747694f448/config/initializers/extensions.rb | config/initializers/extensions.rb | %w[ rails_ext ].each do |extensions_dir|
Dir["#{Rails.root}/lib/#{extensions_dir}/*"].each { |path| require "#{extensions_dir}/#{File.basename(path)}" }
end
| ruby | MIT | 1852adb06c125ac45253f2f0785ce3747694f448 | 2026-01-04T15:48:40.201016Z | false |
basecamp/once-campfire | https://github.com/basecamp/once-campfire/blob/1852adb06c125ac45253f2f0785ce3747694f448/config/initializers/time_formats.rb | config/initializers/time_formats.rb | # Used to match JavaScripts (new Date).getTime() for sorting
Time::DATE_FORMATS[:epoch] = ->(time) { (time.to_f * 1000).to_i }
| ruby | MIT | 1852adb06c125ac45253f2f0785ce3747694f448 | 2026-01-04T15:48:40.201016Z | false |
basecamp/once-campfire | https://github.com/basecamp/once-campfire/blob/1852adb06c125ac45253f2f0785ce3747694f448/config/initializers/session_store.rb | config/initializers/session_store.rb | Rails.application.config.session_store :cookie_store,
key: "_campfire_session",
# Persist session cookie as permament so re-opened browser windows maintain a CSRF token
expire_after: 20.years
| ruby | MIT | 1852adb06c125ac45253f2f0785ce3747694f448 | 2026-01-04T15:48:40.201016Z | false |
basecamp/once-campfire | https://github.com/basecamp/once-campfire/blob/1852adb06c125ac45253f2f0785ce3747694f448/config/initializers/storage_paths.rb | config/initializers/storage_paths.rb | Rails.application.config.after_initialize do
%w[ db files ].each do |dir|
Rails.root.join("storage", dir).mkpath
end
end
| ruby | MIT | 1852adb06c125ac45253f2f0785ce3747694f448 | 2026-01-04T15:48:40.201016Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.