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 |
|---|---|---|---|---|---|---|---|---|
openjournals/theoj | https://github.com/openjournals/theoj/blob/73c6acccc0aefe64b0030c818f405b25b7e7b589/spec/models/provider/test_provider_spec.rb | spec/models/provider/test_provider_spec.rb | require_relative 'shared_provider_specs'
require "rails_helper"
describe Provider::TestProvider do
def stub_document; end
def stub_document_without_version; end
def stub_document_not_found
allow(described_class).to receive(:get_attributes).and_raise(Provider::Error::DocumentNotFound)
end
def document... | ruby | MIT | 73c6acccc0aefe64b0030c818f405b25b7e7b589 | 2026-01-04T17:49:58.613320Z | false |
openjournals/theoj | https://github.com/openjournals/theoj/blob/73c6acccc0aefe64b0030c818f405b25b7e7b589/spec/lib/extensions/string_spec.rb | spec/lib/extensions/string_spec.rb | require "rails_helper"
describe String do
describe "#a_or_an" do
it "should return a result" do
expect( 'elephant'.a_or_an ).to eq('an')
expect( 'cat'.a_or_an ).to eq('a')
end
it "should be case insensitive" do
expect( 'Elephant'.a_or_an ).to eq('an')
expect( 'Cat'.a_or_an ).to... | ruby | MIT | 73c6acccc0aefe64b0030c818f405b25b7e7b589 | 2026-01-04T17:49:58.613320Z | false |
openjournals/theoj | https://github.com/openjournals/theoj/blob/73c6acccc0aefe64b0030c818f405b25b7e7b589/spec/mailers/application_mailer_spec.rb | spec/mailers/application_mailer_spec.rb | require "rails_helper"
RSpec.describe ApplicationMailer, type: :mailer do
class TestMailer < ApplicationMailer
def test(user)
mail to:user, subject:'A Subject' do |format|
format.text { render plain: "[Inserted Text]", layout:'mailer' }
format.html { render html: "[Inserted HTML]" , layout... | ruby | MIT | 73c6acccc0aefe64b0030c818f405b25b7e7b589 | 2026-01-04T17:49:58.613320Z | false |
openjournals/theoj | https://github.com/openjournals/theoj/blob/73c6acccc0aefe64b0030c818f405b25b7e7b589/spec/mailers/notification_mailer_spec.rb | spec/mailers/notification_mailer_spec.rb | require "rails_helper"
RSpec.describe NotificationMailer, type: :mailer do
describe "notification" do
let(:user) { create(:user, name:'Joe Smith', email:'jsmith@example.com') }
let(:paper) { create(:paper, title:'A Paper Title', arxiv_id:'1234.5678v9') }
let(:mail) { NotificationMailer.notification(... | ruby | MIT | 73c6acccc0aefe64b0030c818f405b25b7e7b589 | 2026-01-04T17:49:58.613320Z | false |
openjournals/theoj | https://github.com/openjournals/theoj/blob/73c6acccc0aefe64b0030c818f405b25b7e7b589/spec/mailers/previews/notification_mailer_preview.rb | spec/mailers/previews/notification_mailer_preview.rb | # Preview all emails at http://localhost:3000/rails/mailers/notification_mailer
class NotificationMailerPreview < ActionMailer::Preview
# Preview this email at http://localhost:3000/rails/mailers/notification_mailer/test
def notification
NotificationMailer.notification(User.first, Paper.first, 'This is a test ... | ruby | MIT | 73c6acccc0aefe64b0030c818f405b25b7e7b589 | 2026-01-04T17:49:58.613320Z | false |
openjournals/theoj | https://github.com/openjournals/theoj/blob/73c6acccc0aefe64b0030c818f405b25b7e7b589/lib/settings.rb | lib/settings.rb |
Settings = ActiveSupport::OrderedOptions.new
begin
yaml = File.join(ENV['HOME'], '.rails.settings.yml')
if File.exist?(yaml)
require "erb"
all_settings = YAML.load(ERB.new(IO.read(yaml)).result) || {}
env_settings = all_settings[Rails.env]
Settings.deep_merge!(env_settings.deep_symbolize_keys) if ... | ruby | MIT | 73c6acccc0aefe64b0030c818f405b25b7e7b589 | 2026-01-04T17:49:58.613320Z | false |
openjournals/theoj | https://github.com/openjournals/theoj/blob/73c6acccc0aefe64b0030c818f405b25b7e7b589/lib/extensions/string.rb | lib/extensions/string.rb |
class String
def a_or_an
self.length==0 ? '' : self[0].downcase.in?(%w{a e i o u }) ? 'an' : 'a'
end
end
| ruby | MIT | 73c6acccc0aefe64b0030c818f405b25b7e7b589 | 2026-01-04T17:49:58.613320Z | false |
openjournals/theoj | https://github.com/openjournals/theoj/blob/73c6acccc0aefe64b0030c818f405b25b7e7b589/lib/extensions/firebase.rb | lib/extensions/firebase.rb | require 'firebase'
module Firebase
# This needs to be synchronized with the polymer code for Oj.utils.clean_firebase_key
# Added ~ since we use it as an escape, Also '/' but we don't worry about that
INVALID_CHARS = '~.$#[]'
INVALID_CHARS_REGEX = /[#{Regexp.escape(INVALID_CHARS)}]/
def self.clean_ke... | ruby | MIT | 73c6acccc0aefe64b0030c818f405b25b7e7b589 | 2026-01-04T17:49:58.613320Z | false |
openjournals/theoj | https://github.com/openjournals/theoj/blob/73c6acccc0aefe64b0030c818f405b25b7e7b589/config/application.rb | config/application.rb | require File.expand_path('../boot', __FILE__)
require 'rails/all'
require 'securerandom'
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(:default, Rails.env)
module Theoj
class Application < Rails::Application
# Load everything ... | ruby | MIT | 73c6acccc0aefe64b0030c818f405b25b7e7b589 | 2026-01-04T17:49:58.613320Z | false |
openjournals/theoj | https://github.com/openjournals/theoj/blob/73c6acccc0aefe64b0030c818f405b25b7e7b589/config/environment.rb | config/environment.rb | # Load the Rails application.
require File.expand_path('../application', __FILE__)
# Initialize the Rails application.
Theoj::Application.initialize!
| ruby | MIT | 73c6acccc0aefe64b0030c818f405b25b7e7b589 | 2026-01-04T17:49:58.613320Z | false |
openjournals/theoj | https://github.com/openjournals/theoj/blob/73c6acccc0aefe64b0030c818f405b25b7e7b589/config/routes.rb | config/routes.rb | Theoj::Application.routes.draw do
namespace :api, format: 'json' do
namespace :v1 do
resources :papers, only:[:index, :show, :create, :destroy], param: :identifier, identifier: /[^\/]+/ do
collection do
get :recent
get :as_author
get :as_collaborator
get :... | ruby | MIT | 73c6acccc0aefe64b0030c818f405b25b7e7b589 | 2026-01-04T17:49:58.613320Z | false |
openjournals/theoj | https://github.com/openjournals/theoj/blob/73c6acccc0aefe64b0030c818f405b25b7e7b589/config/unicorn.rb | config/unicorn.rb | worker_processes 3
timeout 30
preload_app true
before_fork do |server, worker|
Signal.trap 'TERM' do
puts 'Unicorn master intercepting TERM and sending myself QUIT instead'
Process.kill 'QUIT', Process.pid
end
defined?(ActiveRecord::Base) and
ActiveRecord::Base.connection.disconnect!
end
after_for... | ruby | MIT | 73c6acccc0aefe64b0030c818f405b25b7e7b589 | 2026-01-04T17:49:58.613320Z | false |
openjournals/theoj | https://github.com/openjournals/theoj/blob/73c6acccc0aefe64b0030c818f405b25b7e7b589/config/boot.rb | config/boot.rb | # Set up gems listed in the Gemfile.
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
| ruby | MIT | 73c6acccc0aefe64b0030c818f405b25b7e7b589 | 2026-01-04T17:49:58.613320Z | false |
openjournals/theoj | https://github.com/openjournals/theoj/blob/73c6acccc0aefe64b0030c818f405b25b7e7b589/config/initializers/filter_parameter_logging.rb | config/initializers/filter_parameter_logging.rb | # Be sure to restart your server when you modify this file.
# Configure sensitive parameters which will be filtered from the log file.
Rails.application.config.filter_parameters += [:password]
| ruby | MIT | 73c6acccc0aefe64b0030c818f405b25b7e7b589 | 2026-01-04T17:49:58.613320Z | false |
openjournals/theoj | https://github.com/openjournals/theoj/blob/73c6acccc0aefe64b0030c818f405b25b7e7b589/config/initializers/bower_rails.rb | config/initializers/bower_rails.rb | BowerRails.configure do |bower_rails|
# Tell bower-rails what path should be considered as root. Defaults to Dir.pwd
# bower_rails.root_path = Dir.pwd
# Invokes rake bower:install before precompilation. Defaults to false
# bower_rails.install_before_precompile = true
# Invokes rake bower:resolve before prec... | ruby | MIT | 73c6acccc0aefe64b0030c818f405b25b7e7b589 | 2026-01-04T17:49:58.613320Z | false |
openjournals/theoj | https://github.com/openjournals/theoj/blob/73c6acccc0aefe64b0030c818f405b25b7e7b589/config/initializers/version.rb | config/initializers/version.rb | TheOJVersion = "0.1" | ruby | MIT | 73c6acccc0aefe64b0030c818f405b25b7e7b589 | 2026-01-04T17:49:58.613320Z | false |
openjournals/theoj | https://github.com/openjournals/theoj/blob/73c6acccc0aefe64b0030c818f405b25b7e7b589/config/initializers/emcee.rb | config/initializers/emcee.rb | # Remove Emcee compressor because it doesn't always work
# For example `var regex= /\/*abc;` is compressed with unintended consequences
Theoj::Application.assets.unregister_bundle_processor "text/html", :html_compressor
| ruby | MIT | 73c6acccc0aefe64b0030c818f405b25b7e7b589 | 2026-01-04T17:49:58.613320Z | false |
openjournals/theoj | https://github.com/openjournals/theoj/blob/73c6acccc0aefe64b0030c818f405b25b7e7b589/config/initializers/session_store.rb | config/initializers/session_store.rb | # Be sure to restart your server when you modify this file.
Theoj::Application.config.session_store :cookie_store,
key: '_theoj_session',
expire_after: 2.weeks,
http_only: true
| ruby | MIT | 73c6acccc0aefe64b0030c818f405b25b7e7b589 | 2026-01-04T17:49:58.613320Z | false |
openjournals/theoj | https://github.com/openjournals/theoj/blob/73c6acccc0aefe64b0030c818f405b25b7e7b589/config/initializers/wrap_parameters.rb | config/initializers/wrap_parameters.rb | # Be sure to restart your server when you modify this file.
# This file contains settings for ActionController::ParamsWrapper which
# is enabled by default.
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
ActiveSupport.on_load(:action_controller) do
wrap_parameters f... | ruby | MIT | 73c6acccc0aefe64b0030c818f405b25b7e7b589 | 2026-01-04T17:49:58.613320Z | false |
openjournals/theoj | https://github.com/openjournals/theoj/blob/73c6acccc0aefe64b0030c818f405b25b7e7b589/config/initializers/serializer.rb | config/initializers/serializer.rb | # Disable for all serializers (except ArraySerializer)
ActiveModel::Serializer.root = false
# Disable for ArraySerializer
ActiveModel::ArraySerializer.root = false
| ruby | MIT | 73c6acccc0aefe64b0030c818f405b25b7e7b589 | 2026-01-04T17:49:58.613320Z | false |
openjournals/theoj | https://github.com/openjournals/theoj/blob/73c6acccc0aefe64b0030c818f405b25b7e7b589/config/initializers/omniauth.rb | config/initializers/omniauth.rb | require 'omniauth-orcid'
Rails.application.config.middleware.use OmniAuth::Builder do
environment = defined?(Rails) ? Rails.env : ENV["RACK_ENV"]
path = File.join(Rails.root, "config", "orcid.yml")
settings = YAML.load(ERB.new(File.new(path).read).result)[environment]
# Make parameters available elsewhere in ... | ruby | MIT | 73c6acccc0aefe64b0030c818f405b25b7e7b589 | 2026-01-04T17:49:58.613320Z | false |
openjournals/theoj | https://github.com/openjournals/theoj/blob/73c6acccc0aefe64b0030c818f405b25b7e7b589/config/initializers/inflections.rb | config/initializers/inflections.rb | # Be sure to restart your server when you modify this file.
# Add new inflection rules using the following format. Inflections
# are locale specific, and you may define rules for as many different
# locales as you wish. All of these examples are active by default:
# ActiveSupport::Inflector.inflections(:en) do |inflec... | ruby | MIT | 73c6acccc0aefe64b0030c818f405b25b7e7b589 | 2026-01-04T17:49:58.613320Z | false |
openjournals/theoj | https://github.com/openjournals/theoj/blob/73c6acccc0aefe64b0030c818f405b25b7e7b589/config/initializers/firebase.rb | config/initializers/firebase.rb | firebase_prefix = ENV['FIREBASE_PREFIX'] || Rails.env
firebase_prefix += '/' unless firebase_prefix.ends_with?('/')
Rails.configuration.firebase_uri_prefix = "https://theoj.firebaseio.com/#{firebase_prefix}"
FirebaseClient = Firebase::Client.new( Rails.configuration.firebase_uri_prefix )
| ruby | MIT | 73c6acccc0aefe64b0030c818f405b25b7e7b589 | 2026-01-04T17:49:58.613320Z | false |
openjournals/theoj | https://github.com/openjournals/theoj/blob/73c6acccc0aefe64b0030c818f405b25b7e7b589/config/initializers/backtrace_silencers.rb | config/initializers/backtrace_silencers.rb | # Be sure to restart your server when you modify this file.
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
# You can also remove all the silencers if you're trying to debug a probl... | ruby | MIT | 73c6acccc0aefe64b0030c818f405b25b7e7b589 | 2026-01-04T17:49:58.613320Z | false |
openjournals/theoj | https://github.com/openjournals/theoj/blob/73c6acccc0aefe64b0030c818f405b25b7e7b589/config/initializers/mime_types.rb | config/initializers/mime_types.rb | # Be sure to restart your server when you modify this file.
# Add new mime types for use in respond_to blocks:
# Mime::Type.register "text/richtext", :rtf
# Mime::Type.register_alias "text/html", :iphone
| ruby | MIT | 73c6acccc0aefe64b0030c818f405b25b7e7b589 | 2026-01-04T17:49:58.613320Z | false |
openjournals/theoj | https://github.com/openjournals/theoj/blob/73c6acccc0aefe64b0030c818f405b25b7e7b589/config/initializers/streaming_proxy.rb | config/initializers/streaming_proxy.rb | require 'rack/streaming_proxy'
Theoj::Application.configure do
# Will be inserted at the end of the middleware stack by default.
config.middleware.use Rack::StreamingProxy::Proxy do |request|
# Inside the request block, return the full URI to redirect the request to,
# or nil/false if the request should c... | ruby | MIT | 73c6acccc0aefe64b0030c818f405b25b7e7b589 | 2026-01-04T17:49:58.613320Z | false |
openjournals/theoj | https://github.com/openjournals/theoj/blob/73c6acccc0aefe64b0030c818f405b25b7e7b589/config/environments/test.rb | config/environments/test.rb | Theoj::Application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that
# your test database is "scratch space" for the test sui... | ruby | MIT | 73c6acccc0aefe64b0030c818f405b25b7e7b589 | 2026-01-04T17:49:58.613320Z | false |
openjournals/theoj | https://github.com/openjournals/theoj/blob/73c6acccc0aefe64b0030c818f405b25b7e7b589/config/environments/development.rb | config/environments/development.rb | Theoj::Application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don't have to restart the web ser... | ruby | MIT | 73c6acccc0aefe64b0030c818f405b25b7e7b589 | 2026-01-04T17:49:58.613320Z | false |
openjournals/theoj | https://github.com/openjournals/theoj/blob/73c6acccc0aefe64b0030c818f405b25b7e7b589/config/environments/production.rb | config/environments/production.rb | Theoj::Application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# Code is not reloaded between requests.
config.cache_classes = true
# Eager load code on boot. This eager loads most of Rails and
# your application in memory, allowing both thread web server... | ruby | MIT | 73c6acccc0aefe64b0030c818f405b25b7e7b589 | 2026-01-04T17:49:58.613320Z | false |
mattvperry/mumble-ruby | https://github.com/mattvperry/mumble-ruby/blob/b323822cb238579e393b5135d52d0eb61d25bf02/lib/mumble-ruby.rb | lib/mumble-ruby.rb | require 'opus-ruby'
require 'active_support/inflector'
require 'mumble-ruby/version'
require 'mumble-ruby/thread_tools'
require 'mumble-ruby/messages'
require 'mumble-ruby/connection'
require 'mumble-ruby/model'
require 'mumble-ruby/user'
require 'mumble-ruby/channel'
require 'mumble-ruby/client'
require 'mumble-ruby/a... | ruby | MIT | b323822cb238579e393b5135d52d0eb61d25bf02 | 2026-01-04T17:50:56.417802Z | false |
mattvperry/mumble-ruby | https://github.com/mattvperry/mumble-ruby/blob/b323822cb238579e393b5135d52d0eb61d25bf02/lib/mumble-ruby/version.rb | lib/mumble-ruby/version.rb | module Mumble
VERSION = "1.1.3"
end
| ruby | MIT | b323822cb238579e393b5135d52d0eb61d25bf02 | 2026-01-04T17:50:56.417802Z | false |
mattvperry/mumble-ruby | https://github.com/mattvperry/mumble-ruby/blob/b323822cb238579e393b5135d52d0eb61d25bf02/lib/mumble-ruby/channel.rb | lib/mumble-ruby/channel.rb | module Mumble
class Channel < Model
attribute :channel_id do
self.data.fetch('channel_id', 0)
end
attribute :name
attribute :parent_id do
self.data['parent']
end
attribute :links do
self.data.fetch('links', [])
end
def parent
client.channels[parent_id]
end
... | ruby | MIT | b323822cb238579e393b5135d52d0eb61d25bf02 | 2026-01-04T17:50:56.417802Z | false |
mattvperry/mumble-ruby | https://github.com/mattvperry/mumble-ruby/blob/b323822cb238579e393b5135d52d0eb61d25bf02/lib/mumble-ruby/packet_data_stream.rb | lib/mumble-ruby/packet_data_stream.rb | module Mumble
class PacketDataStream
def initialize(data=nil)
@data = data || 0.chr * 1024
@data = @data.split ''
@pos = 0
@ok = true
@capacity = @data.size
end
def valid
@ok
end
def size
@pos
end
def left
@capacity - @pos
end
def... | ruby | MIT | b323822cb238579e393b5135d52d0eb61d25bf02 | 2026-01-04T17:50:56.417802Z | false |
mattvperry/mumble-ruby | https://github.com/mattvperry/mumble-ruby/blob/b323822cb238579e393b5135d52d0eb61d25bf02/lib/mumble-ruby/img_reader.rb | lib/mumble-ruby/img_reader.rb | require 'base64'
module Mumble
class UnsupportedImgFormat < StandardError
def initialize
super "Image format must be one of the following: #{ImgReader::FORMATS}"
end
end
class ImgTooLarge < StandardError
def initialize
super "Image must be smaller than 128 kB"
end
end
class ImgR... | ruby | MIT | b323822cb238579e393b5135d52d0eb61d25bf02 | 2026-01-04T17:50:56.417802Z | false |
mattvperry/mumble-ruby | https://github.com/mattvperry/mumble-ruby/blob/b323822cb238579e393b5135d52d0eb61d25bf02/lib/mumble-ruby/audio_recorder.rb | lib/mumble-ruby/audio_recorder.rb | require 'wavefile'
require 'thread'
module Mumble
class AudioRecorder
include ThreadTools
def initialize(client, sample_rate)
@client = client
@wav_format = WaveFile::Format.new(:mono, :pcm_16, sample_rate)
@pds = PacketDataStream.new
@pds_lock = Mutex.new
@decoders = Hash.new... | ruby | MIT | b323822cb238579e393b5135d52d0eb61d25bf02 | 2026-01-04T17:50:56.417802Z | false |
mattvperry/mumble-ruby | https://github.com/mattvperry/mumble-ruby/blob/b323822cb238579e393b5135d52d0eb61d25bf02/lib/mumble-ruby/thread_tools.rb | lib/mumble-ruby/thread_tools.rb | module Mumble
module ThreadTools
class DuplicateThread < StandardError; end
protected
def spawn_thread(sym)
raise DuplicateThread if threads.has_key? sym
threads[sym] = Thread.new { loop { send sym } }
end
def spawn_threads(*symbols)
symbols.map { |sym| spawn_thread sym }
e... | ruby | MIT | b323822cb238579e393b5135d52d0eb61d25bf02 | 2026-01-04T17:50:56.417802Z | false |
mattvperry/mumble-ruby | https://github.com/mattvperry/mumble-ruby/blob/b323822cb238579e393b5135d52d0eb61d25bf02/lib/mumble-ruby/audio_player.rb | lib/mumble-ruby/audio_player.rb | require 'wavefile'
module Mumble
class AudioPlayer
include ThreadTools
COMPRESSED_SIZE = 960
def initialize(type, connection, sample_rate, bitrate)
@packet_header = (type << 5).chr
@conn = connection
@pds = PacketDataStream.new
@queue = Queue.new
@wav_format = WaveFile::For... | ruby | MIT | b323822cb238579e393b5135d52d0eb61d25bf02 | 2026-01-04T17:50:56.417802Z | false |
mattvperry/mumble-ruby | https://github.com/mattvperry/mumble-ruby/blob/b323822cb238579e393b5135d52d0eb61d25bf02/lib/mumble-ruby/connection.rb | lib/mumble-ruby/connection.rb | require 'socket'
require 'openssl'
require 'thread'
module Mumble
class Connection
def initialize(host, port, cert_manager)
@host = host
@port = port
@cert_manager = cert_manager
@write_lock = Mutex.new
end
def connect
context = OpenSSL::SSL::SSLContext.new(:TLSv1)
co... | ruby | MIT | b323822cb238579e393b5135d52d0eb61d25bf02 | 2026-01-04T17:50:56.417802Z | false |
mattvperry/mumble-ruby | https://github.com/mattvperry/mumble-ruby/blob/b323822cb238579e393b5135d52d0eb61d25bf02/lib/mumble-ruby/messages.rb | lib/mumble-ruby/messages.rb | ### Generated by rprotoc. DO NOT EDIT!
### <proto file: mumble.proto>
require 'protobuf/message/message'
require 'protobuf/message/enum'
require 'protobuf/message/service'
require 'protobuf/message/extend'
module Mumble
module Messages
::Protobuf::OPTIONS[:"optimize_for"] = :SPEED
HEADER_FORMAT = "nN"
... | ruby | MIT | b323822cb238579e393b5135d52d0eb61d25bf02 | 2026-01-04T17:50:56.417802Z | false |
mattvperry/mumble-ruby | https://github.com/mattvperry/mumble-ruby/blob/b323822cb238579e393b5135d52d0eb61d25bf02/lib/mumble-ruby/client.rb | lib/mumble-ruby/client.rb | require 'hashie'
module Mumble
class ChannelNotFound < StandardError; end
class UserNotFound < StandardError; end
class NoSupportedCodec < StandardError; end
class Client
include ThreadTools
attr_reader :users, :channels
CODEC_OPUS = 4
def initialize(host, port=64738, username="RubyClient", ... | ruby | MIT | b323822cb238579e393b5135d52d0eb61d25bf02 | 2026-01-04T17:50:56.417802Z | false |
mattvperry/mumble-ruby | https://github.com/mattvperry/mumble-ruby/blob/b323822cb238579e393b5135d52d0eb61d25bf02/lib/mumble-ruby/model.rb | lib/mumble-ruby/model.rb | require 'forwardable'
module Mumble
class Model
extend ::Forwardable
class << self
def attribute(name, &block)
attributes << name
define_method(name) do
if block_given?
self.instance_eval(&block)
else
@data[name.to_s]
end
en... | ruby | MIT | b323822cb238579e393b5135d52d0eb61d25bf02 | 2026-01-04T17:50:56.417802Z | false |
mattvperry/mumble-ruby | https://github.com/mattvperry/mumble-ruby/blob/b323822cb238579e393b5135d52d0eb61d25bf02/lib/mumble-ruby/cert_manager.rb | lib/mumble-ruby/cert_manager.rb | require 'openssl'
require 'fileutils'
module Mumble
class CertManager
attr_reader :key, :cert
CERT_STRING = "/C=%s/O=%s/OU=%s/CN=%s"
def initialize(username, opts)
@cert_dir = File.join(opts[:cert_dir], "#{username.downcase}_cert")
@username = username
@opts = opts
FileUtils.mk... | ruby | MIT | b323822cb238579e393b5135d52d0eb61d25bf02 | 2026-01-04T17:50:56.417802Z | false |
mattvperry/mumble-ruby | https://github.com/mattvperry/mumble-ruby/blob/b323822cb238579e393b5135d52d0eb61d25bf02/lib/mumble-ruby/user.rb | lib/mumble-ruby/user.rb | module Mumble
class User < Model
attribute :session
attribute :user_id
attribute :actor
attribute :name
attribute :channel_id
attribute :hash
attribute :comment
attribute :mute
attribute :deaf
attribute :self_mute
attribute :self_deaf
def initialize(client, data)
... | ruby | MIT | b323822cb238579e393b5135d52d0eb61d25bf02 | 2026-01-04T17:50:56.417802Z | false |
aflatter/oauth2-ruby | https://github.com/aflatter/oauth2-ruby/blob/bba05bc4fa70d80b76ded0ec79ba12b846945b54/oauth2-rails/app/models/oauth2/authorization_code_grant.rb | oauth2-rails/app/models/oauth2/authorization_code_grant.rb | class AuthorizationCodeGrant < ActiveRecord::Base
set_table_name 'oauth2_authorization_code_grants'
end
| ruby | MIT | bba05bc4fa70d80b76ded0ec79ba12b846945b54 | 2026-01-04T17:51:03.115784Z | false |
aflatter/oauth2-ruby | https://github.com/aflatter/oauth2-ruby/blob/bba05bc4fa70d80b76ded0ec79ba12b846945b54/oauth2-rails/rails/uninstall.rb | oauth2-rails/rails/uninstall.rb | # Uninstall hook code here
| ruby | MIT | bba05bc4fa70d80b76ded0ec79ba12b846945b54 | 2026-01-04T17:51:03.115784Z | false |
aflatter/oauth2-ruby | https://github.com/aflatter/oauth2-ruby/blob/bba05bc4fa70d80b76ded0ec79ba12b846945b54/oauth2-rails/rails/install.rb | oauth2-rails/rails/install.rb | # Install hook code here
| ruby | MIT | bba05bc4fa70d80b76ded0ec79ba12b846945b54 | 2026-01-04T17:51:03.115784Z | false |
aflatter/oauth2-ruby | https://github.com/aflatter/oauth2-ruby/blob/bba05bc4fa70d80b76ded0ec79ba12b846945b54/oauth2-rails/spec/rails_spec.rb | oauth2-rails/spec/rails_spec.rb | describe OAuth2::Rails do
it "should initialize a configuration" do
subject.config.should be_a(OAuth2::Rails::Config)
end
it "should setup its configuration" do
blk = Proc.new { }
subject.config.should_receive(:setup).once.and_yield(blk)
subject.setup(&blk)
end
end | ruby | MIT | bba05bc4fa70d80b76ded0ec79ba12b846945b54 | 2026-01-04T17:51:03.115784Z | false |
aflatter/oauth2-ruby | https://github.com/aflatter/oauth2-ruby/blob/bba05bc4fa70d80b76ded0ec79ba12b846945b54/oauth2-rails/spec/spec_helper.rb | oauth2-rails/spec/spec_helper.rb | %w{core server}.each do |component|
$LOAD_PATH.unshift(File.expand_path(
File.join('..', '..', "oauth2-#{component}", 'lib'),
File.dirname(__FILE__)
))
end
require "rubygems"
begin
require "bundler"
Bundler.setup
rescue LoadError => e
puts 'Bundler not found. Please install bundler with the command ... | ruby | MIT | bba05bc4fa70d80b76ded0ec79ba12b846945b54 | 2026-01-04T17:51:03.115784Z | false |
aflatter/oauth2-ruby | https://github.com/aflatter/oauth2-ruby/blob/bba05bc4fa70d80b76ded0ec79ba12b846945b54/oauth2-rails/spec/rails/config_spec.rb | oauth2-rails/spec/rails/config_spec.rb | require 'spec_helper'
require 'oauth2/rails/config'
describe OAuth2::Rails::Config do
it "has a default of :active_record for adapter" do
subject.adapter.should == :active_record
end
it "allows to set adapter" do
subject.adapter = :foo_bar
subject.adapter.should == :foo_bar
end
it "has a... | ruby | MIT | bba05bc4fa70d80b76ded0ec79ba12b846945b54 | 2026-01-04T17:51:03.115784Z | false |
aflatter/oauth2-ruby | https://github.com/aflatter/oauth2-ruby/blob/bba05bc4fa70d80b76ded0ec79ba12b846945b54/oauth2-rails/lib/oauth2-rails.rb | oauth2-rails/lib/oauth2-rails.rb | require 'oauth2/rails' | ruby | MIT | bba05bc4fa70d80b76ded0ec79ba12b846945b54 | 2026-01-04T17:51:03.115784Z | false |
aflatter/oauth2-ruby | https://github.com/aflatter/oauth2-ruby/blob/bba05bc4fa70d80b76ded0ec79ba12b846945b54/oauth2-rails/lib/oauth2/rails.rb | oauth2-rails/lib/oauth2/rails.rb | require 'oauth2/rails/engine' if defined?(Rails)
require 'oauth2/rails/config'
require 'active_support/core_ext/module'
module OAuth2
module Rails
class << self
mattr_accessor :config
self.config = Config.new
def setup(&block)
config.setup(&block)
end
en... | ruby | MIT | bba05bc4fa70d80b76ded0ec79ba12b846945b54 | 2026-01-04T17:51:03.115784Z | false |
aflatter/oauth2-ruby | https://github.com/aflatter/oauth2-ruby/blob/bba05bc4fa70d80b76ded0ec79ba12b846945b54/oauth2-rails/lib/oauth2/rails/config.rb | oauth2-rails/lib/oauth2/rails/config.rb | require 'active_support/core_ext/module'
module OAuth2
module Rails
class Config
class << self
# We alias this method to something shorter.
alias :option :attr_accessor_with_default
end
option :adapter, :active_record
option :enforce_scopes, true
op... | ruby | MIT | bba05bc4fa70d80b76ded0ec79ba12b846945b54 | 2026-01-04T17:51:03.115784Z | false |
aflatter/oauth2-ruby | https://github.com/aflatter/oauth2-ruby/blob/bba05bc4fa70d80b76ded0ec79ba12b846945b54/oauth2-rails/lib/oauth2/rails/engine.rb | oauth2-rails/lib/oauth2/rails/engine.rb | require 'rails'
module OAuth2
module Rails
class Engine < ::Rails::Engine
class << self
def root
@root ||= File.expand_path("../../../..", __FILE__)
end
end
generators do
pattern = File.join(root, "generators", "oauth2", "*_generator.rb")
... | ruby | MIT | bba05bc4fa70d80b76ded0ec79ba12b846945b54 | 2026-01-04T17:51:03.115784Z | false |
aflatter/oauth2-ruby | https://github.com/aflatter/oauth2-ruby/blob/bba05bc4fa70d80b76ded0ec79ba12b846945b54/oauth2-rails/lib/oauth2/rails/adapters/active_record.rb | oauth2-rails/lib/oauth2/rails/adapters/active_record.rb | module OAuth2
module Rails
module Adapters
class ActiveRecord < Base
def initialize
super
@models = Hash.new
end
def create_authorization_code_grant(attributes)
model(:authorization_code_grant).create(
attributes.slice(:client, :... | ruby | MIT | bba05bc4fa70d80b76ded0ec79ba12b846945b54 | 2026-01-04T17:51:03.115784Z | false |
aflatter/oauth2-ruby | https://github.com/aflatter/oauth2-ruby/blob/bba05bc4fa70d80b76ded0ec79ba12b846945b54/oauth2-rails/lib/oauth2/rails/adapters/base.rb | oauth2-rails/lib/oauth2/rails/adapters/base.rb | module OAuth2
module Rails
module Adapters
class Base
def initialize(options)
@options = options
end
# Must be implemented by subclasses
# Returns true on success, else false.
def create_authorization_code_grant(attributes)
... | ruby | MIT | bba05bc4fa70d80b76ded0ec79ba12b846945b54 | 2026-01-04T17:51:03.115784Z | false |
aflatter/oauth2-ruby | https://github.com/aflatter/oauth2-ruby/blob/bba05bc4fa70d80b76ded0ec79ba12b846945b54/oauth2-server/spec/server_spec.rb | oauth2-server/spec/server_spec.rb | require 'spec_helper.rb'
describe OAuth2::Server do
end | ruby | MIT | bba05bc4fa70d80b76ded0ec79ba12b846945b54 | 2026-01-04T17:51:03.115784Z | false |
aflatter/oauth2-ruby | https://github.com/aflatter/oauth2-ruby/blob/bba05bc4fa70d80b76ded0ec79ba12b846945b54/oauth2-server/spec/spec_helper.rb | oauth2-server/spec/spec_helper.rb | $LOAD_PATH.unshift(File.expand_path(
File.join('..', '..', 'oauth2-core', 'lib'),
File.dirname(__FILE__)
))
require "rubygems"
begin
require "bundler"
Bundler.setup
rescue LoadError => e
puts 'Bundler not found. Please install bundler with the command gem install bundle... | ruby | MIT | bba05bc4fa70d80b76ded0ec79ba12b846945b54 | 2026-01-04T17:51:03.115784Z | false |
aflatter/oauth2-ruby | https://github.com/aflatter/oauth2-ruby/blob/bba05bc4fa70d80b76ded0ec79ba12b846945b54/oauth2-server/lib/oauth2/server.rb | oauth2-server/lib/oauth2/server.rb | require 'oauth2/core'
module OAuth2
module Server
# autoload :Flows, 'oauth2/server/flows'
# autoload :Rails, 'oauth2/server/rails'
# autoload :Request, 'oauth2/server/request'
end
end
| ruby | MIT | bba05bc4fa70d80b76ded0ec79ba12b846945b54 | 2026-01-04T17:51:03.115784Z | false |
aflatter/oauth2-ruby | https://github.com/aflatter/oauth2-ruby/blob/bba05bc4fa70d80b76ded0ec79ba12b846945b54/oauth2-core/spec/attributes_spec.rb | oauth2-core/spec/attributes_spec.rb | require 'spec_helper'
require 'oauth2/attributes'
describe OAuth2::Attributes do
subject do
klass = Class.new do
include OAuth2::Attributes
attributes :foo
end
klass.new
end
it "should allow to set an attribute to nil" do
subject.foo = nil
subject.foo.should be_nil
end
... | ruby | MIT | bba05bc4fa70d80b76ded0ec79ba12b846945b54 | 2026-01-04T17:51:03.115784Z | false |
aflatter/oauth2-ruby | https://github.com/aflatter/oauth2-ruby/blob/bba05bc4fa70d80b76ded0ec79ba12b846945b54/oauth2-core/spec/spec_helper.rb | oauth2-core/spec/spec_helper.rb | require "rubygems"
require "bundler"
Bundler.setup
require 'oauth2/core'
require 'rspec'
require 'rspec/autorun'
Dir.glob(File.dirname(__FILE__) + "/support/**/*.rb").each do |file|
require file
end
Rspec.configure do |config|
# == Mock Framework
#
# If you prefer to use mocha, flexmock or RR, uncomment the ... | ruby | MIT | bba05bc4fa70d80b76ded0ec79ba12b846945b54 | 2026-01-04T17:51:03.115784Z | false |
aflatter/oauth2-ruby | https://github.com/aflatter/oauth2-ruby/blob/bba05bc4fa70d80b76ded0ec79ba12b846945b54/oauth2-core/spec/headers/authorization_spec.rb | oauth2-core/spec/headers/authorization_spec.rb | require 'spec_helper'
require 'oauth2/headers/authorization'
describe OAuth2::Headers::Authorization do
it "should parse a real world cryptographic example" do
example = <<-EOS
Token token="vF9dft4qmT",
nonce="s8djwd",
timestamp="137131200",
algorithm="hmac-sha256",
signature="wOJIO9... | ruby | MIT | bba05bc4fa70d80b76ded0ec79ba12b846945b54 | 2026-01-04T17:51:03.115784Z | false |
aflatter/oauth2-ruby | https://github.com/aflatter/oauth2-ruby/blob/bba05bc4fa70d80b76ded0ec79ba12b846945b54/oauth2-core/spec/headers/authenticate_spec.rb | oauth2-core/spec/headers/authenticate_spec.rb | require 'spec_helper'
require 'oauth2/headers/authenticate'
describe OAuth2::Headers::Authenticate do
end | ruby | MIT | bba05bc4fa70d80b76ded0ec79ba12b846945b54 | 2026-01-04T17:51:03.115784Z | false |
aflatter/oauth2-ruby | https://github.com/aflatter/oauth2-ruby/blob/bba05bc4fa70d80b76ded0ec79ba12b846945b54/oauth2-core/lib/oauth2/attributes.rb | oauth2-core/lib/oauth2/attributes.rb | require 'active_support/concern'
require 'active_support/core_ext/class/inheritable_attributes'
module OAuth2
module Attributes
extend ActiveSupport::Concern
included do
class_inheritable_array :attribute_names
self.attribute_names = Array.new
end
def attributes
@a... | ruby | MIT | bba05bc4fa70d80b76ded0ec79ba12b846945b54 | 2026-01-04T17:51:03.115784Z | false |
aflatter/oauth2-ruby | https://github.com/aflatter/oauth2-ruby/blob/bba05bc4fa70d80b76ded0ec79ba12b846945b54/oauth2-core/lib/oauth2/core.rb | oauth2-core/lib/oauth2/core.rb | module OAuth2
autoload :Headers, 'oauth2/headers'
autoload :Signature, 'oauth2/signature'
end | ruby | MIT | bba05bc4fa70d80b76ded0ec79ba12b846945b54 | 2026-01-04T17:51:03.115784Z | false |
aflatter/oauth2-ruby | https://github.com/aflatter/oauth2-ruby/blob/bba05bc4fa70d80b76ded0ec79ba12b846945b54/oauth2-core/lib/oauth2/headers.rb | oauth2-core/lib/oauth2/headers.rb | module OAuth2
module Headers
autoload :Authorization, 'oauth2/headers/authorization'
autoload :Authenticate, 'oauth2/headers/authenticate'
end
end | ruby | MIT | bba05bc4fa70d80b76ded0ec79ba12b846945b54 | 2026-01-04T17:51:03.115784Z | false |
aflatter/oauth2-ruby | https://github.com/aflatter/oauth2-ruby/blob/bba05bc4fa70d80b76ded0ec79ba12b846945b54/oauth2-core/lib/oauth2/headers/authenticate.rb | oauth2-core/lib/oauth2/headers/authenticate.rb | require 'oauth2/attributes'
module OAuth2
module Headers
class Authenticate
Attributes = [
:realm, :algorithms, :auth_uri, :token_uri, :error
]
Attributes.each do |attribute|
attr_accessor attribute
end
def valid?
raise "Realm not s... | ruby | MIT | bba05bc4fa70d80b76ded0ec79ba12b846945b54 | 2026-01-04T17:51:03.115784Z | false |
aflatter/oauth2-ruby | https://github.com/aflatter/oauth2-ruby/blob/bba05bc4fa70d80b76ded0ec79ba12b846945b54/oauth2-core/lib/oauth2/headers/authorization.rb | oauth2-core/lib/oauth2/headers/authorization.rb | require 'oauth2/attributes'
require 'active_support/ordered_hash'
module OAuth2
module Headers
class Authorization
def initialize(attributes = {})
attributes.each_pair do |key, value|
if Attributes.include?(key.to_sym) && !value.empty?
instance_variable_set("@#{key}", value... | ruby | MIT | bba05bc4fa70d80b76ded0ec79ba12b846945b54 | 2026-01-04T17:51:03.115784Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/slack-gamebot.rb | slack-gamebot.rb | ENV['RACK_ENV'] ||= 'development'
require 'bundler/setup'
Bundler.require :default, ENV.fetch('RACK_ENV', nil)
Dir[File.expand_path('config/initializers', __dir__) + '/**/*.rb'].each do |file|
require file
end
Mongoid.load! File.expand_path('config/mongoid.yml', __dir__), ENV.fetch('RACK_ENV', nil)
require 'slack... | ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/tasks/logger.rb | tasks/logger.rb | def logger
@logger ||= begin
$stdout.sync = true
Logger.new(STDOUT)
end
end
| ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/spec/spec_helper.rb | spec/spec_helper.rb | $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..'))
require 'fabrication'
require 'faker'
require 'hyperclient'
require 'webmock/rspec'
ENV['RACK_ENV'] = 'test'
require 'slack-ruby-bot/rspec'
require 'slack-gamebot'
Dir[File.join(File.dirname(__FILE__), 'support', '**/*.rb')].each do |file|
require file
e... | ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/spec/initializers/array_spec.rb | spec/initializers/array_spec.rb | require 'spec_helper'
describe Array do
describe '.and' do
it 'one' do
expect(['foo'].and).to eq 'foo'
end
it 'two' do
expect(%w[foo bar].and).to eq 'foo and bar'
end
it 'three' do
expect(%w[foo bar baz].and).to eq 'foo, bar and baz'
end
end
describe '.or' do
it '... | ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/spec/initializers/giphy_spec.rb | spec/initializers/giphy_spec.rb | require 'spec_helper'
describe Giphy, :js, type: :feature do
context 'with GIPHY_API_KEY' do
before do
ENV['GIPHY_API_KEY'] = 'key'
end
after do
ENV.delete('GIPHY_API_KEY')
end
it 'returns a random gif', vcr: { cassette_name: 'giphy_random' } do
expect(Giphy.random('bot')).to ... | ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/spec/support/capybara.rb | spec/support/capybara.rb | require 'capybara/rspec'
Capybara.configure do |config|
config.app = Api::Middleware.instance
config.server_port = 9293
config.server = :puma
end
module Capybara
module Node
class Element
def client_set(value)
driver.browser.execute_script("$(arguments[0]).val('#{value}');", native)
en... | ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/spec/support/vcr.rb | spec/support/vcr.rb | require 'vcr'
VCR.configure do |config|
config.cassette_library_dir = 'spec/fixtures/slack'
config.hook_into :webmock
# config.default_cassette_options = { record: :new_episodes }
config.configure_rspec_metadata!
config.ignore_localhost = true
end
| ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/spec/support/mongoid.rb | spec/support/mongoid.rb | RSpec.configure do |config|
config.before :suite do
Mongoid.logger.level = Logger::INFO
Mongo::Logger.logger.level = Logger::INFO
Mongoid::Tasks::Database.create_indexes
end
end
| ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/spec/support/database_cleaner.rb | spec/support/database_cleaner.rb | require 'database_cleaner-mongoid'
RSpec.configure do |config|
config.before :suite do
DatabaseCleaner.strategy = :deletion
DatabaseCleaner.clean_with :deletion
end
config.after :suite do
Mongoid.purge!
end
config.around do |example|
DatabaseCleaner.cleaning do
example.run
end
e... | ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/spec/support/new_relic.rb | spec/support/new_relic.rb | require 'new_relic/agent'
RSpec.configure do |config|
config.before :suite do
NewRelic::Agent.manual_start
end
config.after :suite do
FileUtils.rm_rf File.expand_path('log/newrelic_agent.log')
end
end
| ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/spec/support/stripe.rb | spec/support/stripe.rb | RSpec.shared_context 'stripe mock' do
let(:stripe_helper) { StripeMock.create_test_helper }
before do
StripeMock.start
end
after do
StripeMock.stop
end
end
RSpec.configure do |config|
config.before do
allow(Stripe).to receive(:api_key).and_return('key')
end
end
| ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/spec/support/api/endpoints/endpoint_test.rb | spec/support/api/endpoints/endpoint_test.rb | module Api
module Test
module EndpointTest
extend ActiveSupport::Concern
include Rack::Test::Methods
included do
let(:client) do
Hyperclient.new('http://example.org/api/') do |client|
client.headers = {
'Content-Type' => 'application/json',
... | ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/spec/support/api/endpoints/it_behaves_like_a_cursor_api.rb | spec/support/api/endpoints/it_behaves_like_a_cursor_api.rb | shared_examples_for 'a cursor api' do |model|
let(:model_s) { model.name.underscore.to_sym }
let(:model_ps) { model.name.underscore.pluralize.to_sym }
context model.name do
let(:cursor_params) { @cursor_params || {} }
before do
12.times { Fabricate(model_s) }
end
it 'returns all items by d... | ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/spec/integration/update_cc_spec.rb | spec/integration/update_cc_spec.rb | require 'spec_helper'
describe 'Update cc', :js, type: :feature do
context 'with a stripe key' do
before do
ENV['STRIPE_API_PUBLISHABLE_KEY'] = 'pk_test_804U1vUeVeTxBl8znwriXskf'
end
after do
ENV.delete 'STRIPE_API_PUBLISHABLE_KEY'
end
context 'a game' do
let!(:game) { Fabrica... | ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/spec/integration/subscribe_spec.rb | spec/integration/subscribe_spec.rb | require 'spec_helper'
describe 'Subscribe', :js, type: :feature do
let!(:game) { Fabricate(:game, name: 'pong') }
context 'without team_id' do
before do
visit '/subscribe'
end
it 'requires a team' do
expect(find_by_id('messages')).to have_text('Missing or invalid team ID and/or game.')
... | ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/spec/integration/privacy_spec.rb | spec/integration/privacy_spec.rb | require 'spec_helper'
describe 'privacy.html', :js, type: :feature do
before do
visit '/privacy'
end
it 'displays privacy.html page' do
expect(title).to eq('PlayPlay.io - Privacy Policy')
end
end
| ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/spec/integration/index_spec.rb | spec/integration/index_spec.rb | require 'spec_helper'
describe 'index.html', :js, type: :feature do
let!(:game) { Fabricate(:game, name: 'pong') }
context 'v1' do
before do
visit '/?version=1'
end
it 'includes a link to add to slack with the client id' do
expect(title).to eq('PlayPlay.io - Ping Pong Bot, Chess Bot, Pool... | ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/spec/integration/teams_spec.rb | spec/integration/teams_spec.rb | require 'spec_helper'
describe 'Teams', :js, type: :feature do
context 'oauth', vcr: { cassette_name: 'auth_test' } do
before do
Fabricate(:game, name: 'pong')
end
it 'registers a team' do
allow_any_instance_of(Team).to receive(:ping!).and_return(ok: true)
expect(SlackRubyBotServer::Se... | ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/spec/models/season_spec.rb | spec/models/season_spec.rb | require 'spec_helper'
describe Season do
let!(:team) { Fabricate(:team) }
context 'with challenges' do
let!(:open_challenge) { Fabricate(:challenge) }
let!(:matches) { Array.new(3) { Fabricate(:match) } }
let!(:season) { Fabricate(:season, team:) }
it 'archives challenges' do
expect(season.... | ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/spec/models/match_spec.rb | spec/models/match_spec.rb | require 'spec_helper'
describe Match do
describe '#to_s' do
let(:match) { Fabricate(:match) }
it 'displays match' do
expect(match.to_s).to eq "#{match.winners.first.user_name} defeated #{match.losers.first.user_name} with #{Score.scores_to_string(match.scores)}"
end
context 'unregistered user... | ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/spec/models/team_spec.rb | spec/models/team_spec.rb | require 'spec_helper'
describe Team do
let!(:game) { Fabricate(:game) }
describe '#find_or_create_from_env!' do
before do
ENV['SLACK_API_TOKEN'] = 'token'
end
after do
ENV.delete 'SLACK_API_TOKEN'
end
context 'team', vcr: { cassette_name: 'team_info' } do
it 'creates a team... | ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/spec/models/challenge_spec.rb | spec/models/challenge_spec.rb | require 'spec_helper'
describe Challenge do
describe '#to_s' do
let(:challenge) { Fabricate(:challenge) }
it 'displays challenge' do
expect(challenge.to_s).to eq "a challenge between #{challenge.challengers.first.user_name} and #{challenge.challenged.first.user_name}"
end
context 'unregistere... | ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/spec/models/game_spec.rb | spec/models/game_spec.rb | require 'spec_helper'
describe Game do
describe '#find_or_create_from_env!' do
before do
ENV['SLACK_CLIENT_ID'] = 'slack_client_id'
ENV['SLACK_CLIENT_SECRET'] = 'slack_client_secret'
ENV['SLACK_RUBY_BOT_ALIASES'] = 'pp :pong:'
end
after do
ENV.delete 'SLACK_CLIENT_ID'
ENV.d... | ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/spec/models/score_spec.rb | spec/models/score_spec.rb | require 'spec_helper'
describe Score do
describe '#points' do
it 'returns losing and winning points for one score' do
expect(Score.points([[15, 21]])).to eq [15, 21]
end
it 'returns losing and winning points for mulitple scores' do
expect(Score.points([[15, 21], [11, 9]])).to eq [26, 30]
... | ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/spec/models/user_rank_spec.rb | spec/models/user_rank_spec.rb | require 'spec_helper'
describe UserRank do
describe '#from_user' do
it 'creates a record' do
user = Fabricate(:user)
user_rank = UserRank.from_user(user)
expect(user_rank.user).to eq user
expect(user_rank.user_name).to eq user.user_name
expect(user_rank.wins).to eq user.wins
e... | ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/spec/models/elo_spec.rb | spec/models/elo_spec.rb | require 'spec_helper'
describe Elo do
describe '#team_elo' do
it 'is rounded average of elo' do
expect(Elo.team_elo([User.new(elo: 1)])).to eq 1
expect(Elo.team_elo([User.new(elo: 1), User.new(elo: 2)])).to eq 1.5
expect(Elo.team_elo([User.new(elo: 3), User.new(elo: 3), User.new(elo: 4)])).to e... | ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/spec/models/user_spec.rb | spec/models/user_spec.rb | require 'spec_helper'
describe User do
let(:team) { Fabricate(:team) }
describe '#find_by_slack_mention!' do
let(:web_client) { double(Slack::Web::Client, users_info: nil) }
let(:client) { double(Slack::RealTime::Client, owner: team, web_client:) }
let!(:user) { Fabricate(:user, team:, nickname: 'bob'... | ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/spec/api/swagger_documentation_spec.rb | spec/api/swagger_documentation_spec.rb | require 'spec_helper'
describe Api do
include Api::Test::EndpointTest
context 'swagger root' do
subject do
get '/api/swagger_doc'
JSON.parse(last_response.body)
end
it 'documents root level apis' do
expect(subject['paths'].keys.sort).to eq [
'/api/status',
'/api/user... | ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/spec/api/cors_spec.rb | spec/api/cors_spec.rb | require 'spec_helper'
describe Api do
include Api::Test::EndpointTest
context 'CORS' do
it 'supports options' do
options '/', {},
'HTTP_ORIGIN' => 'http://cors.example.com',
'HTTP_ACCESS_CONTROL_REQUEST_HEADERS' => 'Origin, Accept, Content-Type',
'HTTP_ACCESS_CO... | ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/spec/api/robots_spec.rb | spec/api/robots_spec.rb | require 'spec_helper'
describe Api do
include Api::Test::EndpointTest
it 'returns a robots.txt that disallows indexing' do
get '/robots.txt'
expect(last_response.status).to eq 200
expect(last_response.headers['Content-Type']).to eq 'text/plain'
expect(last_response.body).to eq "User-Agent: *\nDisa... | ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/spec/api/404_spec.rb | spec/api/404_spec.rb | require 'spec_helper'
describe Api do
include Api::Test::EndpointTest
context '404' do
it 'returns a plain 404' do
get '/api/foobar'
expect(last_response.status).to eq 404
expect(last_response.body).to eq '404 Not Found'
end
end
end
| ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/spec/api/endpoints/status_endpoint_spec.rb | spec/api/endpoints/status_endpoint_spec.rb | require 'spec_helper'
describe Api::Endpoints::StatusEndpoint do
include Api::Test::EndpointTest
before do
allow_any_instance_of(Team).to receive(:ping!).and_return(ok: 1)
end
context 'status' do
it 'returns a status' do
status = client.status
expect(status.games_count).to eq 0
end
... | ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/spec/api/endpoints/credit_cards_endpoint_spec.rb | spec/api/endpoints/credit_cards_endpoint_spec.rb | require 'spec_helper'
describe Api::Endpoints::CreditCardsEndpoint do
include Api::Test::EndpointTest
context 'credit cards' do
it 'requires stripe parameters' do
expect { client.credit_cards._post }.to raise_error Faraday::ClientError do |e|
json = JSON.parse(e.response[:body])
expect(j... | ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.