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
NoamB/sorcery
https://github.com/NoamB/sorcery/blob/4aaf38363eddf7a2982312ce68f0105dcc4ae8dc/spec/rails_app/config/environments/test.rb
spec/rails_app/config/environments/test.rb
AppRoot::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 ...
ruby
MIT
4aaf38363eddf7a2982312ce68f0105dcc4ae8dc
2026-01-04T15:56:41.074273Z
false
NoamB/sorcery
https://github.com/NoamB/sorcery/blob/4aaf38363eddf7a2982312ce68f0105dcc4ae8dc/lib/sorcery.rb
lib/sorcery.rb
require 'sorcery/version' module Sorcery require 'sorcery/model' module Adapters require 'sorcery/adapters/base_adapter' end module Model require 'sorcery/model/temporary_token' require 'sorcery/model/config' module Submodules require 'sorcery/model/submodules/user_activation' ...
ruby
MIT
4aaf38363eddf7a2982312ce68f0105dcc4ae8dc
2026-01-04T15:56:41.074273Z
false
NoamB/sorcery
https://github.com/NoamB/sorcery/blob/4aaf38363eddf7a2982312ce68f0105dcc4ae8dc/lib/sorcery/version.rb
lib/sorcery/version.rb
module Sorcery VERSION = "0.9.1" end
ruby
MIT
4aaf38363eddf7a2982312ce68f0105dcc4ae8dc
2026-01-04T15:56:41.074273Z
false
NoamB/sorcery
https://github.com/NoamB/sorcery/blob/4aaf38363eddf7a2982312ce68f0105dcc4ae8dc/lib/sorcery/controller.rb
lib/sorcery/controller.rb
module Sorcery module Controller def self.included(klass) klass.class_eval do include InstanceMethods Config.submodules.each do |mod| begin include Submodules.const_get(mod.to_s.split('_').map { |p| p.capitalize }.join) rescue NameError # don't sto...
ruby
MIT
4aaf38363eddf7a2982312ce68f0105dcc4ae8dc
2026-01-04T15:56:41.074273Z
false
NoamB/sorcery
https://github.com/NoamB/sorcery/blob/4aaf38363eddf7a2982312ce68f0105dcc4ae8dc/lib/sorcery/engine.rb
lib/sorcery/engine.rb
require 'sorcery' require 'rails' module Sorcery # The Sorcery engine takes care of extending ActiveRecord (if used) and ActionController, # With the plugin logic. class Engine < Rails::Engine config.sorcery = ::Sorcery::Controller::Config initializer "extend Controller with sorcery" do |app| ...
ruby
MIT
4aaf38363eddf7a2982312ce68f0105dcc4ae8dc
2026-01-04T15:56:41.074273Z
false
NoamB/sorcery
https://github.com/NoamB/sorcery/blob/4aaf38363eddf7a2982312ce68f0105dcc4ae8dc/lib/sorcery/model.rb
lib/sorcery/model.rb
module Sorcery # This module handles all plugin operations which are related to the Model layer in the MVC pattern. # It should be included into the ORM base class. # In the case of Rails this is usually ActiveRecord (actually, in that case, the plugin does this automatically). # # When included it defines a ...
ruby
MIT
4aaf38363eddf7a2982312ce68f0105dcc4ae8dc
2026-01-04T15:56:41.074273Z
false
NoamB/sorcery
https://github.com/NoamB/sorcery/blob/4aaf38363eddf7a2982312ce68f0105dcc4ae8dc/lib/sorcery/controller/config.rb
lib/sorcery/controller/config.rb
module Sorcery module Controller module Config class << self attr_accessor :submodules, :user_class, # what class to use as the user class. :not_authenticated_action, # what controller action to call for non-authenticated users. ...
ruby
MIT
4aaf38363eddf7a2982312ce68f0105dcc4ae8dc
2026-01-04T15:56:41.074273Z
false
NoamB/sorcery
https://github.com/NoamB/sorcery/blob/4aaf38363eddf7a2982312ce68f0105dcc4ae8dc/lib/sorcery/controller/submodules/external.rb
lib/sorcery/controller/submodules/external.rb
module Sorcery module Controller module Submodules # This submodule helps you login users from external auth providers such as Twitter. # This is the controller part which handles the http requests and tokens passed between the app and the @provider. module External def self.included(bas...
ruby
MIT
4aaf38363eddf7a2982312ce68f0105dcc4ae8dc
2026-01-04T15:56:41.074273Z
false
NoamB/sorcery
https://github.com/NoamB/sorcery/blob/4aaf38363eddf7a2982312ce68f0105dcc4ae8dc/lib/sorcery/controller/submodules/http_basic_auth.rb
lib/sorcery/controller/submodules/http_basic_auth.rb
module Sorcery module Controller module Submodules # This submodule integrates HTTP Basic authentication into sorcery. # You are provided with a before action, require_login_from_http_basic, # which requests the browser for authentication. # Then the rest of the submodule takes care of log...
ruby
MIT
4aaf38363eddf7a2982312ce68f0105dcc4ae8dc
2026-01-04T15:56:41.074273Z
false
NoamB/sorcery
https://github.com/NoamB/sorcery/blob/4aaf38363eddf7a2982312ce68f0105dcc4ae8dc/lib/sorcery/controller/submodules/session_timeout.rb
lib/sorcery/controller/submodules/session_timeout.rb
module Sorcery module Controller module Submodules # This submodule helps you set a timeout to all user sessions. # The timeout can be configured and also you can choose to reset it on every user action. module SessionTimeout def self.included(base) base.send(:include, Instance...
ruby
MIT
4aaf38363eddf7a2982312ce68f0105dcc4ae8dc
2026-01-04T15:56:41.074273Z
false
NoamB/sorcery
https://github.com/NoamB/sorcery/blob/4aaf38363eddf7a2982312ce68f0105dcc4ae8dc/lib/sorcery/controller/submodules/brute_force_protection.rb
lib/sorcery/controller/submodules/brute_force_protection.rb
module Sorcery module Controller module Submodules # This module helps protect user accounts by locking them down after too # many failed attemps to login were detected. # This is the controller part of the submodule which takes care of # updating the failed logins and resetting them. ...
ruby
MIT
4aaf38363eddf7a2982312ce68f0105dcc4ae8dc
2026-01-04T15:56:41.074273Z
false
NoamB/sorcery
https://github.com/NoamB/sorcery/blob/4aaf38363eddf7a2982312ce68f0105dcc4ae8dc/lib/sorcery/controller/submodules/activity_logging.rb
lib/sorcery/controller/submodules/activity_logging.rb
module Sorcery module Controller module Submodules # This submodule keeps track of events such as login, logout, # and last activity time, per user. # It helps in estimating which users are active now in the site. # This cannot be determined absolutely because a user might be # readi...
ruby
MIT
4aaf38363eddf7a2982312ce68f0105dcc4ae8dc
2026-01-04T15:56:41.074273Z
false
NoamB/sorcery
https://github.com/NoamB/sorcery/blob/4aaf38363eddf7a2982312ce68f0105dcc4ae8dc/lib/sorcery/controller/submodules/remember_me.rb
lib/sorcery/controller/submodules/remember_me.rb
module Sorcery module Controller module Submodules # The Remember Me submodule takes care of setting the user's cookie so that he will # be automatically logged in to the site on every visit, # until the cookie expires. # See Sorcery::Model::Submodules::RememberMe for configuration options...
ruby
MIT
4aaf38363eddf7a2982312ce68f0105dcc4ae8dc
2026-01-04T15:56:41.074273Z
false
NoamB/sorcery
https://github.com/NoamB/sorcery/blob/4aaf38363eddf7a2982312ce68f0105dcc4ae8dc/lib/sorcery/model/temporary_token.rb
lib/sorcery/model/temporary_token.rb
require 'securerandom' module Sorcery module Model # This module encapsulates the logic for temporary token. # A temporary token is created to identify a user in scenarios # such as reseting password and activating the user by email. module TemporaryToken def self.included(base) base.ex...
ruby
MIT
4aaf38363eddf7a2982312ce68f0105dcc4ae8dc
2026-01-04T15:56:41.074273Z
false
NoamB/sorcery
https://github.com/NoamB/sorcery/blob/4aaf38363eddf7a2982312ce68f0105dcc4ae8dc/lib/sorcery/model/config.rb
lib/sorcery/model/config.rb
# Each class which calls 'activate_sorcery!' receives an instance of this class. # Every submodule which gets loaded may add accessors to this class so that all # options will be configured from a single place. module Sorcery module Model class Config attr_accessor :username_attribute_names, # ch...
ruby
MIT
4aaf38363eddf7a2982312ce68f0105dcc4ae8dc
2026-01-04T15:56:41.074273Z
false
NoamB/sorcery
https://github.com/NoamB/sorcery/blob/4aaf38363eddf7a2982312ce68f0105dcc4ae8dc/lib/sorcery/model/submodules/external.rb
lib/sorcery/model/submodules/external.rb
module Sorcery module Model module Submodules # This submodule helps you login users from external providers such as Twitter. # This is the model part which handles finding the user using access tokens. # For the controller options see Sorcery::Controller::External. # # Socery assume...
ruby
MIT
4aaf38363eddf7a2982312ce68f0105dcc4ae8dc
2026-01-04T15:56:41.074273Z
false
NoamB/sorcery
https://github.com/NoamB/sorcery/blob/4aaf38363eddf7a2982312ce68f0105dcc4ae8dc/lib/sorcery/model/submodules/user_activation.rb
lib/sorcery/model/submodules/user_activation.rb
module Sorcery module Model module Submodules # This submodule adds the ability to make the user activate his account via email # or any other way in which he can recieve an activation code. # with the activation code the user may activate his account. # When using this submodule, supplyin...
ruby
MIT
4aaf38363eddf7a2982312ce68f0105dcc4ae8dc
2026-01-04T15:56:41.074273Z
false
NoamB/sorcery
https://github.com/NoamB/sorcery/blob/4aaf38363eddf7a2982312ce68f0105dcc4ae8dc/lib/sorcery/model/submodules/brute_force_protection.rb
lib/sorcery/model/submodules/brute_force_protection.rb
module Sorcery module Model module Submodules # This module helps protect user accounts by locking them down after too many failed attemps # to login were detected. # This is the model part of the submodule which provides configuration options and methods # for locking and unlocking the us...
ruby
MIT
4aaf38363eddf7a2982312ce68f0105dcc4ae8dc
2026-01-04T15:56:41.074273Z
false
NoamB/sorcery
https://github.com/NoamB/sorcery/blob/4aaf38363eddf7a2982312ce68f0105dcc4ae8dc/lib/sorcery/model/submodules/reset_password.rb
lib/sorcery/model/submodules/reset_password.rb
module Sorcery module Model module Submodules # This submodule adds the ability to reset password via email confirmation. # When the user requests an email is sent to him with a url. # The url includes a token, which is also saved with the user's record in the db. # The token has configura...
ruby
MIT
4aaf38363eddf7a2982312ce68f0105dcc4ae8dc
2026-01-04T15:56:41.074273Z
false
NoamB/sorcery
https://github.com/NoamB/sorcery/blob/4aaf38363eddf7a2982312ce68f0105dcc4ae8dc/lib/sorcery/model/submodules/activity_logging.rb
lib/sorcery/model/submodules/activity_logging.rb
module Sorcery module Model module Submodules # This submodule keeps track of events such as login, logout, and last activity time, per user. # It helps in estimating which users are active now in the site. # This cannot be determined absolutely because a user might be reading a page without cli...
ruby
MIT
4aaf38363eddf7a2982312ce68f0105dcc4ae8dc
2026-01-04T15:56:41.074273Z
false
NoamB/sorcery
https://github.com/NoamB/sorcery/blob/4aaf38363eddf7a2982312ce68f0105dcc4ae8dc/lib/sorcery/model/submodules/remember_me.rb
lib/sorcery/model/submodules/remember_me.rb
module Sorcery module Model module Submodules # The Remember Me submodule takes care of setting the user's cookie so that he will # be automatically logged in to the site on every visit, # until the cookie expires. module RememberMe def self.included(base) base.sorcery_co...
ruby
MIT
4aaf38363eddf7a2982312ce68f0105dcc4ae8dc
2026-01-04T15:56:41.074273Z
false
NoamB/sorcery
https://github.com/NoamB/sorcery/blob/4aaf38363eddf7a2982312ce68f0105dcc4ae8dc/lib/sorcery/crypto_providers/common.rb
lib/sorcery/crypto_providers/common.rb
module Sorcery module CryptoProviders module Common def self.included(base) base.class_eval do class << self attr_accessor :join_token # The number of times to loop through the encryption. def stretches @stretches ||= 1 end ...
ruby
MIT
4aaf38363eddf7a2982312ce68f0105dcc4ae8dc
2026-01-04T15:56:41.074273Z
false
NoamB/sorcery
https://github.com/NoamB/sorcery/blob/4aaf38363eddf7a2982312ce68f0105dcc4ae8dc/lib/sorcery/crypto_providers/sha512.rb
lib/sorcery/crypto_providers/sha512.rb
require "digest/sha2" module Sorcery # The activate_sorcery method has a custom_crypto_provider configuration option. # This allows you to use any type of encryption you like. # Just create a class with a class level encrypt and matches? method. See example below. # # === Example # # class MyAwesomeEn...
ruby
MIT
4aaf38363eddf7a2982312ce68f0105dcc4ae8dc
2026-01-04T15:56:41.074273Z
false
NoamB/sorcery
https://github.com/NoamB/sorcery/blob/4aaf38363eddf7a2982312ce68f0105dcc4ae8dc/lib/sorcery/crypto_providers/bcrypt.rb
lib/sorcery/crypto_providers/bcrypt.rb
require 'bcrypt' module Sorcery module CryptoProviders # For most apps Sha512 is plenty secure, but if you are building an app that stores nuclear # launch codes you might want to consier BCrypt. This is an extremely # secure hashing algorithm, mainly because it is slow. # A brute force attack on a...
ruby
MIT
4aaf38363eddf7a2982312ce68f0105dcc4ae8dc
2026-01-04T15:56:41.074273Z
false
NoamB/sorcery
https://github.com/NoamB/sorcery/blob/4aaf38363eddf7a2982312ce68f0105dcc4ae8dc/lib/sorcery/crypto_providers/md5.rb
lib/sorcery/crypto_providers/md5.rb
require "digest/md5" module Sorcery module CryptoProviders # This class was made for the users transitioning from md5 based systems. # I highly discourage using this crypto provider as it superbly inferior # to your other options. # # Please use any other provider offered by Sorcery. class...
ruby
MIT
4aaf38363eddf7a2982312ce68f0105dcc4ae8dc
2026-01-04T15:56:41.074273Z
false
NoamB/sorcery
https://github.com/NoamB/sorcery/blob/4aaf38363eddf7a2982312ce68f0105dcc4ae8dc/lib/sorcery/crypto_providers/sha1.rb
lib/sorcery/crypto_providers/sha1.rb
require "digest/sha1" module Sorcery module CryptoProviders # This class was made for the users transitioning from restful_authentication. I highly discourage using this # crypto provider as it inferior to your other options. Please use any other provider offered by Sorcery. class SHA1 include Comm...
ruby
MIT
4aaf38363eddf7a2982312ce68f0105dcc4ae8dc
2026-01-04T15:56:41.074273Z
false
NoamB/sorcery
https://github.com/NoamB/sorcery/blob/4aaf38363eddf7a2982312ce68f0105dcc4ae8dc/lib/sorcery/crypto_providers/aes256.rb
lib/sorcery/crypto_providers/aes256.rb
require "openssl" module Sorcery module CryptoProviders # This encryption method is reversible if you have the supplied key. # So in order to use this encryption method you must supply it with a key first. # In an initializer, or before your application initializes, you should do the following: # ...
ruby
MIT
4aaf38363eddf7a2982312ce68f0105dcc4ae8dc
2026-01-04T15:56:41.074273Z
false
NoamB/sorcery
https://github.com/NoamB/sorcery/blob/4aaf38363eddf7a2982312ce68f0105dcc4ae8dc/lib/sorcery/crypto_providers/sha256.rb
lib/sorcery/crypto_providers/sha256.rb
require "digest/sha2" module Sorcery # The activate_sorcery method has a custom_crypto_provider configuration option. # This allows you to use any type of encryption you like. # Just create a class with a class level encrypt and matches? method. See example below. # # === Example # # class MyAwesomeEn...
ruby
MIT
4aaf38363eddf7a2982312ce68f0105dcc4ae8dc
2026-01-04T15:56:41.074273Z
false
NoamB/sorcery
https://github.com/NoamB/sorcery/blob/4aaf38363eddf7a2982312ce68f0105dcc4ae8dc/lib/sorcery/providers/facebook.rb
lib/sorcery/providers/facebook.rb
module Sorcery module Providers # This class adds support for OAuth with facebook.com. # # config.facebook.key = <key> # config.facebook.secret = <secret> # ... # class Facebook < Base include Protocols::Oauth2 attr_reader :mode, :param_name, :parse attr_accesso...
ruby
MIT
4aaf38363eddf7a2982312ce68f0105dcc4ae8dc
2026-01-04T15:56:41.074273Z
false
NoamB/sorcery
https://github.com/NoamB/sorcery/blob/4aaf38363eddf7a2982312ce68f0105dcc4ae8dc/lib/sorcery/providers/xing.rb
lib/sorcery/providers/xing.rb
module Sorcery module Providers # This class adds support for OAuth with xing.com. # # config.xing.key = <key> # config.xing.secret = <secret> # ... # class Xing < Base include Protocols::Oauth attr_accessor :access_token_path, :authorize_path, :request_token_path, ...
ruby
MIT
4aaf38363eddf7a2982312ce68f0105dcc4ae8dc
2026-01-04T15:56:41.074273Z
false
NoamB/sorcery
https://github.com/NoamB/sorcery/blob/4aaf38363eddf7a2982312ce68f0105dcc4ae8dc/lib/sorcery/providers/paypal.rb
lib/sorcery/providers/paypal.rb
module Sorcery module Providers # This class adds support for OAuth with paypal.com. # # config.paypal.key = <key> # config.paypal.secret = <secret> # ... # class Paypal < Base include Protocols::Oauth2 attr_accessor :auth_url, :scope, :token_url, :user_info_url ...
ruby
MIT
4aaf38363eddf7a2982312ce68f0105dcc4ae8dc
2026-01-04T15:56:41.074273Z
false
NoamB/sorcery
https://github.com/NoamB/sorcery/blob/4aaf38363eddf7a2982312ce68f0105dcc4ae8dc/lib/sorcery/providers/linkedin.rb
lib/sorcery/providers/linkedin.rb
module Sorcery module Providers # This class adds support for OAuth with Linkedin.com. # # config.linkedin.key = <key> # config.linkedin.secret = <secret> # ... # class Linkedin < Base include Protocols::Oauth attr_accessor :authorize_path, :access_permissions, :access_...
ruby
MIT
4aaf38363eddf7a2982312ce68f0105dcc4ae8dc
2026-01-04T15:56:41.074273Z
false
NoamB/sorcery
https://github.com/NoamB/sorcery/blob/4aaf38363eddf7a2982312ce68f0105dcc4ae8dc/lib/sorcery/providers/twitter.rb
lib/sorcery/providers/twitter.rb
module Sorcery module Providers # This class adds support for OAuth with Twitter.com. # # config.twitter.key = <key> # config.twitter.secret = <secret> # ... # class Twitter < Base include Protocols::Oauth attr_accessor :state, :user_info_path def initialize ...
ruby
MIT
4aaf38363eddf7a2982312ce68f0105dcc4ae8dc
2026-01-04T15:56:41.074273Z
false
NoamB/sorcery
https://github.com/NoamB/sorcery/blob/4aaf38363eddf7a2982312ce68f0105dcc4ae8dc/lib/sorcery/providers/github.rb
lib/sorcery/providers/github.rb
module Sorcery module Providers # This class adds support for OAuth with github.com. # # config.github.key = <key> # config.github.secret = <secret> # ... # class Github < Base include Protocols::Oauth2 attr_accessor :auth_path, :scope, :token_url, :user_info_path ...
ruby
MIT
4aaf38363eddf7a2982312ce68f0105dcc4ae8dc
2026-01-04T15:56:41.074273Z
false
NoamB/sorcery
https://github.com/NoamB/sorcery/blob/4aaf38363eddf7a2982312ce68f0105dcc4ae8dc/lib/sorcery/providers/salesforce.rb
lib/sorcery/providers/salesforce.rb
module Sorcery module Providers # This class adds support for OAuth with salesforce.com. # # config.salesforce.key = <key> # config.salesforce.secret = <secret> # ... # class Salesforce < Base include Protocols::Oauth2 attr_accessor :auth_url, :token_url, :scope ...
ruby
MIT
4aaf38363eddf7a2982312ce68f0105dcc4ae8dc
2026-01-04T15:56:41.074273Z
false
NoamB/sorcery
https://github.com/NoamB/sorcery/blob/4aaf38363eddf7a2982312ce68f0105dcc4ae8dc/lib/sorcery/providers/google.rb
lib/sorcery/providers/google.rb
module Sorcery module Providers # This class adds support for OAuth with google.com. # # config.google.key = <key> # config.google.secret = <secret> # ... # class Google < Base include Protocols::Oauth2 attr_accessor :auth_url, :scope, :token_url, :user_info_url ...
ruby
MIT
4aaf38363eddf7a2982312ce68f0105dcc4ae8dc
2026-01-04T15:56:41.074273Z
false
NoamB/sorcery
https://github.com/NoamB/sorcery/blob/4aaf38363eddf7a2982312ce68f0105dcc4ae8dc/lib/sorcery/providers/base.rb
lib/sorcery/providers/base.rb
module Sorcery module Providers class Base attr_reader :access_token attr_accessor :callback_url, :key, :original_callback_url, :secret, :site, :state, :user_info_mapping def has_callback?; true; end def initialize @user_info_mapping = {} end ...
ruby
MIT
4aaf38363eddf7a2982312ce68f0105dcc4ae8dc
2026-01-04T15:56:41.074273Z
false
NoamB/sorcery
https://github.com/NoamB/sorcery/blob/4aaf38363eddf7a2982312ce68f0105dcc4ae8dc/lib/sorcery/providers/liveid.rb
lib/sorcery/providers/liveid.rb
module Sorcery module Providers # This class adds support for OAuth with microsoft liveid. # # config.liveid.key = <key> # config.liveid.secret = <secret> # ... # class Liveid < Base include Protocols::Oauth2 attr_accessor :auth_url, :token_path, :user_info_url, :scope ...
ruby
MIT
4aaf38363eddf7a2982312ce68f0105dcc4ae8dc
2026-01-04T15:56:41.074273Z
false
NoamB/sorcery
https://github.com/NoamB/sorcery/blob/4aaf38363eddf7a2982312ce68f0105dcc4ae8dc/lib/sorcery/providers/heroku.rb
lib/sorcery/providers/heroku.rb
module Sorcery module Providers # This class adds support for OAuth with heroku.com. # config.heroku.key = <key> # config.heroku.secret = <secret> # config.heroku.callback_url = "<host>/oauth/callback?provider=heroku" # config.heroku.scope = "read" # config.heroku.user_info_mapping = {:email...
ruby
MIT
4aaf38363eddf7a2982312ce68f0105dcc4ae8dc
2026-01-04T15:56:41.074273Z
false
NoamB/sorcery
https://github.com/NoamB/sorcery/blob/4aaf38363eddf7a2982312ce68f0105dcc4ae8dc/lib/sorcery/providers/vk.rb
lib/sorcery/providers/vk.rb
module Sorcery module Providers # This class adds support for OAuth with vk.com. # # config.vk.key = <key> # config.vk.secret = <secret> # ... # class Vk < Base include Protocols::Oauth2 attr_accessor :auth_path, :token_path, :user_info_url, :scope def initialize...
ruby
MIT
4aaf38363eddf7a2982312ce68f0105dcc4ae8dc
2026-01-04T15:56:41.074273Z
false
NoamB/sorcery
https://github.com/NoamB/sorcery/blob/4aaf38363eddf7a2982312ce68f0105dcc4ae8dc/lib/sorcery/providers/jira.rb
lib/sorcery/providers/jira.rb
module Sorcery module Providers # This class adds support for OAuth with Jira # # config.jira.key = <key> # config.jira.secret = <secret> # ... # class Jira < Base include Protocols::Oauth attr_accessor :access_token_path, :authorize_path, :request_token_path, ...
ruby
MIT
4aaf38363eddf7a2982312ce68f0105dcc4ae8dc
2026-01-04T15:56:41.074273Z
false
NoamB/sorcery
https://github.com/NoamB/sorcery/blob/4aaf38363eddf7a2982312ce68f0105dcc4ae8dc/lib/sorcery/protocols/oauth2.rb
lib/sorcery/protocols/oauth2.rb
require 'oauth2' module Sorcery module Protocols module Oauth2 def oauth_version '2.0' end def authorize_url(options = {}) client = build_client(options) client.auth_code.authorize_url( redirect_uri: @callback_url, scope: @scope, display: ...
ruby
MIT
4aaf38363eddf7a2982312ce68f0105dcc4ae8dc
2026-01-04T15:56:41.074273Z
false
NoamB/sorcery
https://github.com/NoamB/sorcery/blob/4aaf38363eddf7a2982312ce68f0105dcc4ae8dc/lib/sorcery/protocols/oauth.rb
lib/sorcery/protocols/oauth.rb
require 'oauth' module Sorcery module Protocols module Oauth def oauth_version '1.0' end def get_request_token(token=nil,secret=nil) return ::OAuth::RequestToken.new(get_consumer, token, secret) if token && secret get_consumer.get_request_token(oauth_callback: @callbac...
ruby
MIT
4aaf38363eddf7a2982312ce68f0105dcc4ae8dc
2026-01-04T15:56:41.074273Z
false
NoamB/sorcery
https://github.com/NoamB/sorcery/blob/4aaf38363eddf7a2982312ce68f0105dcc4ae8dc/lib/sorcery/test_helpers/internal.rb
lib/sorcery/test_helpers/internal.rb
module Sorcery module TestHelpers # Internal TestHelpers are used to test the gem, internally, and should not be used to test apps *using* sorcery. # This file will be included in the spec_helper file. module Internal def self.included(base) # reducing default cost for specs speed Cr...
ruby
MIT
4aaf38363eddf7a2982312ce68f0105dcc4ae8dc
2026-01-04T15:56:41.074273Z
false
NoamB/sorcery
https://github.com/NoamB/sorcery/blob/4aaf38363eddf7a2982312ce68f0105dcc4ae8dc/lib/sorcery/test_helpers/rails/controller.rb
lib/sorcery/test_helpers/rails/controller.rb
module Sorcery module TestHelpers module Rails module Controller def login_user(user = nil, test_context = {}) user ||= @user @controller.send(:auto_login, user) @controller.send(:after_login!, user, [user.send(user.sorcery_config.username_attribute_names.first), 'secre...
ruby
MIT
4aaf38363eddf7a2982312ce68f0105dcc4ae8dc
2026-01-04T15:56:41.074273Z
false
NoamB/sorcery
https://github.com/NoamB/sorcery/blob/4aaf38363eddf7a2982312ce68f0105dcc4ae8dc/lib/sorcery/test_helpers/rails/integration.rb
lib/sorcery/test_helpers/rails/integration.rb
module Sorcery module TestHelpers module Rails module Integration #Accepts arguments for user to login, route to use and HTTP method #Defaults - @user, 'sessions_url' and POST def login_user(user = nil, route = nil, http_method = :post) user ||= @user rou...
ruby
MIT
4aaf38363eddf7a2982312ce68f0105dcc4ae8dc
2026-01-04T15:56:41.074273Z
false
NoamB/sorcery
https://github.com/NoamB/sorcery/blob/4aaf38363eddf7a2982312ce68f0105dcc4ae8dc/lib/sorcery/test_helpers/internal/rails.rb
lib/sorcery/test_helpers/internal/rails.rb
module Sorcery module TestHelpers module Internal module Rails include ::Sorcery::TestHelpers::Rails::Controller SUBMODULES_AUTO_ADDED_CONTROLLER_FILTERS = [ :register_last_activity_time_to_db, :deny_banned_user, :validate_session ] def sorcery...
ruby
MIT
4aaf38363eddf7a2982312ce68f0105dcc4ae8dc
2026-01-04T15:56:41.074273Z
false
NoamB/sorcery
https://github.com/NoamB/sorcery/blob/4aaf38363eddf7a2982312ce68f0105dcc4ae8dc/lib/sorcery/adapters/base_adapter.rb
lib/sorcery/adapters/base_adapter.rb
module Sorcery module Adapters class BaseAdapter def initialize(model) @model = model end def self.from(klass) @klass = klass self end def self.delete_all @klass.delete_all end def self.find(id) find_by_id(id) end de...
ruby
MIT
4aaf38363eddf7a2982312ce68f0105dcc4ae8dc
2026-01-04T15:56:41.074273Z
false
NoamB/sorcery
https://github.com/NoamB/sorcery/blob/4aaf38363eddf7a2982312ce68f0105dcc4ae8dc/lib/sorcery/adapters/active_record_adapter.rb
lib/sorcery/adapters/active_record_adapter.rb
module Sorcery module Adapters class ActiveRecordAdapter < BaseAdapter def update_attributes(attrs) attrs.each do |name, value| @model.send(:"#{name}=", value) end primary_key = @model.class.primary_key @model.class.where(:"#{primary_key}" => @model.send(:"#{primary...
ruby
MIT
4aaf38363eddf7a2982312ce68f0105dcc4ae8dc
2026-01-04T15:56:41.074273Z
false
NoamB/sorcery
https://github.com/NoamB/sorcery/blob/4aaf38363eddf7a2982312ce68f0105dcc4ae8dc/lib/generators/sorcery/helpers.rb
lib/generators/sorcery/helpers.rb
module Sorcery module Generators module Helpers private def sorcery_config_path "config/initializers/sorcery.rb" end # Either return the model passed in a classified form or return the default "User". def model_class_name options[:model] ? options[:model].classify :...
ruby
MIT
4aaf38363eddf7a2982312ce68f0105dcc4ae8dc
2026-01-04T15:56:41.074273Z
false
NoamB/sorcery
https://github.com/NoamB/sorcery/blob/4aaf38363eddf7a2982312ce68f0105dcc4ae8dc/lib/generators/sorcery/install_generator.rb
lib/generators/sorcery/install_generator.rb
require 'rails/generators/migration' require 'generators/sorcery/helpers' module Sorcery module Generators class InstallGenerator < Rails::Generators::Base include Rails::Generators::Migration include Sorcery::Generators::Helpers source_root File.expand_path('../templates', __FILE__) ar...
ruby
MIT
4aaf38363eddf7a2982312ce68f0105dcc4ae8dc
2026-01-04T15:56:41.074273Z
false
NoamB/sorcery
https://github.com/NoamB/sorcery/blob/4aaf38363eddf7a2982312ce68f0105dcc4ae8dc/lib/generators/sorcery/templates/initializer.rb
lib/generators/sorcery/templates/initializer.rb
# The first thing you need to configure is which modules you need in your app. # The default is nothing which will include only core features (password encryption, login/logout). # Available submodules are: :user_activation, :http_basic_auth, :remember_me, # :reset_password, :session_timeout, :brute_force_protection, :...
ruby
MIT
4aaf38363eddf7a2982312ce68f0105dcc4ae8dc
2026-01-04T15:56:41.074273Z
false
NoamB/sorcery
https://github.com/NoamB/sorcery/blob/4aaf38363eddf7a2982312ce68f0105dcc4ae8dc/lib/generators/sorcery/templates/migration/core.rb
lib/generators/sorcery/templates/migration/core.rb
class SorceryCore < <%= migration_class_name %> def change create_table :<%= model_class_name.tableize %> do |t| t.string :email, :null => false t.string :crypted_password t.string :salt t.timestamps :null => false end add_index :<%= model_class_name.tab...
ruby
MIT
4aaf38363eddf7a2982312ce68f0105dcc4ae8dc
2026-01-04T15:56:41.074273Z
false
NoamB/sorcery
https://github.com/NoamB/sorcery/blob/4aaf38363eddf7a2982312ce68f0105dcc4ae8dc/lib/generators/sorcery/templates/migration/external.rb
lib/generators/sorcery/templates/migration/external.rb
class SorceryExternal < <%= migration_class_name %> def change create_table :authentications do |t| t.integer :<%= model_class_name.tableize.singularize %>_id, :null => false t.string :provider, :uid, :null => false t.timestamps :null => false end add_index :authentication...
ruby
MIT
4aaf38363eddf7a2982312ce68f0105dcc4ae8dc
2026-01-04T15:56:41.074273Z
false
NoamB/sorcery
https://github.com/NoamB/sorcery/blob/4aaf38363eddf7a2982312ce68f0105dcc4ae8dc/lib/generators/sorcery/templates/migration/user_activation.rb
lib/generators/sorcery/templates/migration/user_activation.rb
class SorceryUserActivation < <%= migration_class_name %> def change add_column :<%= model_class_name.tableize %>, :activation_state, :string, :default => nil add_column :<%= model_class_name.tableize %>, :activation_token, :string, :default => nil add_column :<%= model_class_name.tableize %>, :activation...
ruby
MIT
4aaf38363eddf7a2982312ce68f0105dcc4ae8dc
2026-01-04T15:56:41.074273Z
false
NoamB/sorcery
https://github.com/NoamB/sorcery/blob/4aaf38363eddf7a2982312ce68f0105dcc4ae8dc/lib/generators/sorcery/templates/migration/brute_force_protection.rb
lib/generators/sorcery/templates/migration/brute_force_protection.rb
class SorceryBruteForceProtection < <%= migration_class_name %> def change add_column :<%= model_class_name.tableize %>, :failed_logins_count, :integer, :default => 0 add_column :<%= model_class_name.tableize %>, :lock_expires_at, :datetime, :default => nil add_column :<%= model_class_name.tableize %>, :u...
ruby
MIT
4aaf38363eddf7a2982312ce68f0105dcc4ae8dc
2026-01-04T15:56:41.074273Z
false
NoamB/sorcery
https://github.com/NoamB/sorcery/blob/4aaf38363eddf7a2982312ce68f0105dcc4ae8dc/lib/generators/sorcery/templates/migration/reset_password.rb
lib/generators/sorcery/templates/migration/reset_password.rb
class SorceryResetPassword < <%= migration_class_name %> def change add_column :<%= model_class_name.tableize %>, :reset_password_token, :string, :default => nil add_column :<%= model_class_name.tableize %>, :reset_password_token_expires_at, :datetime, :default => nil add_column :<%= model_class_name.tabl...
ruby
MIT
4aaf38363eddf7a2982312ce68f0105dcc4ae8dc
2026-01-04T15:56:41.074273Z
false
NoamB/sorcery
https://github.com/NoamB/sorcery/blob/4aaf38363eddf7a2982312ce68f0105dcc4ae8dc/lib/generators/sorcery/templates/migration/activity_logging.rb
lib/generators/sorcery/templates/migration/activity_logging.rb
class SorceryActivityLogging < <%= migration_class_name %> def change add_column :<%= model_class_name.tableize %>, :last_login_at, :datetime, :default => nil add_column :<%= model_class_name.tableize %>, :last_logout_at, :datetime, :default => nil add_column :<%= model_class_name.tableize %>, :las...
ruby
MIT
4aaf38363eddf7a2982312ce68f0105dcc4ae8dc
2026-01-04T15:56:41.074273Z
false
NoamB/sorcery
https://github.com/NoamB/sorcery/blob/4aaf38363eddf7a2982312ce68f0105dcc4ae8dc/lib/generators/sorcery/templates/migration/remember_me.rb
lib/generators/sorcery/templates/migration/remember_me.rb
class SorceryRememberMe < <%= migration_class_name %> def change add_column :<%= model_class_name.tableize %>, :remember_me_token, :string, :default => nil add_column :<%= model_class_name.tableize %>, :remember_me_token_expires_at, :datetime, :default => nil add_index :<%= model_class_name.tableize %>, ...
ruby
MIT
4aaf38363eddf7a2982312ce68f0105dcc4ae8dc
2026-01-04T15:56:41.074273Z
false
que-rb/que
https://github.com/que-rb/que/blob/caa8b25cdd9da7fa74d27532ad6acf0a8c23f115/tasks/spec.rb
tasks/spec.rb
# frozen_string_literal: true require 'rake' require 'rake/testtask' Rake::TestTask.new :test do |t| t.libs = ['spec'] t.pattern = '*/**/*_spec.rb' end task default: :test task spec: :test
ruby
MIT
caa8b25cdd9da7fa74d27532ad6acf0a8c23f115
2026-01-04T15:56:36.969030Z
false
que-rb/que
https://github.com/que-rb/que/blob/caa8b25cdd9da7fa74d27532ad6acf0a8c23f115/tasks/safe_shutdown.rb
tasks/safe_shutdown.rb
# frozen_string_literal: true # This task is used to test Que's behavior when its process is shut down. # The situation we're trying to avoid occurs when the process dies while a job # is in the middle of a transaction - ideally, the transaction would be rolled # back and the job could just be reattempted later, but ...
ruby
MIT
caa8b25cdd9da7fa74d27532ad6acf0a8c23f115
2026-01-04T15:56:36.969030Z
false
que-rb/que
https://github.com/que-rb/que/blob/caa8b25cdd9da7fa74d27532ad6acf0a8c23f115/spec/que_spec.rb
spec/que_spec.rb
# frozen_string_literal: true require 'spec_helper' describe Que do describe ".default_queue" do it "should default to 'default'" do assert_equal 'default', Que.default_queue end it "should be overridable, and then revert to the default if set to nil" do assert_equal 'default', Que.default_...
ruby
MIT
caa8b25cdd9da7fa74d27532ad6acf0a8c23f115
2026-01-04T15:56:36.969030Z
false
que-rb/que
https://github.com/que-rb/que/blob/caa8b25cdd9da7fa74d27532ad6acf0a8c23f115/spec/spec_helper.rb
spec/spec_helper.rb
# frozen_string_literal: true # Silence Ruby warnings. $VERBOSE = nil require 'que' # ActiveRecord and ActiveJob require ActiveSupport, which affects a bunch of # core classes and may change some behavior that we rely on, so only bring it in # in some spec runs. if ENV['USE_RAILS'] == 'true' require 'logger' req...
ruby
MIT
caa8b25cdd9da7fa74d27532ad6acf0a8c23f115
2026-01-04T15:56:36.969030Z
false
que-rb/que
https://github.com/que-rb/que/blob/caa8b25cdd9da7fa74d27532ad6acf0a8c23f115/spec/support/dummy_logger.rb
spec/support/dummy_logger.rb
# frozen_string_literal: true class DummyLogger attr_reader :messages, :messages_with_levels def initialize @messages = [] @messages_with_levels = [] end [:debug, :info, :warn, :error, :fatal, :unknown].each do |level| define_method level do |message| messages << message messages_with...
ruby
MIT
caa8b25cdd9da7fa74d27532ad6acf0a8c23f115
2026-01-04T15:56:36.969030Z
false
que-rb/que
https://github.com/que-rb/que/blob/caa8b25cdd9da7fa74d27532ad6acf0a8c23f115/spec/support/jobs/args_job.rb
spec/support/jobs/args_job.rb
# frozen_string_literal: true class ArgsJob < Que::Job def run(*args) $passed_args = args end end
ruby
MIT
caa8b25cdd9da7fa74d27532ad6acf0a8c23f115
2026-01-04T15:56:36.969030Z
false
que-rb/que
https://github.com/que-rb/que/blob/caa8b25cdd9da7fa74d27532ad6acf0a8c23f115/spec/support/jobs/namespaced_job.rb
spec/support/jobs/namespaced_job.rb
# frozen_string_literal: true module NamespacedJobNamespace class NamespacedJob < Que::Job end end
ruby
MIT
caa8b25cdd9da7fa74d27532ad6acf0a8c23f115
2026-01-04T15:56:36.969030Z
false
que-rb/que
https://github.com/que-rb/que/blob/caa8b25cdd9da7fa74d27532ad6acf0a8c23f115/spec/support/jobs/error_job.rb
spec/support/jobs/error_job.rb
# frozen_string_literal: true class ErrorJob < Que::Job def run raise "ErrorJob!" end end
ruby
MIT
caa8b25cdd9da7fa74d27532ad6acf0a8c23f115
2026-01-04T15:56:36.969030Z
false
que-rb/que
https://github.com/que-rb/que/blob/caa8b25cdd9da7fa74d27532ad6acf0a8c23f115/spec/support/jobs/block_job.rb
spec/support/jobs/block_job.rb
# frozen_string_literal: true # Handy for blocking in the middle of processing a job. class BlockJob < Que::Job def run $q1.push nil $q2.pop end end
ruby
MIT
caa8b25cdd9da7fa74d27532ad6acf0a8c23f115
2026-01-04T15:56:36.969030Z
false
que-rb/que
https://github.com/que-rb/que/blob/caa8b25cdd9da7fa74d27532ad6acf0a8c23f115/spec/que/metajob_spec.rb
spec/que/metajob_spec.rb
# frozen_string_literal: true require 'spec_helper' describe Que::Metajob do describe "<=>" do it "should sort appropriately" do old = Time.now - 30 now = Time.now metajobs = [ {priority: 1, run_at: old, id: 1}, {priority: 1, run_at: old, id: 2}, {priorit...
ruby
MIT
caa8b25cdd9da7fa74d27532ad6acf0a8c23f115
2026-01-04T15:56:36.969030Z
false
que-rb/que
https://github.com/que-rb/que/blob/caa8b25cdd9da7fa74d27532ad6acf0a8c23f115/spec/que/command_line_interface_spec.rb
spec/que/command_line_interface_spec.rb
# frozen_string_literal: true require 'spec_helper' require 'digest/md5' require 'que/command_line_interface' describe Que::CommandLineInterface do LOADED_FILES = {} around do |&block| super() do # Let the CLI set the logger if it needs to. Que.logger = nil block.call $stop_que_exe...
ruby
MIT
caa8b25cdd9da7fa74d27532ad6acf0a8c23f115
2026-01-04T15:56:36.969030Z
false
que-rb/que
https://github.com/que-rb/que/blob/caa8b25cdd9da7fa74d27532ad6acf0a8c23f115/spec/que/listener_spec.rb
spec/que/listener_spec.rb
# frozen_string_literal: true require 'spec_helper' describe Que::Listener do attr_reader :connection let :listener do Que::Listener.new(connection: connection) end let :message_1 do { queue: 'queue_name', priority: 90, run_at: "2017-06-30T18:33:33.402669Z", id: 44, } e...
ruby
MIT
caa8b25cdd9da7fa74d27532ad6acf0a8c23f115
2026-01-04T15:56:36.969030Z
false
que-rb/que
https://github.com/que-rb/que/blob/caa8b25cdd9da7fa74d27532ad6acf0a8c23f115/spec/que/migrations.state_trigger_spec.rb
spec/que/migrations.state_trigger_spec.rb
# frozen_string_literal: true require 'spec_helper' describe Que::Migrations, "que_state trigger" do attr_reader :connection around do |&block| super() do DEFAULT_QUE_POOL.checkout do |conn| begin @connection = conn conn.execute "LISTEN que_state" block.call ...
ruby
MIT
caa8b25cdd9da7fa74d27532ad6acf0a8c23f115
2026-01-04T15:56:36.969030Z
false
que-rb/que
https://github.com/que-rb/que/blob/caa8b25cdd9da7fa74d27532ad6acf0a8c23f115/spec/que/job_buffer_spec.rb
spec/que/job_buffer_spec.rb
# frozen_string_literal: true require 'spec_helper' describe Que::JobBuffer do let(:now) { Time.now } let(:old) { now - 50 } let :job_buffer do Que::JobBuffer.new( maximum_size: maximum_size, priorities: [10, 30, 50, nil].shuffle, ) end let(:maximum_size) { 8 } let :job_array do ...
ruby
MIT
caa8b25cdd9da7fa74d27532ad6acf0a8c23f115
2026-01-04T15:56:36.969030Z
false
que-rb/que
https://github.com/que-rb/que/blob/caa8b25cdd9da7fa74d27532ad6acf0a8c23f115/spec/que/migrations.current_schema_spec.rb
spec/que/migrations.current_schema_spec.rb
# frozen_string_literal: true require 'spec_helper' describe Que::Migrations, "current schema" do def assert_constraint_error(name, &block) e = assert_raises(Sequel::CheckConstraintViolation, &block) assert_includes e.message, "violates check constraint \"#{name}\"" end describe "que_jobs table constra...
ruby
MIT
caa8b25cdd9da7fa74d27532ad6acf0a8c23f115
2026-01-04T15:56:36.969030Z
false
que-rb/que
https://github.com/que-rb/que/blob/caa8b25cdd9da7fa74d27532ad6acf0a8c23f115/spec/que/job.run_synchronously_spec.rb
spec/que/job.run_synchronously_spec.rb
# frozen_string_literal: true require 'spec_helper' describe Que::Job, "run_synchronously=" do describe "on the base class" do before { Que::Job.run_synchronously = true } after { Que::Job.remove_instance_variable(:@run_synchronously) } it "should cause jobs to be worked synchronously" do assert...
ruby
MIT
caa8b25cdd9da7fa74d27532ad6acf0a8c23f115
2026-01-04T15:56:36.969030Z
false
que-rb/que
https://github.com/que-rb/que/blob/caa8b25cdd9da7fa74d27532ad6acf0a8c23f115/spec/que/job_buffer.available_priorities_spec.rb
spec/que/job_buffer.available_priorities_spec.rb
# frozen_string_literal: true require 'spec_helper' describe Que::JobBuffer, "available_priorities" do class DummyWorker attr_reader :thread def initialize(priority:, job_buffer:) @thread = Thread.new do job_buffer.shift(priority) end end def kill @thread.kill end e...
ruby
MIT
caa8b25cdd9da7fa74d27532ad6acf0a8c23f115
2026-01-04T15:56:36.969030Z
false
que-rb/que
https://github.com/que-rb/que/blob/caa8b25cdd9da7fa74d27532ad6acf0a8c23f115/spec/que/connection_pool_spec.rb
spec/que/connection_pool_spec.rb
# frozen_string_literal: true require 'spec_helper' describe Que::ConnectionPool do # Some linting specs for all the pools we support natively. QUE_POOLS.each do |name, pool| describe "for a #{name} pool" do describe ".checkout" do it "should yield a Connection object" do pool.checkout...
ruby
MIT
caa8b25cdd9da7fa74d27532ad6acf0a8c23f115
2026-01-04T15:56:36.969030Z
false
que-rb/que
https://github.com/que-rb/que/blob/caa8b25cdd9da7fa74d27532ad6acf0a8c23f115/spec/que/locker_spec.rb
spec/que/locker_spec.rb
# frozen_string_literal: true require 'spec_helper' describe Que::Locker do describe "when starting up" do def assert_que_locker_insertion( listen: true, queues: [Que::DEFAULT_QUEUE], worker_priorities: [10, 30, 50, nil, nil, nil] ) assert_equal 0, DB[:que_l...
ruby
MIT
caa8b25cdd9da7fa74d27532ad6acf0a8c23f115
2026-01-04T15:56:36.969030Z
false
que-rb/que
https://github.com/que-rb/que/blob/caa8b25cdd9da7fa74d27532ad6acf0a8c23f115/spec/que/job.enqueue_spec.rb
spec/que/job.enqueue_spec.rb
# frozen_string_literal: true require 'spec_helper' describe Que::Job, '.enqueue' do def assert_enqueue( expected_queue: 'default', expected_priority: 100, expected_run_at: Time.now, expected_job_class: Que::Job, expected_result_class: nil, expected_args: [], expected_kwargs: {}, exp...
ruby
MIT
caa8b25cdd9da7fa74d27532ad6acf0a8c23f115
2026-01-04T15:56:36.969030Z
false
que-rb/que
https://github.com/que-rb/que/blob/caa8b25cdd9da7fa74d27532ad6acf0a8c23f115/spec/que/worker_spec.rb
spec/que/worker_spec.rb
# frozen_string_literal: true require 'spec_helper' describe Que::Worker do let :priority do nil end let :worker do Que::Worker.new( priority: priority, job_buffer: job_buffer, result_queue: result_queue, ) end let :notified_errors do [] end before do work...
ruby
MIT
caa8b25cdd9da7fa74d27532ad6acf0a8c23f115
2026-01-04T15:56:36.969030Z
false
que-rb/que
https://github.com/que-rb/que/blob/caa8b25cdd9da7fa74d27532ad6acf0a8c23f115/spec/que/connection_spec.rb
spec/que/connection_spec.rb
# frozen_string_literal: true require 'spec_helper' describe Que::Connection do QUE_POOLS.each do |name, pool| describe "with a #{name} connection pool" do let(:connection) { @connection } around do |&block| super() do pool.checkout do |conn| @connection = conn ...
ruby
MIT
caa8b25cdd9da7fa74d27532ad6acf0a8c23f115
2026-01-04T15:56:36.969030Z
false
que-rb/que
https://github.com/que-rb/que/blob/caa8b25cdd9da7fa74d27532ad6acf0a8c23f115/spec/que/poller_spec.rb
spec/que/poller_spec.rb
# frozen_string_literal: true require 'spec_helper' describe Que::Poller do let :connection do Que::Connection.wrap(EXTRA_PG_CONNECTION) end def held_advisory_locks(override_connection: nil) ids = (override_connection || connection).execute <<-SQL SELECT ((classid::bigint << 32) + objid::...
ruby
MIT
caa8b25cdd9da7fa74d27532ad6acf0a8c23f115
2026-01-04T15:56:36.969030Z
false
que-rb/que
https://github.com/que-rb/que/blob/caa8b25cdd9da7fa74d27532ad6acf0a8c23f115/spec/que/migrations_spec.rb
spec/que/migrations_spec.rb
# frozen_string_literal: true require 'spec_helper' describe Que::Migrations do it "should be able to perform migrations up and down" do # Migration #1 creates the table with a priority default of 1, migration # #2 ups that to 100. default = proc do result = Que.execute <<-SQL select pg_g...
ruby
MIT
caa8b25cdd9da7fa74d27532ad6acf0a8c23f115
2026-01-04T15:56:36.969030Z
false
que-rb/que
https://github.com/que-rb/que/blob/caa8b25cdd9da7fa74d27532ad6acf0a8c23f115/spec/que/job_spec.rb
spec/que/job_spec.rb
# frozen_string_literal: true require 'spec_helper' describe Que::Job do let(:notified_errors) { [] } before do Que.error_notifier = proc { |e| notified_errors << e } class TestJobClass < Que::Job def run(*args, **kwargs) $args = args $kwargs = kwargs end end end aft...
ruby
MIT
caa8b25cdd9da7fa74d27532ad6acf0a8c23f115
2026-01-04T15:56:36.969030Z
false
que-rb/que
https://github.com/que-rb/que/blob/caa8b25cdd9da7fa74d27532ad6acf0a8c23f115/spec/que/migrations.work_job_trigger_spec.rb
spec/que/migrations.work_job_trigger_spec.rb
# frozen_string_literal: true require 'spec_helper' describe Que::Migrations, "job_available trigger" do let :locker_attrs do { pid: 1, worker_count: 4, worker_priorities: Sequel.pg_array([1, 2, 3, 4], :integer), ruby_pid: Process.pid, ruby_hostname:...
ruby
MIT
caa8b25cdd9da7fa74d27532ad6acf0a8c23f115
2026-01-04T15:56:36.969030Z
false
que-rb/que
https://github.com/que-rb/que/blob/caa8b25cdd9da7fa74d27532ad6acf0a8c23f115/spec/que/result_queue_spec.rb
spec/que/result_queue_spec.rb
# frozen_string_literal: true require 'spec_helper' describe Que::ResultQueue do let :result_queue do Que::ResultQueue.new end describe "push" do it "should add items to the result queue in a thread-safe manner" do ids = (1..100).to_a.shuffle result_queue # Initialize before it's accessed b...
ruby
MIT
caa8b25cdd9da7fa74d27532ad6acf0a8c23f115
2026-01-04T15:56:36.969030Z
false
que-rb/que
https://github.com/que-rb/que/blob/caa8b25cdd9da7fa74d27532ad6acf0a8c23f115/spec/que/job.bulk_enqueue_spec.rb
spec/que/job.bulk_enqueue_spec.rb
# frozen_string_literal: true require 'spec_helper' describe Que::Job, '.bulk_enqueue' do def assert_enqueue( expected_queue: 'default', expected_priority: 100, expected_run_at: Time.now, expected_job_class: Que::Job, expected_result_class: nil, expected_args:, expected_kwargs:, expe...
ruby
MIT
caa8b25cdd9da7fa74d27532ad6acf0a8c23f115
2026-01-04T15:56:36.969030Z
false
que-rb/que
https://github.com/que-rb/que/blob/caa8b25cdd9da7fa74d27532ad6acf0a8c23f115/spec/que/sequel/model_spec.rb
spec/que/sequel/model_spec.rb
# frozen_string_literal: true require 'spec_helper' describe 'Que::Sequel::Model' do before do require "que/sequel/model" end ruby2_keywords def enqueue_job(*args) Que::Job.enqueue(*args).que_attrs[:id] end def assert_ids(*expected) actual = yield(Que::Sequel::Model).select_order_map(:id) ...
ruby
MIT
caa8b25cdd9da7fa74d27532ad6acf0a8c23f115
2026-01-04T15:56:36.969030Z
false
que-rb/que
https://github.com/que-rb/que/blob/caa8b25cdd9da7fa74d27532ad6acf0a8c23f115/spec/que/utils/json_serialization_spec.rb
spec/que/utils/json_serialization_spec.rb
# frozen_string_literal: true require 'spec_helper' describe Que::Utils::JSONSerialization do describe "serialize_json" do it "should convert a hash to JSON" do assert_equal( "{\"blah\":3}", Que.serialize_json({blah: 3}), ) end it "should convert an array to JSON" do a...
ruby
MIT
caa8b25cdd9da7fa74d27532ad6acf0a8c23f115
2026-01-04T15:56:36.969030Z
false
que-rb/que
https://github.com/que-rb/que/blob/caa8b25cdd9da7fa74d27532ad6acf0a8c23f115/spec/que/utils/error_notification_spec.rb
spec/que/utils/error_notification_spec.rb
# frozen_string_literal: true require 'spec_helper' describe Que::Utils::ErrorNotification do describe "notify_error" do it "should pass the args to the error notification proc" do passed = nil Que.error_notifier = proc { |*args| passed = args; :blah } assert_equal :blah, Que.notify_error(1) ...
ruby
MIT
caa8b25cdd9da7fa74d27532ad6acf0a8c23f115
2026-01-04T15:56:36.969030Z
false
que-rb/que
https://github.com/que-rb/que/blob/caa8b25cdd9da7fa74d27532ad6acf0a8c23f115/spec/que/utils/constantization_spec.rb
spec/que/utils/constantization_spec.rb
# frozen_string_literal: true require 'spec_helper' describe Que::Utils::Constantization do describe "constantize" do def assert_constantization(expected, string) actual = Que.constantize(string) assert_equal expected, actual end if !defined?(ActiveRecord) # This spec, which defines a...
ruby
MIT
caa8b25cdd9da7fa74d27532ad6acf0a8c23f115
2026-01-04T15:56:36.969030Z
false
que-rb/que
https://github.com/que-rb/que/blob/caa8b25cdd9da7fa74d27532ad6acf0a8c23f115/spec/que/utils/queue_management_spec.rb
spec/que/utils/queue_management_spec.rb
# frozen_string_literal: true require 'spec_helper' describe Que::Utils::QueueManagement do describe "clear!" do it "should clear all jobs from the queue" do jobs_dataset.insert(job_class: "Que::Job", job_schema_version: Que.job_schema_version) assert_equal 1, jobs_dataset.count Que.clear! ...
ruby
MIT
caa8b25cdd9da7fa74d27532ad6acf0a8c23f115
2026-01-04T15:56:36.969030Z
false
que-rb/que
https://github.com/que-rb/que/blob/caa8b25cdd9da7fa74d27532ad6acf0a8c23f115/spec/que/utils/middleware_spec.rb
spec/que/utils/middleware_spec.rb
# frozen_string_literal: true require 'spec_helper' describe Que::Utils::Middleware do describe "run_job_middleware" do it "when no job_middleware are defined should just run the block" do order = [] Que.run_job_middleware(nil) { order << :called_block } assert_equal [:called_block], order ...
ruby
MIT
caa8b25cdd9da7fa74d27532ad6acf0a8c23f115
2026-01-04T15:56:36.969030Z
false
que-rb/que
https://github.com/que-rb/que/blob/caa8b25cdd9da7fa74d27532ad6acf0a8c23f115/spec/que/utils/freeze_spec.rb
spec/que/utils/freeze_spec.rb
# frozen_string_literal: true require 'spec_helper' describe Que::Utils::Freeze do describe 'recursively_freeze' do it "should freeze whatever it's given" do sub_hash = {blah: 1} sub_array = [1, 2, 3] sub_string = 'blah'.dup input = [{hash: sub_hash, array: sub_array, string: sub...
ruby
MIT
caa8b25cdd9da7fa74d27532ad6acf0a8c23f115
2026-01-04T15:56:36.969030Z
false
que-rb/que
https://github.com/que-rb/que/blob/caa8b25cdd9da7fa74d27532ad6acf0a8c23f115/spec/que/utils/logging_spec.rb
spec/que/utils/logging_spec.rb
# frozen_string_literal: true require 'spec_helper' describe Que::Utils::Logging do describe "log" do it "should record the library and hostname and thread id in JSON" do Que.log event: :blah, source: 4 assert_equal 1, QUE_LOGGER.messages.count message = JSON.load(QUE_LOGGER.messages.first) ...
ruby
MIT
caa8b25cdd9da7fa74d27532ad6acf0a8c23f115
2026-01-04T15:56:36.969030Z
false
que-rb/que
https://github.com/que-rb/que/blob/caa8b25cdd9da7fa74d27532ad6acf0a8c23f115/spec/que/utils/ruby2_keywords_spec.rb
spec/que/utils/ruby2_keywords_spec.rb
# frozen_string_literal: true require 'spec_helper' describe Que::Utils::Ruby2Keywords do describe "split_out_ruby2_keywords" do describe "when last argument is not a hash" do let(:args_splat) { ["string"] } it "does not split arguments" do args, kwargs = Que.split_out_ruby2_keywords(args_s...
ruby
MIT
caa8b25cdd9da7fa74d27532ad6acf0a8c23f115
2026-01-04T15:56:36.969030Z
false
que-rb/que
https://github.com/que-rb/que/blob/caa8b25cdd9da7fa74d27532ad6acf0a8c23f115/spec/que/utils/transactions_spec.rb
spec/que/utils/transactions_spec.rb
# frozen_string_literal: true require 'spec_helper' describe Que::Utils::Transactions do it "should be able to commit the transaction successfully" do refute Que.in_transaction? Que.transaction do assert Que.in_transaction? Que.execute "INSERT INTO que_jobs (job_class, job_schema_version) VALUES...
ruby
MIT
caa8b25cdd9da7fa74d27532ad6acf0a8c23f115
2026-01-04T15:56:36.969030Z
false
que-rb/que
https://github.com/que-rb/que/blob/caa8b25cdd9da7fa74d27532ad6acf0a8c23f115/spec/que/utils/introspection_spec.rb
spec/que/utils/introspection_spec.rb
# frozen_string_literal: true require 'spec_helper' describe Que::Utils::Introspection do describe 'job_stats' do it "should return a list of the unfinished job types in the queue" do BlockJob.enqueue 3.times { Que::Job.enqueue } # Mark one job as finished, it shouldn't show up in the aggrega...
ruby
MIT
caa8b25cdd9da7fa74d27532ad6acf0a8c23f115
2026-01-04T15:56:36.969030Z
false
que-rb/que
https://github.com/que-rb/que/blob/caa8b25cdd9da7fa74d27532ad6acf0a8c23f115/spec/que/utils/assertions_spec.rb
spec/que/utils/assertions_spec.rb
# frozen_string_literal: true require 'spec_helper' describe Que::Utils::Assertions do def assert_assertion_passes(*args, &block) assert_equal true, Que.assert?(*args, &block) if (v = args.last).nil? assert_nil Que.assert(*args, &block) else assert_equal v, Que.assert(*args, &block) end...
ruby
MIT
caa8b25cdd9da7fa74d27532ad6acf0a8c23f115
2026-01-04T15:56:36.969030Z
false
que-rb/que
https://github.com/que-rb/que/blob/caa8b25cdd9da7fa74d27532ad6acf0a8c23f115/spec/que/active_record/model_spec.rb
spec/que/active_record/model_spec.rb
# frozen_string_literal: true require 'spec_helper' if defined?(::ActiveRecord) describe 'Que::ActiveRecord::Model' do before do require "que/active_record/model" end def enqueue_job(*args, **kwargs) Que::Job.enqueue(*args, **kwargs).que_attrs[:id] end def assert_ids(*expected) ...
ruby
MIT
caa8b25cdd9da7fa74d27532ad6acf0a8c23f115
2026-01-04T15:56:36.969030Z
false