source
stringclasses
1 value
repo
stringlengths
5
63
repo_url
stringlengths
24
82
path
stringlengths
5
167
language
stringclasses
1 value
license
stringclasses
5 values
stars
int64
10
51.4k
ref
stringclasses
23 values
size_bytes
int64
200
258k
text
stringlengths
137
258k
github
Arie/serveme
https://github.com/Arie/serveme
spec/models/reservation_spec.rb
Ruby
apache-2.0
97
master
38,180
# typed: false # frozen_string_literal: true require 'spec_helper' describe Reservation do context 'with a custom whitelist' do it 'saves a new custom whitelist from whitelist.tf' do request = double(body: 'the whitelist', success?: true) connection = double connection.should_receive(:get).wit...
github
Arie/serveme
https://github.com/Arie/serveme
spec/models/server_spec.rb
Ruby
apache-2.0
97
master
5,411
# typed: false # frozen_string_literal: true require 'spec_helper' RSpec.describe Server do describe '#rcon_say' do let(:server) { build_stubbed(:server) } before do allow(server).to receive(:rcon_exec).and_return("ok") end it 'splits long messages at word boundaries' do long_message =...
github
Arie/serveme
https://github.com/Arie/serveme
spec/models/rcon_ftp_server_spec.rb
Ruby
apache-2.0
97
master
6,579
# typed: false # frozen_string_literal: true require 'spec_helper' describe RconFtpServer do before do subject.stub(tf_dir: '/foo/bar') end describe '#remove_configuration' do it 'deletes the reservation configs' do configuration_files = [ '/foo/bar/cfg/reservation.cfg', '/foo/bar/cfg/ctf_turbine...
github
Arie/serveme
https://github.com/Arie/serveme
spec/models/server_info_spec.rb
Ruby
apache-2.0
97
master
6,206
# typed: false # frozen_string_literal: true require 'spec_helper' describe ServerInfo do let(:server) { instance_double(Server, name: 'Name', ip: 'fakkelbrigade.eu', port: '27015', current_rcon: 'foo', id: 1, condenser: SteamCondenser::Servers::SourceServer.stub(:new)) } subject do described_class.new(server...
github
Arie/serveme
https://github.com/Arie/serveme
spec/models/user_spec.rb
Ruby
apache-2.0
97
master
7,192
# typed: false # frozen_string_literal: true require 'spec_helper' describe User do describe '#steam_profile_url' do it 'creates a steam profile url based on the uid' do subject.stub(uid: '123') subject.steam_profile_url.should eql 'https://steamcommunity.com/profiles/123' end end describe ...
github
Arie/serveme
https://github.com/Arie/serveme
spec/models/voucher_spec.rb
Ruby
apache-2.0
97
master
580
# typed: false # frozen_string_literal: true require 'spec_helper' describe Voucher do describe '.find_voucher' do it 'returns nil when a bad code is entered' do described_class.find_voucher("a\/13/13r 13r j13ro ").should be_nil end it 'finds a voucher by its crockforded code' do voucher =...
github
Arie/serveme
https://github.com/Arie/serveme
spec/models/file_upload_spec.rb
Ruby
apache-2.0
97
master
7,097
# typed: false # frozen_string_literal: true require 'spec_helper' describe FileUpload do it 'requires a user' do subject.valid? subject.should have(1).error_on(:user_id) end context 'archives', :map_archive do context 'zip' do it 'sends the files to the servers' do create(:server) ...
github
Arie/serveme
https://github.com/Arie/serveme
spec/models/ssh_server_spec.rb
Ruby
apache-2.0
97
master
8,382
# typed: false # frozen_string_literal: true require 'spec_helper' describe SshServer do describe '#remove_configuration' do it 'deletes the reservation configs' do subject.stub(tf_dir: '/tmp/foo/tf') subject.should_receive(:execute).with('rm -f /tmp/foo/tf/cfg/reservation.cfg /tmp/foo/tf/cfg/ctf_tu...
github
Arie/serveme
https://github.com/Arie/serveme
spec/models/product_spec.rb
Ruby
apache-2.0
97
master
1,045
# typed: false # frozen_string_literal: true require 'spec_helper' describe Product do before { Product.destroy_all } describe '#list_name' do it 'is a name with the rounded price included for use in the dropdown' do subject.name = 'foobar' subject.price = 12.34 subject.currency = 'EUR' ...
github
Arie/serveme
https://github.com/Arie/serveme
spec/models/server_statistic_spec.rb
Ruby
apache-2.0
97
master
1,497
# typed: false # frozen_string_literal: true require "spec_helper" RSpec.describe ServerStatistic do let(:user) { create(:user) } let(:server) { create(:server) } let(:reservation) do create(:reservation, user: user, server: server, starts_at: Time.current, ends_a...
github
Arie/serveme
https://github.com/Arie/serveme
spec/support/geocoder.rb
Ruby
apache-2.0
97
master
655
# typed: true # frozen_string_literal: true module Geocoder module Lookup class MaxmindLocal private remove_method(:results) def results(query) return [] if query.to_s == 'no results' if query.to_s == '127.0.0.1' [] else [ { request: '8.8.8.8', ip:...
github
Arie/serveme
https://github.com/Arie/serveme
spec/support/api_controller_authentication.rb
Ruby
apache-2.0
97
master
347
# typed: false # frozen_string_literal: true module ApiControllerAuthentication def self.included(base) base.extend Macros end module Macros def stub_api_authentication before do controller.stub(:verify_api_key) end end end end RSpec.configuration.include(ApiControllerAuthenti...
github
Arie/serveme
https://github.com/Arie/serveme
spec/helpers/rcon_helper_spec.rb
Ruby
apache-2.0
97
master
679
# typed: false # frozen_string_literal: true require 'spec_helper' describe RconHelper do let(:host_class) { Class.new { include RconHelper } } let(:instance) { host_class.new } describe '#clean_rcon' do it 'replaces leading map command with changelevel' do expect(instance.clean_rcon('map cp_badlands...
github
Arie/serveme
https://github.com/Arie/serveme
spec/integration/api_swagger_spec.rb
Ruby
apache-2.0
97
master
45,934
# typed: false # frozen_string_literal: true require 'spec_helper' require 'swagger_helper' RSpec.describe 'serveme.tf API', type: :request do let(:user) { create(:user).tap { |u| u.generate_api_key! } } let(:admin_user) { create(:user).tap { |u| u.groups << Group.admin_group; u.generate_api_key! } } let(:api_k...
github
Arie/serveme
https://github.com/Arie/serveme
spec/lib/safe_file_deletion_spec.rb
Ruby
apache-2.0
97
master
7,953
# typed: false # frozen_string_literal: true require 'spec_helper' require 'safe_file_deletion' describe SafeFileDeletion do describe '.validate_temp_directory!' do context 'with valid paths' do it 'accepts paths matching /tmp/reservation-{digits}' do expect { described_class.validate_temp_directo...
github
Arie/serveme
https://github.com/Arie/serveme
spec/decorators/server_decorator_spec.rb
Ruby
apache-2.0
97
master
789
# typed: false # frozen_string_literal: true require 'spec_helper' describe ServerDecorator do let(:server) { build(:server, name: 'Name') } subject { ServerDecorator.new(server) } describe '#name' do it 'decorates the server name with a flag' do subject.stub(flag: 'foo') subject.name.should ==...
github
Arie/serveme
https://github.com/Arie/serveme
spec/decorators/user_decorator_spec.rb
Ruby
apache-2.0
97
master
1,012
# typed: false # frozen_string_literal: true require 'spec_helper' describe UserDecorator do let(:user) { build(:server, name: 'Name') } subject { UserDecorator.new(user) } describe '#nickname' do context 'donator' do it 'decorates the nickname with a donator icon' do user.stub(donator?: true...
github
Arie/serveme
https://github.com/Arie/serveme
spec/services/live_match_stats_spec.rb
Ruby
apache-2.0
97
master
19,416
# typed: false # frozen_string_literal: true require 'spec_helper' describe LiveMatchStats do let(:reservation_id) { 99999 } let(:round_start) { 'L 03/22/2026 - 20:01:00: World triggered "Round_Start"' } before do described_class.clear(reservation_id) end after do described_class.clear(reservation...
github
Arie/serveme
https://github.com/Arie/serveme
spec/services/local_log_copier_spec.rb
Ruby
apache-2.0
97
master
799
# typed: false # frozen_string_literal: true require 'spec_helper' describe LocalLogCopier do describe '#copy_logs' do it 'uses Open3.capture3 to strip IPs and copy logs' do logs = [ 'foo', 'bar', "b'az" ] server = double(logs: logs) reservation = double(id: 1) log_copier = LocalLogCopie...
github
Arie/serveme
https://github.com/Arie/serveme
spec/services/rgl_api_spec.rb
Ruby
apache-2.0
97
master
2,648
# typed: false require 'spec_helper' require 'webmock/rspec' RSpec.describe RglApi do let(:steam_uid) { '76561198012598620' } let(:profile_response) { { name: 'Test Player' }.to_json } describe '.profile' do context 'when response is cached' do before do Rails.cache.write("rgl_profile_#{steam...
github
Arie/serveme
https://github.com/Arie/serveme
spec/services/map_search_service_spec.rb
Ruby
apache-2.0
97
master
6,705
# typed: false require 'spec_helper' RSpec.describe MapSearchService do let(:available_maps) { [ 'cp_process_f12', 'cp_process_f11', 'cp_process_final', 'cp_gullywash_f9', 'cp_gullywash_pro', 'cp_sunshine', 'koth_product_final', 'koth_pro_rc1', 'cp_prolands_rc2', 'random_map'...
github
Arie/serveme
https://github.com/Arie/serveme
spec/services/ip_quality_score_service_spec.rb
Ruby
apache-2.0
97
master
4,489
# typed: false # frozen_string_literal: true require "spec_helper" require "webmock/rspec" describe IpQualityScoreService do let(:api_key) { "test_api_key" } let(:ip) { "47.154.67.194" } before do allow(Rails.application.credentials).to receive(:dig) .with(:ipqs, :api_key).and_return(api_key) end ...
github
Arie/serveme
https://github.com/Arie/serveme
spec/services/cloudflare_dns_service_spec.rb
Ruby
apache-2.0
97
master
4,997
# typed: false # frozen_string_literal: true require "spec_helper" require "webmock/rspec" describe CloudflareDnsService do let(:zone_id) { "fake_zone_id" } let(:api_token) { "fake_api_token" } before do allow(Rails.application.credentials).to receive(:dig).and_call_original allow(Rails.application.cre...
github
Arie/serveme
https://github.com/Arie/serveme
spec/services/find_players_in_log_spec.rb
Ruby
apache-2.0
97
master
685
# typed: strict # frozen_string_literal: true require 'spec_helper' describe FindPlayersInLog do describe '.perform' do it 'takes a log and finds the players in it' do log = Rails.root.join('spec', 'fixtures', 'logs', 'special_characters.log') FindPlayersInLog.perform(log).should == [ 76_561_197_970...
github
Arie/serveme
https://github.com/Arie/serveme
spec/services/server_metric_spec.rb
Ruby
apache-2.0
97
master
10,435
# typed: false # frozen_string_literal: true require 'spec_helper' describe ServerMetric do let(:rcon_stats_output) do %|CPU In (KB/s) Out (KB/s) Uptime Map changes FPS Players Connects 24.88 35.29 54.48 6 2 66.67 17 21| end let(:rcon_status_output) do ...
github
Arie/serveme
https://github.com/Arie/serveme
spec/services/player_announcement_service_spec.rb
Ruby
apache-2.0
97
master
8,946
# typed: false # frozen_string_literal: true require "spec_helper" describe PlayerAnnouncementService do let(:steam_uid) { 76561198012345678 } let(:ip) { "85.139.95.110" } before do allow(Geocoder).to receive(:search).and_return([]) allow(ReservationPlayer).to receive(:asn).and_return(nil) end des...
github
Arie/serveme
https://github.com/Arie/serveme
spec/services/openai_client_spec.rb
Ruby
apache-2.0
97
master
1,494
# typed: false require 'spec_helper' RSpec.describe OpenaiClient do let(:openai_client) { instance_double(::OpenAI::Client) } let(:parameters) { { model: "test-model", messages: [] } } let(:response) { { "choices" => [ { "message" => { "content" => "test" } } ] } } let(:api_key) { "test-api-key" } before(:...
github
Arie/serveme
https://github.com/Arie/serveme
spec/services/log_copier_spec.rb
Ruby
apache-2.0
97
master
2,224
# typed: false # frozen_string_literal: true require 'spec_helper' describe LogCopier do describe '.copy' do it 'logs and error and instantiates the right kind of log copier' do dummy_log_copier_class = double(:dummy_log_copier_class) dummy_log_copier = double(:dummy_log_copier) reservation = ...
github
Arie/serveme
https://github.com/Arie/serveme
spec/services/zip_file_creator_spec.rb
Ruby
apache-2.0
97
master
1,027
# typed: false # frozen_string_literal: true require 'spec_helper' describe ZipFileCreator do let(:zipper_class) { LocalZipFileCreator } let(:server) { double(zip_file_creator_class: zipper_class) } let(:reservation) { double(server: server) } let(:files_to_zip) { double } describe '.create' do ...
github
Arie/serveme
https://github.com/Arie/serveme
spec/services/ban_appeal_enrichment_service_spec.rb
Ruby
apache-2.0
97
master
13,272
# typed: false # frozen_string_literal: true require "spec_helper" require "webmock/rspec" describe BanAppealEnrichmentService do let(:discord_uid) { "111222333444" } around do |example| VCR.turned_off do WebMock.allow_net_connect! example.run WebMock.disable_net_connect! end end d...
github
Arie/serveme
https://github.com/Arie/serveme
spec/services/add_group_membership_spec.rb
Ruby
apache-2.0
97
master
1,177
# typed: false # frozen_string_literal: true require 'spec_helper' describe AddGroupMembership do subject { described_class.new(31, build_stubbed(:user)) } describe '#update_group_membership' do it 'adds extra days to the donator status expiration date' do old_expires_at = 1.week.from_now number_o...
github
Arie/serveme
https://github.com/Arie/serveme
spec/services/docker_host_setup_service_spec.rb
Ruby
apache-2.0
97
master
8,783
# typed: false # frozen_string_literal: true require "spec_helper" require "webmock/rspec" describe DockerHostSetupService do let(:docker_host) { create(:docker_host, hostname: "de1.serveme.tf", ip: "1.2.3.4") } subject { described_class.new(docker_host) } describe "#create_vm" do let(:docker_host) { creat...
github
Arie/serveme
https://github.com/Arie/serveme
spec/services/discord_api_client_spec.rb
Ruby
apache-2.0
97
master
3,520
# typed: false # frozen_string_literal: true require "spec_helper" require "webmock/rspec" RSpec.describe DiscordApiClient do describe ".update_message" do let(:channel_id) { "123456789" } let(:message_id) { "987654321" } let(:embed) { { title: "Test", color: 0x00FF00 } } before do allow(Rail...
github
Arie/serveme
https://github.com/Arie/serveme
spec/services/league_maps_sync_service_spec.rb
Ruby
apache-2.0
97
master
7,858
# typed: false # frozen_string_literal: true require "spec_helper" require "webmock/rspec" RSpec.describe LeagueMapsSyncService do let(:service) { described_class.new } let(:valid_yaml_config) do { "league_maps" => [ { "name" => "Test League", "active" => true, "ma...
github
Arie/serveme
https://github.com/Arie/serveme
spec/services/ozfortress_api_spec.rb
Ruby
apache-2.0
97
master
3,420
# typed: false require "spec_helper" require "webmock/rspec" RSpec.describe OzfortressApi do describe ".steam_id_for_discord" do let(:discord_uid) { "123456789012345678" } let(:api_key) { "test_api_key" } before do allow(Rails.application.credentials).to receive(:dig).and_call_original allo...
github
Arie/serveme
https://github.com/Arie/serveme
spec/services/docker_host_reservation_creator_spec.rb
Ruby
apache-2.0
97
master
2,805
# typed: false # frozen_string_literal: true require "spec_helper" describe DockerHostReservationCreator do let(:user) { create(:user) } let(:location) { create(:location) } let(:docker_host) { create(:docker_host, location: location) } let(:reservation_params) do ActionController::Parameters.new( ...
github
Arie/serveme
https://github.com/Arie/serveme
spec/services/download_then_zip_file_creator_spec.rb
Ruby
apache-2.0
97
master
2,766
# typed: false # frozen_string_literal: true require 'spec_helper' describe DownloadThenZipFileCreator do let(:server) { double('Server', zip_file_creator_class: DownloadThenZipFileCreator) } let(:reservation) { double('Reservation', id: 1, server: server, status_update: nil) } before do allow(Zip...
github
Arie/serveme
https://github.com/Arie/serveme
spec/services/log_parser_spec.rb
Ruby
apache-2.0
97
master
7,672
# typed: false # frozen_string_literal: true require 'spec_helper' describe LogParser do let(:fixture_path) { Rails.root.join('spec', 'fixtures', 'logs', 'match.log').to_s } describe '#perform' do context 'with a valid match log' do subject(:matches) { described_class.new(fixture_path).perform } ...
github
Arie/serveme
https://github.com/Arie/serveme
spec/services/discord_reservation_notifier_spec.rb
Ruby
apache-2.0
97
master
5,931
# typed: false # frozen_string_literal: true require "spec_helper" require "webmock/rspec" RSpec.describe DiscordReservationNotifier do let(:user) { create(:user) } let(:server) { create(:server) } let(:reservation) do create(:reservation, user: user, server: server, starts_...
github
Arie/serveme
https://github.com/Arie/serveme
spec/services/log_line_formatter_spec.rb
Ruby
apache-2.0
97
master
4,985
# typed: false # frozen_string_literal: true require "spec_helper" describe LogLineFormatter do describe "#format" do context "with a kill event" do let(:line) do 'L 02/15/2013 - 00:14:52: "Aka Game<4><STEAM_0:0:5253998><Red>" killed "ser mais leve<6><STEAM_0:0:41722710><Blue>" with "scattergun" (...
github
Arie/serveme
https://github.com/Arie/serveme
spec/services/rcon_autocomplete_spec.rb
Ruby
apache-2.0
97
master
4,332
# typed: false # frozen_string_literal: true require 'spec_helper' describe RconAutocomplete do subject { described_class.new(nil) } it 'returns a list of suggestions' do expect(subject.autocomplete('tf_bot').map { |c| c[:command] }).to include( 'tf_bot_add', 'tf_bot_difficulty', 'tf_bot_ki...
github
Arie/serveme
https://github.com/Arie/serveme
spec/services/remote_log_copier_spec.rb
Ruby
apache-2.0
97
master
1,519
# typed: false # frozen_string_literal: true require 'spec_helper' describe RemoteLogCopier do describe '#copy_logs' do it 'extracts log files from the zip to the destination directory' do logs = double server = double(logs: logs) reservation = double(id: 1, zipfile_name: 'foo.zip') des...
github
Arie/serveme
https://github.com/Arie/serveme
spec/services/i_am_feeling_lucky_spec.rb
Ruby
apache-2.0
97
master
3,348
# typed: false # frozen_string_literal: true require 'spec_helper' describe IAmFeelingLucky do let(:user) { create :user } subject { IAmFeelingLucky.new(user) } context 'without a previous reservation' do it 'finds an available server and builds a reservation' do available_server = create :server ...
github
Arie/serveme
https://github.com/Arie/serveme
spec/services/ai_command_handler_spec.rb
Ruby
apache-2.0
97
master
27,490
# typed: false # frozen_string_literal: true require 'spec_helper' require 'set' RSpec.describe AiCommandHandler do let(:user) { build_stubbed :user, uid: '76561197960497430' } let(:server) { build_stubbed(:server) } let(:condenser) { double.as_null_object } let(:reservation) { build_stubbed :reservation, use...
github
Arie/serveme
https://github.com/Arie/serveme
spec/services/stac_discord_notifier_spec.rb
Ruby
apache-2.0
97
master
3,876
# typed: false # frozen_string_literal: true require 'spec_helper' RSpec.describe StacDiscordNotifier do let(:reservation) { build_stubbed(:reservation) } let(:notifier) { described_class.new(reservation) } let(:detections) do { 76561199543859315 => { name: 'АБАРИГЕН', steam_id64: 7656...
github
Arie/serveme
https://github.com/Arie/serveme
spec/services/user_finder_service_spec.rb
Ruby
apache-2.0
97
master
2,746
# typed: false # frozen_string_literal: true require "spec_helper" describe UserFinderService do let!(:user) { create(:user, uid: "76561197960287930", nickname: "TestPlayer") } describe "#find" do context "with user ID" do it "finds user by ID with # prefix" do finder = UserFinderService.new("#...
github
Arie/serveme
https://github.com/Arie/serveme
spec/services/cloud_provider_spec.rb
Ruby
apache-2.0
97
master
4,207
# typed: false require "spec_helper" RSpec.describe CloudProvider do describe ".for" do it "returns a Hetzner provider for 'hetzner'" do expect(described_class.for("hetzner")).to be_a(CloudProvider::Hetzner) end it "returns a Vultr provider for 'vultr'" do expect(described_class.for("vultr"...
github
Arie/serveme
https://github.com/Arie/serveme
spec/services/proxy_detection_discord_notifier_spec.rb
Ruby
apache-2.0
97
master
3,108
# typed: false # frozen_string_literal: true require "spec_helper" RSpec.describe ProxyDetectionDiscordNotifier do let(:notifier) { described_class.new } let(:player_data) do { "76561198012345678" => { name: "ProxyPlayer", ips: { "1.2.3.4" => { fraud_score: 90, isp: "ShadyVPN"...
github
Arie/serveme
https://github.com/Arie/serveme
spec/services/command_validator_spec.rb
Ruby
apache-2.0
97
master
2,063
# typed: false require 'spec_helper' describe CommandValidator do describe '.validate' do context 'with single commands' do it 'returns true for a likely valid command (changelevel)' do expect(described_class.validate('changelevel cp_process')).to be true end it 'returns true for a li...
github
Arie/serveme
https://github.com/Arie/serveme
spec/services/local_zip_file_creator_spec.rb
Ruby
apache-2.0
97
master
758
# typed: false # frozen_string_literal: true require 'spec_helper' describe LocalZipFileCreator do let(:zipper_class) { LocalZipFileCreator } let(:reservation) { double(server: server, status_update: nil) } let(:server) { double(zip_file_creator_class: zipper_class) } describe '#zip' do it 'it ...
github
Arie/serveme
https://github.com/Arie/serveme
spec/services/user_search_service_spec.rb
Ruby
apache-2.0
97
master
3,939
# typed: false # frozen_string_literal: true require "spec_helper" RSpec.describe UserSearchService do let!(:user) { create(:user, uid: "76561197960287930", nickname: "TestPlayer") } describe "#search" do context "with blank input" do it "returns empty array" do service = described_class.new(""...
github
Arie/serveme
https://github.com/Arie/serveme
spec/services/stac_log_processor_spec.rb
Ruby
apache-2.0
97
master
16,569
# typed: false # frozen_string_literal: true require 'spec_helper' describe StacLogProcessor do let(:reservation) { build_stubbed(:reservation) } let(:processor) { described_class.new(reservation) } let(:stac_log_content) { File.read(Rails.root.join('spec', 'fixtures', 'files', 'stac_log.log')) } describe '#...
github
Arie/serveme
https://github.com/Arie/serveme
spec/services/rcon_status_parser_spec.rb
Ruby
apache-2.0
97
master
6,831
# typed: false # frozen_string_literal: true require 'spec_helper' describe RconStatusParser do let(:rcon_status_output) do 'hostname: BlackOut Gaming #5 (Jakov) version : 2406664/24 2406664 secure udp/ip : 109.70.149.21:27055 (public ip: 109.70.149.21) steamid : [A:1:251166723:4677] (90092080360620035) accou...
github
Arie/serveme
https://github.com/Arie/serveme
spec/services/mcp/protocol_handler_spec.rb
Ruby
apache-2.0
97
master
2,940
# typed: false # frozen_string_literal: true require "spec_helper" RSpec.describe Mcp::ProtocolHandler do let(:admin_user) { create(:user, :admin) } let(:handler) { described_class.new(admin_user) } describe "#handle" do context "with tools/list request" do let(:request) do { jsonrp...
github
Arie/serveme
https://github.com/Arie/serveme
spec/services/mcp/tool_registry_spec.rb
Ruby
apache-2.0
97
master
2,045
# typed: false # frozen_string_literal: true require "spec_helper" RSpec.describe Mcp::ToolRegistry do describe ".tools" do it "returns an array of tool classes" do expect(described_class.tools).to be_an(Array) expect(described_class.tools).to all(be < Mcp::Tools::BaseTool) end end describe...
github
Arie/serveme
https://github.com/Arie/serveme
spec/services/mcp/audit_logger_spec.rb
Ruby
apache-2.0
97
master
2,013
# typed: false # frozen_string_literal: true require "spec_helper" RSpec.describe Mcp::AuditLogger do let(:user) { create(:user, :admin) } describe ".log_tool_call" do it "logs tool call to Rails logger with MCP Audit prefix" do allow(Rails.logger).to receive(:info) described_class.log_tool_call...
github
Arie/serveme
https://github.com/Arie/serveme
spec/services/mcp/tools/create_cloud_snapshot_tool_spec.rb
Ruby
apache-2.0
97
master
1,636
# typed: false # frozen_string_literal: true require "spec_helper" RSpec.describe Mcp::Tools::CreateCloudSnapshotTool do describe "class methods" do it "has the correct tool name" do expect(described_class.tool_name).to eq("create_cloud_snapshot") end it "has a description" do expect(descri...
github
Arie/serveme
https://github.com/Arie/serveme
spec/services/mcp/tools/search_alts_tool_spec.rb
Ruby
apache-2.0
97
master
6,739
# typed: false # frozen_string_literal: true require "spec_helper" RSpec.describe Mcp::Tools::SearchAltsTool do describe "class methods" do it "has the correct tool name" do expect(described_class.tool_name).to eq("search_alts") end it "has a description" do expect(described_class.descripti...
github
Arie/serveme
https://github.com/Arie/serveme
spec/services/mcp/tools/base_tool_spec.rb
Ruby
apache-2.0
97
master
4,267
# typed: false # frozen_string_literal: true require "spec_helper" # Test tool classes defined outside of RSpec blocks to satisfy Sorbet/BlockMethodDefinition module Mcp module Tools class TestAdminTool < BaseTool def self.tool_name = "admin_tool" def self.description = "Admin only tool" def s...
github
Arie/serveme
https://github.com/Arie/serveme
spec/services/mcp/tools/end_reservation_tool_spec.rb
Ruby
apache-2.0
97
master
4,662
# typed: false # frozen_string_literal: true require "spec_helper" RSpec.describe Mcp::Tools::EndReservationTool do describe "class methods" do it "has the correct tool name" do expect(described_class.tool_name).to eq("end_reservation") end it "has a description" do expect(described_class.d...
github
Arie/serveme
https://github.com/Arie/serveme
spec/services/mcp/tools/update_whitelist_tool_spec.rb
Ruby
apache-2.0
97
master
3,372
# typed: false # frozen_string_literal: true require "spec_helper" RSpec.describe Mcp::Tools::UpdateWhitelistTool do describe "class methods" do it "has the correct tool name" do expect(described_class.tool_name).to eq("update_whitelist") end it "has a description" do expect(described_class...
github
Arie/serveme
https://github.com/Arie/serveme
spec/services/mcp/tools/list_server_configs_tool_spec.rb
Ruby
apache-2.0
97
master
3,913
# typed: false # frozen_string_literal: true require "spec_helper" RSpec.describe Mcp::Tools::ListServerConfigsTool do describe "class methods" do it "has the correct tool name" do expect(described_class.tool_name).to eq("list_server_configs") end it "has a description" do expect(described_...
github
Arie/serveme
https://github.com/Arie/serveme
spec/services/mcp/tools/get_public_servers_tool_spec.rb
Ruby
apache-2.0
97
master
3,320
# typed: false # frozen_string_literal: true require "spec_helper" RSpec.describe Mcp::Tools::GetPublicServersTool do describe "class methods" do it "has the correct tool name" do expect(described_class.tool_name).to eq("get_public_servers") end it "has a description" do expect(described_cl...
github
Arie/serveme
https://github.com/Arie/serveme
spec/services/mcp/tools/get_discord_link_tool_spec.rb
Ruby
apache-2.0
97
master
2,774
# typed: false # frozen_string_literal: true require "spec_helper" RSpec.describe Mcp::Tools::GetDiscordLinkTool do describe "class methods" do it "has the correct tool name" do expect(described_class.tool_name).to eq("get_discord_link") end it "has a description" do expect(described_class....
github
Arie/serveme
https://github.com/Arie/serveme
spec/services/mcp/tools/create_server_config_tool_spec.rb
Ruby
apache-2.0
97
master
2,664
# typed: false # frozen_string_literal: true require "spec_helper" RSpec.describe Mcp::Tools::CreateServerConfigTool do describe "class methods" do it "has the correct tool name" do expect(described_class.tool_name).to eq("create_server_config") end it "has a description" do expect(describe...
github
Arie/serveme
https://github.com/Arie/serveme
spec/services/mcp/tools/create_whitelist_tool_spec.rb
Ruby
apache-2.0
97
master
2,706
# typed: false # frozen_string_literal: true require "spec_helper" RSpec.describe Mcp::Tools::CreateWhitelistTool do describe "class methods" do it "has the correct tool name" do expect(described_class.tool_name).to eq("create_whitelist") end it "has a description" do expect(described_class...
github
Arie/serveme
https://github.com/Arie/serveme
spec/services/mcp/tools/build_cloud_image_tool_spec.rb
Ruby
apache-2.0
97
master
1,421
# typed: false # frozen_string_literal: true require "spec_helper" RSpec.describe Mcp::Tools::BuildCloudImageTool do describe "class methods" do it "has the correct tool name" do expect(described_class.tool_name).to eq("build_cloud_image") end it "has a description" do expect(described_clas...
github
Arie/serveme
https://github.com/Arie/serveme
spec/services/mcp/tools/search_co_players_tool_spec.rb
Ruby
apache-2.0
97
master
8,175
# typed: false # frozen_string_literal: true require "spec_helper" RSpec.describe Mcp::Tools::SearchCoPlayersTool do describe "class methods" do it "has the correct tool name" do expect(described_class.tool_name).to eq("search_co_players") end it "has a description" do expect(described_clas...
github
Arie/serveme
https://github.com/Arie/serveme
spec/services/mcp/tools/list_servers_tool_spec.rb
Ruby
apache-2.0
97
master
2,627
# typed: false # frozen_string_literal: true require "spec_helper" RSpec.describe Mcp::Tools::ListServersTool do describe "class methods" do it "has the correct tool name" do expect(described_class.tool_name).to eq("list_servers") end it "has a description" do expect(described_class.descrip...
github
Arie/serveme
https://github.com/Arie/serveme
spec/services/mcp/tools/get_user_tool_spec.rb
Ruby
apache-2.0
97
master
3,287
# typed: false # frozen_string_literal: true require "spec_helper" RSpec.describe Mcp::Tools::GetUserTool do describe "class methods" do it "has the correct tool name" do expect(described_class.tool_name).to eq("get_user") end it "has a description" do expect(described_class.description).to...
github
Arie/serveme
https://github.com/Arie/serveme
spec/services/mcp/tools/upload_files_to_servers_tool_spec.rb
Ruby
apache-2.0
97
master
2,214
# typed: false # frozen_string_literal: true require "spec_helper" RSpec.describe Mcp::Tools::UploadFilesToServersTool do describe "class methods" do it "has the correct tool name" do expect(described_class.tool_name).to eq("upload_files_to_servers") end it "has a description" do expect(des...
github
Arie/serveme
https://github.com/Arie/serveme
spec/services/mcp/tools/get_player_reservations_tool_spec.rb
Ruby
apache-2.0
97
master
5,032
# typed: false # frozen_string_literal: true require "spec_helper" RSpec.describe Mcp::Tools::GetPlayerReservationsTool do describe "class methods" do it "has the correct tool name" do expect(described_class.tool_name).to eq("get_player_reservations") end it "has a description" do expect(de...
github
Arie/serveme
https://github.com/Arie/serveme
spec/services/mcp/tools/list_reservations_tool_spec.rb
Ruby
apache-2.0
97
master
12,049
# typed: false # frozen_string_literal: true require "spec_helper" RSpec.describe Mcp::Tools::ListReservationsTool do describe "class methods" do it "has the correct tool name" do expect(described_class.tool_name).to eq("list_reservations") end it "has a description" do expect(described_cla...
github
Arie/serveme
https://github.com/Arie/serveme
spec/services/mcp/tools/link_discord_tool_spec.rb
Ruby
apache-2.0
97
master
5,763
# typed: false # frozen_string_literal: true require "spec_helper" RSpec.describe Mcp::Tools::LinkDiscordTool do describe "class methods" do it "has the correct tool name" do expect(described_class.tool_name).to eq("link_discord") end it "has a description" do expect(described_class.descrip...
github
Arie/serveme
https://github.com/Arie/serveme
spec/services/mcp/tools/get_stac_logs_tool_spec.rb
Ruby
apache-2.0
97
master
4,836
# typed: false # frozen_string_literal: true require "spec_helper" RSpec.describe Mcp::Tools::GetStacLogsTool do it "exposes correct tool metadata" do expect(described_class.tool_name).to eq("get_stac_logs") expect(described_class.description).to be_a(String).and(be_present) expect(described_class.requi...
github
Arie/serveme
https://github.com/Arie/serveme
spec/services/mcp/tools/update_server_config_tool_spec.rb
Ruby
apache-2.0
97
master
3,305
# typed: false # frozen_string_literal: true require "spec_helper" RSpec.describe Mcp::Tools::UpdateServerConfigTool do describe "class methods" do it "has the correct tool name" do expect(described_class.tool_name).to eq("update_server_config") end it "has a description" do expect(describe...
github
Arie/serveme
https://github.com/Arie/serveme
spec/services/mcp/tools/search_by_asn_tool_spec.rb
Ruby
apache-2.0
97
master
4,068
# typed: false # frozen_string_literal: true require "spec_helper" RSpec.describe Mcp::Tools::SearchByAsnTool do describe "class methods" do it "has the correct tool name" do expect(described_class.tool_name).to eq("search_by_asn") end it "has a description" do expect(described_class.descri...
github
Arie/serveme
https://github.com/Arie/serveme
spec/services/mcp/tools/list_whitelists_tool_spec.rb
Ruby
apache-2.0
97
master
4,106
# typed: false # frozen_string_literal: true require "spec_helper" RSpec.describe Mcp::Tools::ListWhitelistsTool do describe "class methods" do it "has the correct tool name" do expect(described_class.tool_name).to eq("list_whitelists") end it "has a description" do expect(described_class.d...
github
Arie/serveme
https://github.com/Arie/serveme
spec/services/mcp/tools/search_reservation_logs_tool_spec.rb
Ruby
apache-2.0
97
master
12,438
# typed: false # frozen_string_literal: true require "spec_helper" RSpec.describe Mcp::Tools::SearchReservationLogsTool do describe "class methods" do it "has the correct tool name" do expect(described_class.tool_name).to eq("search_reservation_logs") end it "has a description" do expect(de...
github
Arie/serveme
https://github.com/Arie/serveme
spec/services/cloud_provider/base_spec.rb
Ruby
apache-2.0
97
master
887
# typed: false require "spec_helper" RSpec.describe CloudProvider::Base do subject(:provider) { described_class.new } describe "#cloud_init_script (private)" do let(:cloud_server) { create(:cloud_server, rcon: rcon_password) } before do allow(Rails.application.credentials).to receive(:dig).and_cal...
github
Arie/serveme
https://github.com/Arie/serveme
spec/services/cloud_provider/hetzner_spec.rb
Ruby
apache-2.0
97
master
6,408
# typed: false require "spec_helper" require "webmock/rspec" RSpec.describe CloudProvider::Hetzner do subject(:provider) { described_class.new } let(:api_token) { "test-hetzner-token" } before do allow(Rails.application.credentials).to receive(:dig).and_call_original allow(Rails.application.credential...
github
Arie/serveme
https://github.com/Arie/serveme
spec/services/cloud_provider/docker_spec.rb
Ruby
apache-2.0
97
master
5,390
# typed: false require "spec_helper" RSpec.describe CloudProvider::Docker do subject(:provider) { described_class.new } describe "#create_server" do let(:cloud_server) { create(:cloud_server, cloud_provider: "docker", cloud_callback_token: "test-token", port: "27015") } before do allow(cloud_serve...
github
Arie/serveme
https://github.com/Arie/serveme
spec/services/cloud_provider/kamatera_spec.rb
Ruby
apache-2.0
97
master
4,699
# typed: false require "spec_helper" require "webmock/rspec" RSpec.describe CloudProvider::Kamatera do subject(:provider) { described_class.new } let(:client_id) { "test-kamatera-client-id" } let(:client_secret) { "test-kamatera-secret" } let(:auth_headers) { { "AuthClientId" => client_id, "AuthSecret" => cl...
github
Arie/serveme
https://github.com/Arie/serveme
spec/services/cloud_provider/vultr_spec.rb
Ruby
apache-2.0
97
master
7,576
# typed: false require "spec_helper" require "webmock/rspec" RSpec.describe CloudProvider::Vultr do subject(:provider) { described_class.new } let(:api_token) { "test-vultr-token" } before do allow(Rails.application.credentials).to receive(:dig).and_call_original allow(Rails.application.credentials).t...
github
Arie/serveme
https://github.com/Arie/serveme
spec/services/cloud_provider/remote_docker_spec.rb
Ruby
apache-2.0
97
master
8,131
# typed: false require "spec_helper" RSpec.describe CloudProvider::RemoteDocker do subject(:provider) { described_class.new } let(:docker_host) { create(:docker_host, ip: '10.0.0.1', start_port: 27015) } describe ".locations" do it "returns active docker hosts" do active_host = create(:docker_host, ...
github
Arie/serveme
https://github.com/Arie/serveme
spec/middleware/utf8_sanitizer_spec.rb
Ruby
apache-2.0
97
master
979
# typed: false # frozen_string_literal: true require 'spec_helper' describe 'UTF8Sanitizer middleware' do describe 'parameter sanitization' do it 'sanitizes invalid UTF-8 byte sequences' do sanitizer = Rack::UTF8Sanitizer.new(proc { |env| [ 200, {}, [ 'OK' ] ] }) env = { 'REQUEST_METHOD' =>...
github
Arie/serveme
https://github.com/Arie/serveme
discord_bot/bot.rb
Ruby
apache-2.0
97
master
24,258
#!/usr/bin/env ruby # typed: false # frozen_string_literal: true # Load Rails environment first (like Sidekiq does) ENV["RAILS_ENV"] ||= ENV.fetch("BOT_ENV", "development") require_relative "../config/environment" # Now load Discord require "discordrb" # Load bot libraries require_relative "lib/config" require_relat...
github
Arie/serveme
https://github.com/Arie/serveme
discord_bot/lib/config.rb
Ruby
apache-2.0
97
master
2,180
# typed: false # frozen_string_literal: true module ServemeBot class Config class << self def load # Rails environment is already loaded, just validate we have what we need unless discord_token && discord_client_id raise "Missing Discord credentials. Set DISCORD_TOKEN and DISCORD_...
github
Arie/serveme
https://github.com/Arie/serveme
discord_bot/lib/helpers/flag_helper.rb
Ruby
apache-2.0
97
master
792
# typed: false # frozen_string_literal: true module ServemeBot module Helpers module FlagHelper # Special mappings for non-standard codes FLAG_MAPPINGS = { "uk" => "gb", "en" => "england", "scotland" => "scotland", "europeanunion" => "eu" }.freeze def self...
github
Arie/serveme
https://github.com/Arie/serveme
discord_bot/lib/helpers/regional_configs.rb
Ruby
apache-2.0
97
master
1,932
# typed: false # frozen_string_literal: true module ServemeBot module Helpers class RegionalConfigs # Regional config presets for quick selection buttons # These are the most commonly used configs per region PRESETS = { "eu" => %w[ etf2l_6v6_5cp etf2l_6v6_koth ...
github
Arie/serveme
https://github.com/Arie/serveme
discord_bot/lib/formatters/reservation_formatter.rb
Ruby
apache-2.0
97
master
3,542
# typed: false # frozen_string_literal: true module ServemeBot module Formatters class ReservationFormatter SERVEME_COLOR = 0x5865F2 # Discord blurple CURRENT_COLOR = 0x57F287 # Green FUTURE_COLOR = 0x5865F2 # Blurple PAST_COLOR = 0x99AAB5 # Gray class << self def format_re...
github
Arie/serveme
https://github.com/Arie/serveme
discord_bot/lib/formatters/server_formatter.rb
Ruby
apache-2.0
97
master
4,987
# typed: false # frozen_string_literal: true module ServemeBot module Formatters class ServerFormatter SERVEME_COLOR = 0x5865F2 # Discord blurple AVAILABLE_COLOR = 0x57F287 # Green BUSY_COLOR = 0xED4245 # Red class << self def format_server_list(servers, title: "Available Servers...
github
Arie/serveme
https://github.com/Arie/serveme
discord_bot/lib/commands/reserve_command.rb
Ruby
apache-2.0
97
master
14,561
# typed: false # frozen_string_literal: true module ServemeBot module Commands class ReserveCommand < BaseCommand DEFAULT_DURATION = 120 # 2 hours DEFAULT_MAP = "cp_badlands" def execute(server_query: nil, map: nil, password: nil, duration: nil, config: nil, whitelist: nil) # Route clo...
github
Arie/serveme
https://github.com/Arie/serveme
discord_bot/lib/commands/reservations_command.rb
Ruby
apache-2.0
97
master
2,976
# typed: false # frozen_string_literal: true module ServemeBot module Commands class ReservationsCommand < BaseCommand def execute(status: nil, limit: 10) log_command("reservations", status: status, limit: limit) return unless require_linked_account! defer_response(ephemeral: true)...
github
Arie/serveme
https://github.com/Arie/serveme
discord_bot/lib/commands/appeal_command.rb
Ruby
apache-2.0
97
master
1,707
# typed: false # frozen_string_literal: true module ServemeBot module Commands class AppealCommand < BaseCommand def execute log_command("appeal") return unless require_serveme_guild! return unless require_linked_account! steam_uid = current_user.uid # Check for o...
github
Arie/serveme
https://github.com/Arie/serveme
discord_bot/lib/commands/servers_command.rb
Ruby
apache-2.0
97
master
2,316
# typed: false # frozen_string_literal: true module ServemeBot module Commands class ServersCommand < BaseCommand def execute log_command("servers") return unless require_linked_account! defer_response(ephemeral: true) servers = fetch_servers result = Formatters::...
github
Arie/serveme
https://github.com/Arie/serveme
discord_bot/lib/commands/base_command.rb
Ruby
apache-2.0
97
master
2,737
# typed: false # frozen_string_literal: true module ServemeBot module Commands class BaseCommand attr_reader :event def initialize(event) @event = event end def discord_uid event.user.id.to_s end def discord_username event.user.username end ...
github
Arie/serveme
https://github.com/Arie/serveme
discord_bot/lib/commands/link_command.rb
Ruby
apache-2.0
97
master
3,125
# typed: false # frozen_string_literal: true module ServemeBot module Commands class LinkCommand < BaseCommand def execute(unlink: false) log_command(unlink ? "unlink" : "link") if unlink unlink_account else link_account end end private ...
github
Arie/serveme
https://github.com/Arie/serveme
discord_bot/spec/spec_helper.rb
Ruby
apache-2.0
97
master
1,049
# typed: false # frozen_string_literal: true # Discord bot specs now require Rails environment since we use Rails directly ENV["RAILS_ENV"] = "test" # Load Rails environment require_relative "../../config/environment" # Load rspec-rails and FactoryBot require "rspec/rails" require "factory_bot_rails" # Load bot lib...
github
Arie/serveme
https://github.com/Arie/serveme
discord_bot/spec/lib/bot_autocomplete_handlers_spec.rb
Ruby
apache-2.0
97
master
11,162
# typed: false # frozen_string_literal: true require_relative "../spec_helper" # Test the autocomplete handler logic without running the full bot RSpec.describe "Bot autocomplete handlers" do describe "server autocomplete" do let!(:location) { create(:location, name: "Netherlands") } let!(:server1) { create...