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 |
|---|---|---|---|---|---|---|---|---|
rails/rails-contributors | https://github.com/rails/rails-contributors/blob/dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9/config/application.rb | config/application.rb | require_relative "boot"
require "rails"
# Pick the frameworks you want:
require "active_model/railtie"
# require "active_job/railtie"
require "active_record/railtie"
# require "active_storage/engine"
require "action_controller/railtie"
# require "action_mailer/railtie"
# require "action_mailbox/engine"
# require "acti... | ruby | MIT | dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9 | 2026-01-04T17:44:10.559232Z | false |
rails/rails-contributors | https://github.com/rails/rails-contributors/blob/dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9/config/environment.rb | config/environment.rb | # Load the Rails application.
require_relative "application"
# Initialize the Rails application.
Rails.application.initialize!
| ruby | MIT | dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9 | 2026-01-04T17:44:10.559232Z | false |
rails/rails-contributors | https://github.com/rails/rails-contributors/blob/dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9/config/puma.rb | config/puma.rb | # This configuration file will be evaluated by Puma. The top-level methods that
# are invoked here are part of Puma's configuration DSL. For more information
# about methods provided by the DSL, see https://puma.io/puma/Puma/DSL.html.
#
# Puma starts a configurable number of processes (workers) and each process
# serve... | ruby | MIT | dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9 | 2026-01-04T17:44:10.559232Z | false |
rails/rails-contributors | https://github.com/rails/rails-contributors/blob/dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9/config/routes.rb | config/routes.rb | Rails.application.routes.draw do
get 'contributors/in-time-window/:time_window' => 'contributors#in_time_window', as: 'contributors_in_time_window'
resources :contributors, only: 'index' do
get 'commits/in-time-window/:time_window' => 'commits#in_time_window', as: 'commits_in_time_window'
get 'commits/in-r... | ruby | MIT | dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9 | 2026-01-04T17:44:10.559232Z | false |
rails/rails-contributors | https://github.com/rails/rails-contributors/blob/dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9/config/deploy.rb | config/deploy.rb | lock '~> 3.10'
set :application, 'rails-contributors'
set :branch, 'main'
set :repo_url, 'https://github.com/rails/rails-contributors.git'
set :deploy_to, '/home/rails/rails-contributors'
set :log_level, :info
set :linked_files, %w{config/database.yml config/master.key}
set :linked_dirs, %w{log tmp/pids tmp/cache t... | ruby | MIT | dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9 | 2026-01-04T17:44:10.559232Z | false |
rails/rails-contributors | https://github.com/rails/rails-contributors/blob/dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9/config/boot.rb | config/boot.rb | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
require "bundler/setup" # Set up gems listed in the Gemfile.
| ruby | MIT | dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9 | 2026-01-04T17:44:10.559232Z | false |
rails/rails-contributors | https://github.com/rails/rails-contributors/blob/dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9/config/initializers/content_security_policy.rb | config/initializers/content_security_policy.rb | # Be sure to restart your server when you modify this file.
# Define an application-wide content security policy.
# See the Securing Rails Applications Guide for more information:
# https://guides.rubyonrails.org/security.html#content-security-policy-header
# Rails.application.configure do
# config.content_security... | ruby | MIT | dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9 | 2026-01-04T17:44:10.559232Z | false |
rails/rails-contributors | https://github.com/rails/rails-contributors/blob/dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9/config/initializers/filter_parameter_logging.rb | config/initializers/filter_parameter_logging.rb | # Be sure to restart your server when you modify this file.
# Configure parameters to be partially matched (e.g. passw matches password) and filtered from the log file.
# Use this to limit dissemination of sensitive information.
# See the ActiveSupport::ParameterFilter documentation for supported notations and behavio... | ruby | MIT | dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9 | 2026-01-04T17:44:10.559232Z | false |
rails/rails-contributors | https://github.com/rails/rails-contributors/blob/dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9/config/initializers/application_controller_renderer.rb | config/initializers/application_controller_renderer.rb | # Be sure to restart your server when you modify this file.
# ActiveSupport::Reloader.to_prepare do
# ApplicationController.renderer.defaults.merge!(
# http_host: 'example.org',
# https: false
# )
# end
| ruby | MIT | dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9 | 2026-01-04T17:44:10.559232Z | false |
rails/rails-contributors | https://github.com/rails/rails-contributors/blob/dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9/config/initializers/core_extensions.rb | config/initializers/core_extensions.rb | UNF_NORMALIZER = UNF::Normalizer.new
module StringExtensions
def parameterize
super.gsub('ß', 'ss').gsub('ø', 'o')
end
def nfc
UNF_NORMALIZER.normalize(self, :nfc)
end
end
String.prepend(StringExtensions)
| ruby | MIT | dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9 | 2026-01-04T17:44:10.559232Z | false |
rails/rails-contributors | https://github.com/rails/rails-contributors/blob/dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9/config/initializers/new_framework_defaults_8_1.rb | config/initializers/new_framework_defaults_8_1.rb | # Be sure to restart your server when you modify this file.
#
# This file eases your Rails 8.1 framework defaults upgrade.
#
# Uncomment each configuration one by one to switch to the new default.
# Once your application is ready to run with all new defaults, you can remove
# this file and set the `config.load_defaults... | ruby | MIT | dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9 | 2026-01-04T17:44:10.559232Z | false |
rails/rails-contributors | https://github.com/rails/rails-contributors/blob/dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9/config/initializers/page_cache_logger.rb | config/initializers/page_cache_logger.rb | ActiveSupport::Notifications.subscribe("write_page.action_controller") do |event|
Rails.logger.info "Page cached: #{event.payload[:path]}"
end
ActiveSupport::Notifications.subscribe("expire_page.action_controller") do |event|
Rails.logger.info "Page expired: #{event.payload[:path]}"
end
| ruby | MIT | dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9 | 2026-01-04T17:44:10.559232Z | false |
rails/rails-contributors | https://github.com/rails/rails-contributors/blob/dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9/config/initializers/nfc_attribute_normalization.rb | config/initializers/nfc_attribute_normalization.rb | require 'nfc_attribute_normalizer'
class ActiveRecord::Base
extend NFCAttributeNormalizer
end | ruby | MIT | dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9 | 2026-01-04T17:44:10.559232Z | false |
rails/rails-contributors | https://github.com/rails/rails-contributors/blob/dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9/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 | dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9 | 2026-01-04T17:44:10.559232Z | false |
rails/rails-contributors | https://github.com/rails/rails-contributors/blob/dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9/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 | dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9 | 2026-01-04T17:44:10.559232Z | false |
rails/rails-contributors | https://github.com/rails/rails-contributors/blob/dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9/config/initializers/permissions_policy.rb | config/initializers/permissions_policy.rb | # Be sure to restart your server when you modify this file.
# Define an application-wide HTTP permissions policy. For further
# information see: https://developers.google.com/web/updates/2018/06/feature-policy
# Rails.application.config.permissions_policy do |policy|
# policy.camera :none
# policy.gyroscope ... | ruby | MIT | dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9 | 2026-01-04T17:44:10.559232Z | false |
rails/rails-contributors | https://github.com/rails/rails-contributors/blob/dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9/config/initializers/ensure_rails_git_is_cloned.rb | config/initializers/ensure_rails_git_is_cloned.rb | RAILS_GIT = "#{Rails.root}/rails.git"
unless Dir.exist?(RAILS_GIT)
puts <<~EOS
Please, mirror the Rails repository using the command
git clone --mirror https://github.com/rails/rails.git
from the host computer.
Once that is done, if you want to run the website please
populate the database wi... | ruby | MIT | dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9 | 2026-01-04T17:44:10.559232Z | false |
rails/rails-contributors | https://github.com/rails/rails-contributors/blob/dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9/config/initializers/assets.rb | config/initializers/assets.rb | # Be sure to restart your server when you modify this file.
# Version of your assets, change this if you want to expire all your assets.
Rails.application.config.assets.version = "1.0"
# Add additional assets to the asset load path.
# Rails.application.config.assets.paths << Emoji.images_path
| ruby | MIT | dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9 | 2026-01-04T17:44:10.559232Z | false |
rails/rails-contributors | https://github.com/rails/rails-contributors/blob/dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9/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| /my_noisy_library/.match?(line) }
# You can also remove all the silencers if you're trying to debug a ... | ruby | MIT | dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9 | 2026-01-04T17:44:10.559232Z | false |
rails/rails-contributors | https://github.com/rails/rails-contributors/blob/dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9/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
| ruby | MIT | dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9 | 2026-01-04T17:44:10.559232Z | false |
rails/rails-contributors | https://github.com/rails/rails-contributors/blob/dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9/config/puma/production.rb | config/puma/production.rb | #!/usr/bin/env puma
shared_path = "/home/rails/rails-contributors/shared"
directory '/home/rails/rails-contributors/current'
rackup "/home/rails/rails-contributors/current/config.ru"
environment 'production'
pidfile "#{shared_path}/tmp/pids/puma.pid"
state_path "#{shared_path}/tmp/pids/puma.state"
workers 2
threads... | ruby | MIT | dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9 | 2026-01-04T17:44:10.559232Z | false |
rails/rails-contributors | https://github.com/rails/rails-contributors/blob/dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9/config/deploy/production.rb | config/deploy/production.rb | DOCS_SERVER_IP = '138.197.6.175'
set :ssh_options, port: 987
server DOCS_SERVER_IP, user: 'rails', roles: %w(web app db)
set :rvm_ruby_version, '3.4.5'
set :rvm_custom_path, '/home/rails/.rvm'
set :puma_access_log, "journal"
set :puma_error_log, "journal"
namespace :deploy do
after :normalize_assets, :gzip_assets... | ruby | MIT | dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9 | 2026-01-04T17:44:10.559232Z | false |
rails/rails-contributors | https://github.com/rails/rails-contributors/blob/dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9/config/environments/test.rb | config/environments/test.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 suite and is wiped
# and recreated between test runs. Don't rely on the data there!
Rails.application.configure do
# Settings... | ruby | MIT | dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9 | 2026-01-04T17:44:10.559232Z | false |
rails/rails-contributors | https://github.com/rails/rails-contributors/blob/dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9/config/environments/development.rb | config/environments/development.rb | require "active_support/core_ext/integer/time"
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# Make code changes take effect immediately without server restart.
config.enable_reloading = true
# Do not eager load code on boot.
config.eager... | ruby | MIT | dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9 | 2026-01-04T17:44:10.559232Z | false |
rails/rails-contributors | https://github.com/rails/rails-contributors/blob/dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9/config/environments/staging.rb | config/environments/staging.rb | require "active_support/core_ext/integer/time"
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# Code is not reloaded between requests.
config.enable_reloading = false
# Eager load code on boot for better performance and memory savings (ignor... | ruby | MIT | dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9 | 2026-01-04T17:44:10.559232Z | false |
rails/rails-contributors | https://github.com/rails/rails-contributors/blob/dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9/config/environments/production.rb | config/environments/production.rb | require "active_support/core_ext/integer/time"
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# Code is not reloaded between requests.
config.enable_reloading = false
# Eager load code on boot for better performance and memory savings (ignor... | ruby | MIT | dc10cffec6a3e3680e704bf0ddfed5c54cb3cdc9 | 2026-01-04T17:44:10.559232Z | false |
ejschmitt/jsvars | https://github.com/ejschmitt/jsvars/blob/6a928dc9d0fbe6878384050fe76f4389caec3da2/uninstall.rb | uninstall.rb | # Uninstall hook code here
| ruby | MIT | 6a928dc9d0fbe6878384050fe76f4389caec3da2 | 2026-01-04T17:44:24.744730Z | false |
ejschmitt/jsvars | https://github.com/ejschmitt/jsvars/blob/6a928dc9d0fbe6878384050fe76f4389caec3da2/install.rb | install.rb | # Install hook code here
| ruby | MIT | 6a928dc9d0fbe6878384050fe76f4389caec3da2 | 2026-01-04T17:44:24.744730Z | false |
ejschmitt/jsvars | https://github.com/ejschmitt/jsvars/blob/6a928dc9d0fbe6878384050fe76f4389caec3da2/init.rb | init.rb | ActionController::Base.send :include, Jsvars
ActionController::Base.send :after_filter, :include_jsvars | ruby | MIT | 6a928dc9d0fbe6878384050fe76f4389caec3da2 | 2026-01-04T17:44:24.744730Z | false |
ejschmitt/jsvars | https://github.com/ejschmitt/jsvars/blob/6a928dc9d0fbe6878384050fe76f4389caec3da2/test/jsvars_test.rb | test/jsvars_test.rb | require 'test_helper'
class JsvarsTest < ActiveSupport::TestCase
# Replace this with your real tests.
test "the truth" do
assert true
end
end
| ruby | MIT | 6a928dc9d0fbe6878384050fe76f4389caec3da2 | 2026-01-04T17:44:24.744730Z | false |
ejschmitt/jsvars | https://github.com/ejschmitt/jsvars/blob/6a928dc9d0fbe6878384050fe76f4389caec3da2/test/test_helper.rb | test/test_helper.rb | require 'rubygems'
require 'active_support'
require 'active_support/test_case' | ruby | MIT | 6a928dc9d0fbe6878384050fe76f4389caec3da2 | 2026-01-04T17:44:24.744730Z | false |
ejschmitt/jsvars | https://github.com/ejschmitt/jsvars/blob/6a928dc9d0fbe6878384050fe76f4389caec3da2/lib/jsvars.rb | lib/jsvars.rb | require 'json'
module Jsvars
def self.included(base)
base.send(:include, InstanceMethods)
end
module InstanceMethods
def jsvars(option = nil)
@jsvars ||= Hash.new
if option == false
@vars_off = true
end
@jsvars
end
def inc... | ruby | MIT | 6a928dc9d0fbe6878384050fe76f4389caec3da2 | 2026-01-04T17:44:24.744730Z | false |
gjtorikian/tailwind_merge | https://github.com/gjtorikian/tailwind_merge/blob/83ef21d415234e01c1f7188d64f37ebaec9c21ea/test/test_malicious_input.rb | test/test_malicious_input.rb | # frozen_string_literal: true
require "test_helper"
class TestMaliciousInput < Minitest::Test
def setup
@merger = TailwindMerge::Merger.new
end
def test_handles_wonky_input
assert_equal("block", @merger.merge(" block"))
assert_equal("block", @merger.merge("block "))
assert_equal("block", @merge... | ruby | MIT | 83ef21d415234e01c1f7188d64f37ebaec9c21ea | 2026-01-04T17:44:23.457574Z | false |
gjtorikian/tailwind_merge | https://github.com/gjtorikian/tailwind_merge/blob/83ef21d415234e01c1f7188d64f37ebaec9c21ea/test/test_theme.rb | test/test_theme.rb | # frozen_string_literal: true
require "test_helper"
class TestTheme < Minitest::Test
def test_theme_scale_can_be_extended
merger = TailwindMerge::Merger.new(config: {
theme: {
"spacing" => ["my-space"],
"leading" => ["my-leading"],
},
})
assert_equal("p-my-space p-my-margin"... | ruby | MIT | 83ef21d415234e01c1f7188d64f37ebaec9c21ea | 2026-01-04T17:44:23.457574Z | false |
gjtorikian/tailwind_merge | https://github.com/gjtorikian/tailwind_merge/blob/83ef21d415234e01c1f7188d64f37ebaec9c21ea/test/test_arbitrary_variants.rb | test/test_arbitrary_variants.rb | # frozen_string_literal: true
require "test_helper"
class TestArbitraryVariants < Minitest::Test
def setup
@merger = TailwindMerge::Merger.new
end
def test_basic_arbitrary_variants
assert_equal("[p]:line-through", @merger.merge("[p]:underline [p]:line-through"))
assert_equal("[&>*]:line-through", @... | ruby | MIT | 83ef21d415234e01c1f7188d64f37ebaec9c21ea | 2026-01-04T17:44:23.457574Z | false |
gjtorikian/tailwind_merge | https://github.com/gjtorikian/tailwind_merge/blob/83ef21d415234e01c1f7188d64f37ebaec9c21ea/test/test_per_side_border_colors.rb | test/test_per_side_border_colors.rb | # frozen_string_literal: true
require "test_helper"
class TestPerSideBorderColorsClasses < Minitest::Test
def setup
@merger = TailwindMerge::Merger.new
end
def test_merges_classes_with_per_side_border_colors_correctly
assert_equal("border-t-other-blue", @merger.merge("border-t-some-blue border-t-other-... | ruby | MIT | 83ef21d415234e01c1f7188d64f37ebaec9c21ea | 2026-01-04T17:44:23.457574Z | false |
gjtorikian/tailwind_merge | https://github.com/gjtorikian/tailwind_merge/blob/83ef21d415234e01c1f7188d64f37ebaec9c21ea/test/test_non_tailwind_classes.rb | test/test_non_tailwind_classes.rb | # frozen_string_literal: true
require "test_helper"
class TestNonTailwindClasses < Minitest::Test
def setup
@merger = TailwindMerge::Merger.new
end
def test_does_not_alter_non_tailwind_classes
assert_equal("non-tailwind-class block", @merger.merge("non-tailwind-class inline block"))
assert_equal("b... | ruby | MIT | 83ef21d415234e01c1f7188d64f37ebaec9c21ea | 2026-01-04T17:44:23.457574Z | false |
gjtorikian/tailwind_merge | https://github.com/gjtorikian/tailwind_merge/blob/83ef21d415234e01c1f7188d64f37ebaec9c21ea/test/test_colors.rb | test/test_colors.rb | # frozen_string_literal: true
require "test_helper"
class TesColors < Minitest::Test
def setup
@merger = TailwindMerge::Merger.new
end
def test_handles_color_conflicts_properly
assert_equal("bg-hotpink", @merger.merge("bg-grey-5 bg-hotpink"))
assert_equal("hover:bg-hotpink", @merger.merge("hover:bg... | ruby | MIT | 83ef21d415234e01c1f7188d64f37ebaec9c21ea | 2026-01-04T17:44:23.457574Z | false |
gjtorikian/tailwind_merge | https://github.com/gjtorikian/tailwind_merge/blob/83ef21d415234e01c1f7188d64f37ebaec9c21ea/test/test_important_modifier.rb | test/test_important_modifier.rb | # frozen_string_literal: true
require "test_helper"
class TestImportantModifier < Minitest::Test
def setup
@merger = TailwindMerge::Merger.new
end
def test_merges_tailwind_classes_with_important_modifier_correctly
assert_equal("font-bold!", @merger.merge("font-medium! font-bold!"))
assert_equal("fo... | ruby | MIT | 83ef21d415234e01c1f7188d64f37ebaec9c21ea | 2026-01-04T17:44:23.457574Z | false |
gjtorikian/tailwind_merge | https://github.com/gjtorikian/tailwind_merge/blob/83ef21d415234e01c1f7188d64f37ebaec9c21ea/test/test_validators.rb | test/test_validators.rb | # frozen_string_literal: true
require "test_helper"
class TestValidators < Minitest::Test
include TailwindMerge::Validators
def test_is_any
assert(IS_ANY.call)
assert(IS_ANY.call(""))
assert(IS_ANY.call("something"))
end
def test_is_any_non_arbitrary
assert(IS_ANY_NON_ARBITRARY.call("test"))... | ruby | MIT | 83ef21d415234e01c1f7188d64f37ebaec9c21ea | 2026-01-04T17:44:23.457574Z | false |
gjtorikian/tailwind_merge | https://github.com/gjtorikian/tailwind_merge/blob/83ef21d415234e01c1f7188d64f37ebaec9c21ea/test/test_tailwind_merge.rb | test/test_tailwind_merge.rb | # frozen_string_literal: true
require "test_helper"
class TestTailwindMerge < Minitest::Test
def setup
@merger = TailwindMerge::Merger.new
end
def test_that_it_has_a_version_number
refute_nil(::TailwindMerge::VERSION)
end
def test_it_works_with_single_string
assert_equal("mix-blend-multiply", ... | ruby | MIT | 83ef21d415234e01c1f7188d64f37ebaec9c21ea | 2026-01-04T17:44:23.457574Z | false |
gjtorikian/tailwind_merge | https://github.com/gjtorikian/tailwind_merge/blob/83ef21d415234e01c1f7188d64f37ebaec9c21ea/test/test_config.rb | test/test_config.rb | # frozen_string_literal: true
require "test_helper"
class TestConfig < Minitest::Test
def test_default_config_has_correct_types
config = TailwindMerge::Config::DEFAULTS
assert_equal(500, config[:cache_size])
assert(config[:ignore_empty_cache])
refute(config[:nonexistent])
assert_equal("block", ... | ruby | MIT | 83ef21d415234e01c1f7188d64f37ebaec9c21ea | 2026-01-04T17:44:23.457574Z | false |
gjtorikian/tailwind_merge | https://github.com/gjtorikian/tailwind_merge/blob/83ef21d415234e01c1f7188d64f37ebaec9c21ea/test/test_arbitrary_values.rb | test/test_arbitrary_values.rb | # frozen_string_literal: true
require "test_helper"
class TestArbitraryValues < Minitest::Test
def setup
@merger = TailwindMerge::Merger.new
end
def test_handles_simple_conflicts_with_arbitrary_values_correctly
assert_equal("m-[10px]", @merger.merge("m-[2px] m-[10px]"))
assert_equal("z-[99]", @merg... | ruby | MIT | 83ef21d415234e01c1f7188d64f37ebaec9c21ea | 2026-01-04T17:44:23.457574Z | false |
gjtorikian/tailwind_merge | https://github.com/gjtorikian/tailwind_merge/blob/83ef21d415234e01c1f7188d64f37ebaec9c21ea/test/test_helper.rb | test/test_helper.rb | # frozen_string_literal: true
if ENV.fetch("DEBUG", false)
require "amazing_print"
require "debug"
end
$LOAD_PATH.unshift(File.expand_path("../lib", __dir__))
require "tailwind_merge"
require "minitest/autorun"
require "minitest/focus"
require "minitest/pride"
| ruby | MIT | 83ef21d415234e01c1f7188d64f37ebaec9c21ea | 2026-01-04T17:44:23.457574Z | false |
gjtorikian/tailwind_merge | https://github.com/gjtorikian/tailwind_merge/blob/83ef21d415234e01c1f7188d64f37ebaec9c21ea/test/test_prefixes.rb | test/test_prefixes.rb | # frozen_string_literal: true
require "test_helper"
class TestPrefixes < Minitest::Test
def setup
@merger = TailwindMerge::Merger.new(config: { prefix: "tw" })
end
def test_prefix_working_correctly
# assert_equal("tw:hidden", @merger.merge("tw:block tw:hidden"))
assert_equal("block hidden", @merger... | ruby | MIT | 83ef21d415234e01c1f7188d64f37ebaec9c21ea | 2026-01-04T17:44:23.457574Z | false |
gjtorikian/tailwind_merge | https://github.com/gjtorikian/tailwind_merge/blob/83ef21d415234e01c1f7188d64f37ebaec9c21ea/test/test_tailwind_css_versions.rb | test/test_tailwind_css_versions.rb | # frozen_string_literal: true
require "test_helper"
require "set"
class TestTailwindCSSVersions < Minitest::Test
def setup
@merger = TailwindMerge::Merger.new
end
def test_tailwind_3_3_features
assert_equal("text-red text-lg/8", @merger.merge("text-red text-lg/7 text-lg/8"))
assert_equal("start-1 ... | ruby | MIT | 83ef21d415234e01c1f7188d64f37ebaec9c21ea | 2026-01-04T17:44:23.457574Z | false |
gjtorikian/tailwind_merge | https://github.com/gjtorikian/tailwind_merge/blob/83ef21d415234e01c1f7188d64f37ebaec9c21ea/test/test_arbitrary_properties.rb | test/test_arbitrary_properties.rb | # frozen_string_literal: true
require "test_helper"
class TestArbitraryProperties < Minitest::Test
def setup
@merger = TailwindMerge::Merger.new
end
def test_handles_arbitrary_property_conflicts_correctly
assert_equal("[paint-order:normal]", @merger.merge("[paint-order:markers] [paint-order:normal]"))
... | ruby | MIT | 83ef21d415234e01c1f7188d64f37ebaec9c21ea | 2026-01-04T17:44:23.457574Z | false |
gjtorikian/tailwind_merge | https://github.com/gjtorikian/tailwind_merge/blob/83ef21d415234e01c1f7188d64f37ebaec9c21ea/test/test_conflicts_across_class_groups.rb | test/test_conflicts_across_class_groups.rb | # frozen_string_literal: true
require "test_helper"
class TestConflictsAcrossClassGroups < Minitest::Test
def setup
@merger = TailwindMerge::Merger.new
end
def test_handles_conflicts_across_class_groups_correctly
assert_equal("inset-1 inset-x-1", @merger.merge("inset-1 inset-x-1"))
assert_equal("in... | ruby | MIT | 83ef21d415234e01c1f7188d64f37ebaec9c21ea | 2026-01-04T17:44:23.457574Z | false |
gjtorikian/tailwind_merge | https://github.com/gjtorikian/tailwind_merge/blob/83ef21d415234e01c1f7188d64f37ebaec9c21ea/test/test_standalone_classes.rb | test/test_standalone_classes.rb | # frozen_string_literal: true
require "test_helper"
class TestStandaloneClasses < Minitest::Test
def setup
@merger = TailwindMerge::Merger.new
end
def test_merges_standalone_classes_from_same_group_correctly
assert_equal("block", @merger.merge("inline block"))
assert_equal("hover:inline", @merger.m... | ruby | MIT | 83ef21d415234e01c1f7188d64f37ebaec9c21ea | 2026-01-04T17:44:23.457574Z | false |
gjtorikian/tailwind_merge | https://github.com/gjtorikian/tailwind_merge/blob/83ef21d415234e01c1f7188d64f37ebaec9c21ea/test/test_non_conflicting_classes.rb | test/test_non_conflicting_classes.rb | # frozen_string_literal: true
require "test_helper"
class TestNonConflictingClasses < Minitest::Test
def setup
@merger = TailwindMerge::Merger.new
end
def test_merges_non_conflicting_classes_correctly
assert_equal("border-t border-white/10", @merger.merge("border-t border-white/10"))
assert_equal("... | ruby | MIT | 83ef21d415234e01c1f7188d64f37ebaec9c21ea | 2026-01-04T17:44:23.457574Z | false |
gjtorikian/tailwind_merge | https://github.com/gjtorikian/tailwind_merge/blob/83ef21d415234e01c1f7188d64f37ebaec9c21ea/test/test_content_utilities.rb | test/test_content_utilities.rb | # frozen_string_literal: true
require "test_helper"
class TestContentUtilities < Minitest::Test
def setup
@merger = TailwindMerge::Merger.new
end
def test_merges_content_utilities_correctly
assert_equal("content-[attr(data-content)]", @merger.merge("content-['hello'] content-[attr(data-content)]"))
e... | ruby | MIT | 83ef21d415234e01c1f7188d64f37ebaec9c21ea | 2026-01-04T17:44:23.457574Z | false |
gjtorikian/tailwind_merge | https://github.com/gjtorikian/tailwind_merge/blob/83ef21d415234e01c1f7188d64f37ebaec9c21ea/test/test_pseudo_variants.rb | test/test_pseudo_variants.rb | # frozen_string_literal: true
require "test_helper"
class TestPseudoVariants < Minitest::Test
def setup
@merger = TailwindMerge::Merger.new
end
def test_handles_pseudo_variants_conflicts_properly
assert_equal("empty:p-3", @merger.merge("empty:p-2 empty:p-3"))
# assert_equal("hover:empty:p-3", @merg... | ruby | MIT | 83ef21d415234e01c1f7188d64f37ebaec9c21ea | 2026-01-04T17:44:23.457574Z | false |
gjtorikian/tailwind_merge | https://github.com/gjtorikian/tailwind_merge/blob/83ef21d415234e01c1f7188d64f37ebaec9c21ea/test/test_modifiers.rb | test/test_modifiers.rb | # frozen_string_literal: true
require "test_helper"
class TestModifiers < Minitest::Test
def setup
@merger = TailwindMerge::Merger.new
end
def test_conflicts_across_prefix_modifiers
assert_equal("hover:inline", @merger.merge("hover:block hover:inline"))
assert_equal("hover:block hover:focus:inline"... | ruby | MIT | 83ef21d415234e01c1f7188d64f37ebaec9c21ea | 2026-01-04T17:44:23.457574Z | false |
gjtorikian/tailwind_merge | https://github.com/gjtorikian/tailwind_merge/blob/83ef21d415234e01c1f7188d64f37ebaec9c21ea/test/test_class_map.rb | test/test_class_map.rb | # frozen_string_literal: true
require "test_helper"
require "set"
class TestClassMap < Minitest::Test
def setup
@class_utils = TailwindMerge::ClassGroupUtils.new(TailwindMerge::Config::DEFAULTS)
@class_map = @class_utils.class_map
end
def class_groups_in_class_part(class_part)
class_group_id = clas... | ruby | MIT | 83ef21d415234e01c1f7188d64f37ebaec9c21ea | 2026-01-04T17:44:23.457574Z | false |
gjtorikian/tailwind_merge | https://github.com/gjtorikian/tailwind_merge/blob/83ef21d415234e01c1f7188d64f37ebaec9c21ea/test/test_negative_values.rb | test/test_negative_values.rb | # frozen_string_literal: true
require "test_helper"
class TestNegativeValues < Minitest::Test
def setup
@merger = TailwindMerge::Merger.new
end
def test_handles_negative_value_conflicts_correctly
assert_equal("-m-5", @merger.merge("-m-2 -m-5"))
assert_equal("-top-2000", @merger.merge("-top-12 -top-... | ruby | MIT | 83ef21d415234e01c1f7188d64f37ebaec9c21ea | 2026-01-04T17:44:23.457574Z | false |
gjtorikian/tailwind_merge | https://github.com/gjtorikian/tailwind_merge/blob/83ef21d415234e01c1f7188d64f37ebaec9c21ea/test/test_cache_tampering.rb | test/test_cache_tampering.rb | # frozen_string_literal: true
require "test_helper"
class TestCacheTampering < Minitest::Test
def setup
@merger = TailwindMerge::Merger.new
end
def test_cached_values_are_immutable
classes = @merger.merge("font-medium font-bold")
assert_raises(FrozenError) do
classes << " text-white"
end
... | ruby | MIT | 83ef21d415234e01c1f7188d64f37ebaec9c21ea | 2026-01-04T17:44:23.457574Z | false |
gjtorikian/tailwind_merge | https://github.com/gjtorikian/tailwind_merge/blob/83ef21d415234e01c1f7188d64f37ebaec9c21ea/test/test_class_group_conflicts.rb | test/test_class_group_conflicts.rb | # frozen_string_literal: true
require "test_helper"
class TestClassGroupConflicts < Minitest::Test
def setup
@merger = TailwindMerge::Merger.new
end
def test_merge_classes_from_same_group_correctly
assert_equal("overflow-x-hidden", @merger.merge("overflow-x-auto overflow-x-hidden"))
assert_equal("b... | ruby | MIT | 83ef21d415234e01c1f7188d64f37ebaec9c21ea | 2026-01-04T17:44:23.457574Z | false |
gjtorikian/tailwind_merge | https://github.com/gjtorikian/tailwind_merge/blob/83ef21d415234e01c1f7188d64f37ebaec9c21ea/lib/tailwind_merge.rb | lib/tailwind_merge.rb | # frozen_string_literal: true
require "lru_redux"
require_relative "tailwind_merge/version"
require_relative "tailwind_merge/validators"
require_relative "tailwind_merge/config"
require_relative "tailwind_merge/class_group_utils"
require_relative "tailwind_merge/sort_modifiers"
require_relative "tailwind_merge/parse_... | ruby | MIT | 83ef21d415234e01c1f7188d64f37ebaec9c21ea | 2026-01-04T17:44:23.457574Z | false |
gjtorikian/tailwind_merge | https://github.com/gjtorikian/tailwind_merge/blob/83ef21d415234e01c1f7188d64f37ebaec9c21ea/lib/tailwind_merge/version.rb | lib/tailwind_merge/version.rb | # frozen_string_literal: true
module TailwindMerge
VERSION = "1.3.2"
end
| ruby | MIT | 83ef21d415234e01c1f7188d64f37ebaec9c21ea | 2026-01-04T17:44:23.457574Z | false |
gjtorikian/tailwind_merge | https://github.com/gjtorikian/tailwind_merge/blob/83ef21d415234e01c1f7188d64f37ebaec9c21ea/lib/tailwind_merge/sort_modifiers.rb | lib/tailwind_merge/sort_modifiers.rb | # frozen_string_literal: true
module TailwindMerge
module SortModifiers
# Sorts modifiers according to following schema:
# - Predefined modifiers are sorted alphabetically
# - When an arbitrary variant appears, it must be preserved which modifiers are before and after it
def sort_modifiers(modifiers,... | ruby | MIT | 83ef21d415234e01c1f7188d64f37ebaec9c21ea | 2026-01-04T17:44:23.457574Z | false |
gjtorikian/tailwind_merge | https://github.com/gjtorikian/tailwind_merge/blob/83ef21d415234e01c1f7188d64f37ebaec9c21ea/lib/tailwind_merge/config.rb | lib/tailwind_merge/config.rb | # frozen_string_literal: true
require "set"
module TailwindMerge
module Config
include Validators
THEME_KEYS = [
"color",
"font",
"text",
"font-weight",
"tracking",
"leading",
"breakpoint",
"container",
"spacing",
"radius",
"shadow",
"... | ruby | MIT | 83ef21d415234e01c1f7188d64f37ebaec9c21ea | 2026-01-04T17:44:23.457574Z | true |
gjtorikian/tailwind_merge | https://github.com/gjtorikian/tailwind_merge/blob/83ef21d415234e01c1f7188d64f37ebaec9c21ea/lib/tailwind_merge/parse_class_name.rb | lib/tailwind_merge/parse_class_name.rb | # frozen_string_literal: true
module TailwindMerge
class TailwindClass < Struct.new(:is_external, :modifiers, :has_important_modifier, :base_class_name, :maybe_postfix_modifier_position)
end
module ParseClassName
IMPORTANT_MODIFIER = "!"
MODIFIER_SEPARATOR = ":"
MODIFIER_SEPARATOR_LENGTH = MODIFIER_... | ruby | MIT | 83ef21d415234e01c1f7188d64f37ebaec9c21ea | 2026-01-04T17:44:23.457574Z | false |
gjtorikian/tailwind_merge | https://github.com/gjtorikian/tailwind_merge/blob/83ef21d415234e01c1f7188d64f37ebaec9c21ea/lib/tailwind_merge/class_group_utils.rb | lib/tailwind_merge/class_group_utils.rb | # frozen_string_literal: true
module TailwindMerge
class ClassGroupUtils
attr_reader :class_map
CLASS_PART_SEPARATOR = "-"
ARBITRARY_PROPERTY_REGEX = /^\[(.+)\]$/
def initialize(config)
@config = config
@class_map = create_class_map(config)
end
def class_group_id(class_name)
... | ruby | MIT | 83ef21d415234e01c1f7188d64f37ebaec9c21ea | 2026-01-04T17:44:23.457574Z | false |
gjtorikian/tailwind_merge | https://github.com/gjtorikian/tailwind_merge/blob/83ef21d415234e01c1f7188d64f37ebaec9c21ea/lib/tailwind_merge/validators.rb | lib/tailwind_merge/validators.rb | # frozen_string_literal: true
require "set"
module TailwindMerge
module Validators
class << self
def arbitrary_value?(class_part, test_label, test_value)
match = ARBITRARY_VALUE_REGEX.match(class_part)
return false unless match
return test_label.call(match[1]) unless match[1].nil?... | ruby | MIT | 83ef21d415234e01c1f7188d64f37ebaec9c21ea | 2026-01-04T17:44:23.457574Z | false |
damog/feedbag | https://github.com/damog/feedbag/blob/19101d3b8f7e12a0abddaf47339be9e2c080be56/benchmark/rfeedfinder_benchmark.rb | benchmark/rfeedfinder_benchmark.rb | require "benchmark"
require "rubygems"
sites = [
"log.damog.net",
"http://cnn.com",
"scripting.com",
"mx.planetalinux.org",
"http://feedproxy.google.com/UniversoPlanetaLinux",
]
Benchmark.bm do |x|
sites.each do |site|
puts "#{site}:"
puts " feedbag"
x.report {
require 'feedbag'
Feedbag.find(site)
... | ruby | MIT | 19101d3b8f7e12a0abddaf47339be9e2c080be56 | 2026-01-04T17:44:28.137218Z | false |
damog/feedbag | https://github.com/damog/feedbag/blob/19101d3b8f7e12a0abddaf47339be9e2c080be56/rails/init.rb | rails/init.rb | require File.join File.dirname(__FILE__), "..", "lib", "feedbag"
| ruby | MIT | 19101d3b8f7e12a0abddaf47339be9e2c080be56 | 2026-01-04T17:44:28.137218Z | false |
damog/feedbag | https://github.com/damog/feedbag/blob/19101d3b8f7e12a0abddaf47339be9e2c080be56/test/logger_test.rb | test/logger_test.rb | #!/usr/bin/env ruby
# frozen_string_literal: true
# Test for configurable logger (Issue #33)
require_relative 'test_helper'
require 'stringio'
require 'logger'
class LoggerTest < Test::Unit::TestCase
def setup
# Reset logger to default before each test
Feedbag.logger = nil
end
def teardown
# Rese... | ruby | MIT | 19101d3b8f7e12a0abddaf47339be9e2c080be56 | 2026-01-04T17:44:28.137218Z | false |
damog/feedbag | https://github.com/damog/feedbag/blob/19101d3b8f7e12a0abddaf47339be9e2c080be56/test/normalize_url_test.rb | test/normalize_url_test.rb | #!/usr/bin/env ruby
# frozen_string_literal: true
# Test for non-ASCII URL support (Issue #29)
require_relative 'test_helper'
class NormalizeUrlTest < Test::Unit::TestCase
def test_normalize_chinese_characters_in_url_path
url = "https://www.rehabsociety.org.hk/zh-hant/主頁/feed/"
normalized = Feedbag.norm... | ruby | MIT | 19101d3b8f7e12a0abddaf47339be9e2c080be56 | 2026-01-04T17:44:28.137218Z | false |
damog/feedbag | https://github.com/damog/feedbag/blob/19101d3b8f7e12a0abddaf47339be9e2c080be56/test/test_helper.rb | test/test_helper.rb | require 'rubygems'
require 'test/unit'
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
$LOAD_PATH.unshift(File.dirname(__FILE__))
require 'feedbag'
# Optional test dependencies - only loaded if available
begin
require 'shoulda'
rescue LoadError
# shoulda not available
end
begin
require 'moch... | ruby | MIT | 19101d3b8f7e12a0abddaf47339be9e2c080be56 | 2026-01-04T17:44:28.137218Z | false |
damog/feedbag | https://github.com/damog/feedbag/blob/19101d3b8f7e12a0abddaf47339be9e2c080be56/test/feedbag_test.rb | test/feedbag_test.rb | require 'test_helper'
class FeedbagTest < Test::Unit::TestCase
context "Feedbag.feed? should know that an RSS url is a feed" do
setup do
@rss_url = 'http://example.com/rss/'
Feedbag.stubs(:find).with(@rss_url).returns([@rss_url])
end
should "return true" do
assert Feedbag.feed?(@rss_ur... | ruby | MIT | 19101d3b8f7e12a0abddaf47339be9e2c080be56 | 2026-01-04T17:44:28.137218Z | false |
damog/feedbag | https://github.com/damog/feedbag/blob/19101d3b8f7e12a0abddaf47339be9e2c080be56/lib/feedbag.rb | lib/feedbag.rb | #!/usr/bin/ruby
# See COPYING before using this software.
require "rubygems"
require "nokogiri"
require "open-uri"
require "net/http"
require "logger"
require_relative "feedbag/version"
begin
require "addressable/uri"
rescue LoadError
# addressable will be loaded after bundle install
end
class Feedbag
# Conf... | ruby | MIT | 19101d3b8f7e12a0abddaf47339be9e2c080be56 | 2026-01-04T17:44:28.137218Z | false |
damog/feedbag | https://github.com/damog/feedbag/blob/19101d3b8f7e12a0abddaf47339be9e2c080be56/lib/feedbag/version.rb | lib/feedbag/version.rb | # frozen_string_literal: true
class Feedbag
VERSION = '1.0.2'
end
| ruby | MIT | 19101d3b8f7e12a0abddaf47339be9e2c080be56 | 2026-01-04T17:44:28.137218Z | false |
kapost/circuitry | https://github.com/kapost/circuitry/blob/d49325462ab43c98af6af18c98dbfa609fba1851/spec/circuitry_spec.rb | spec/circuitry_spec.rb | require 'spec_helper'
RSpec.describe Circuitry, type: :model do
subject { described_class }
shared_examples_for 'a configuration method' do |method|
it 'returns a configuration object' do
expect(subject.send(method)).to be_a Circuitry::Config::SharedSettings
end
it 'always returns the same obje... | ruby | MIT | d49325462ab43c98af6af18c98dbfa609fba1851 | 2026-01-04T17:44:26.741626Z | false |
kapost/circuitry | https://github.com/kapost/circuitry/blob/d49325462ab43c98af6af18c98dbfa609fba1851/spec/spec_helper.rb | spec/spec_helper.rb | require 'simplecov'
SimpleCov.start
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
require 'circuitry'
require 'circuitry/cli'
require 'circuitry/config/file_loader'
require 'rspec/its'
require 'redis'
require 'mock_redis'
require 'dalli'
require 'memcache_mock'
require 'connection_pool'
require 'pry-byeb... | ruby | MIT | d49325462ab43c98af6af18c98dbfa609fba1851 | 2026-01-04T17:44:26.741626Z | false |
kapost/circuitry | https://github.com/kapost/circuitry/blob/d49325462ab43c98af6af18c98dbfa609fba1851/spec/support/examples/async_processor_examples.rb | spec/support/examples/async_processor_examples.rb | RSpec.shared_examples_for 'an asyncronous processor' do
context 'when on_async_exit is defined' do
let(:block) { -> {} }
let(:on_async_exit) { double('Proc', call: true) }
before do
allow(subject).to receive(:fork) { |&block| block.call }
allow(Process).to receive(:detach)
allow(Circuit... | ruby | MIT | d49325462ab43c98af6af18c98dbfa609fba1851 | 2026-01-04T17:44:26.741626Z | false |
kapost/circuitry | https://github.com/kapost/circuitry/blob/d49325462ab43c98af6af18c98dbfa609fba1851/spec/support/examples/lock_examples.rb | spec/support/examples/lock_examples.rb | RSpec.shared_examples_for 'a lock' do
it { is_expected.to be_a Circuitry::Locks::Base }
describe '#soft_lock' do
let(:id) { SecureRandom.hex(100) }
let(:now) { Time.now }
before do
allow(Time).to receive(:now).and_return(now)
end
describe 'when the id is not locked' do
it 'returns... | ruby | MIT | d49325462ab43c98af6af18c98dbfa609fba1851 | 2026-01-04T17:44:26.741626Z | false |
kapost/circuitry | https://github.com/kapost/circuitry/blob/d49325462ab43c98af6af18c98dbfa609fba1851/spec/support/examples/settings_examples.rb | spec/support/examples/settings_examples.rb | RSpec.shared_examples_for 'a validated setting' do |permitted_values, setting_name|
def set(value)
subject.public_send(:"#{setting}=", value)
end
def get
subject.public_send(setting)
end
let(:setting) { setting_name }
permitted_values.each do |value|
describe "with valid value #{value}" do
... | ruby | MIT | d49325462ab43c98af6af18c98dbfa609fba1851 | 2026-01-04T17:44:26.741626Z | false |
kapost/circuitry | https://github.com/kapost/circuitry/blob/d49325462ab43c98af6af18c98dbfa609fba1851/spec/fixtures/test_middleware.rb | spec/fixtures/test_middleware.rb | class TestMiddleware
attr_accessor :log
def initialize(log: [])
self.log = log
end
def call(*args)
log << 'before'
log.concat(args)
yield
ensure
log << 'after'
end
end
class TestMiddleware2 < TestMiddleware
end
| ruby | MIT | d49325462ab43c98af6af18c98dbfa609fba1851 | 2026-01-04T17:44:26.741626Z | false |
kapost/circuitry | https://github.com/kapost/circuitry/blob/d49325462ab43c98af6af18c98dbfa609fba1851/spec/circuitry/message_spec.rb | spec/circuitry/message_spec.rb | require 'spec_helper'
RSpec.describe Circuitry::Message, type: :model do
subject { described_class.new(sqs_message) }
let(:sqs_message) { double(message_id: id, receipt_handle: handle, body: context.to_json) }
let(:id) { '123' }
let(:handle) { '456' }
let(:body) { 'foo' }
let(:arn) { 'arn:aws:sns:us-east... | ruby | MIT | d49325462ab43c98af6af18c98dbfa609fba1851 | 2026-01-04T17:44:26.741626Z | false |
kapost/circuitry | https://github.com/kapost/circuitry/blob/d49325462ab43c98af6af18c98dbfa609fba1851/spec/circuitry/processor_spec.rb | spec/circuitry/processor_spec.rb | require 'spec_helper'
processor_class = Class.new do
include Circuitry::Processor
def process(&block)
block.call
end
def flush
pool.clear
end
end
incomplete_processor_class = Class.new do
include Circuitry::Processor
end
RSpec.describe Circuitry::Processor, type: :model do
subject { processor... | ruby | MIT | d49325462ab43c98af6af18c98dbfa609fba1851 | 2026-01-04T17:44:26.741626Z | false |
kapost/circuitry | https://github.com/kapost/circuitry/blob/d49325462ab43c98af6af18c98dbfa609fba1851/spec/circuitry/queue_spec.rb | spec/circuitry/queue_spec.rb | require 'spec_helper'
RSpec.describe Circuitry::Queue, type: :model do
subject { described_class.new(url) }
let(:url) { 'https://sqs.amazontest.com/123/queue_name' }
describe '.find' do
subject { described_class }
before do
allow_any_instance_of(Circuitry::Queue::Finder).to receive(:find).and_re... | ruby | MIT | d49325462ab43c98af6af18c98dbfa609fba1851 | 2026-01-04T17:44:26.741626Z | false |
kapost/circuitry | https://github.com/kapost/circuitry/blob/d49325462ab43c98af6af18c98dbfa609fba1851/spec/circuitry/cli_spec.rb | spec/circuitry/cli_spec.rb | require 'spec_helper'
RSpec.describe Circuitry::CLI do
subject { described_class }
describe '#provision' do
before do
allow(Circuitry::Provisioning::QueueCreator).to receive(:find_or_create).and_return(queue)
allow(Circuitry::Provisioning::TopicCreator).to receive(:find_or_create).and_return(topic... | ruby | MIT | d49325462ab43c98af6af18c98dbfa609fba1851 | 2026-01-04T17:44:26.741626Z | false |
kapost/circuitry | https://github.com/kapost/circuitry/blob/d49325462ab43c98af6af18c98dbfa609fba1851/spec/circuitry/subscriber_spec.rb | spec/circuitry/subscriber_spec.rb | require 'spec_helper'
RSpec.describe Circuitry::Subscriber, type: :model do
subject { described_class.new(options) }
let(:queue) { 'https://sqs.amazon.com/account/queue' }
let(:options) { {} }
it { is_expected.to be_a Circuitry::Concerns::Async }
before do
allow(Circuitry::Queue).to receive(:find).and... | ruby | MIT | d49325462ab43c98af6af18c98dbfa609fba1851 | 2026-01-04T17:44:26.741626Z | false |
kapost/circuitry | https://github.com/kapost/circuitry/blob/d49325462ab43c98af6af18c98dbfa609fba1851/spec/circuitry/topic_spec.rb | spec/circuitry/topic_spec.rb | require 'spec_helper'
RSpec.describe Circuitry::Topic, type: :model do
subject { described_class.new(arn) }
let(:arn) { 'arn:aws:sqs:us-east-1:123456789012:some-topic-name' }
describe '.find' do
subject { described_class }
before do
allow_any_instance_of(Circuitry::Topic::Finder).to receive(:fin... | ruby | MIT | d49325462ab43c98af6af18c98dbfa609fba1851 | 2026-01-04T17:44:26.741626Z | false |
kapost/circuitry | https://github.com/kapost/circuitry/blob/d49325462ab43c98af6af18c98dbfa609fba1851/spec/circuitry/provisioning_spec.rb | spec/circuitry/provisioning_spec.rb | require 'spec_helper'
RSpec.describe Circuitry::Provisioning do
subject { described_class }
describe '.provision' do
before do
allow(Circuitry::Provisioning::Provisioner).to receive(:new).with(logger).and_return(provisioner)
end
let(:logger) { double('Logger') }
let(:provisioner) { double('... | ruby | MIT | d49325462ab43c98af6af18c98dbfa609fba1851 | 2026-01-04T17:44:26.741626Z | false |
kapost/circuitry | https://github.com/kapost/circuitry/blob/d49325462ab43c98af6af18c98dbfa609fba1851/spec/circuitry/publisher_spec.rb | spec/circuitry/publisher_spec.rb | require 'spec_helper'
RSpec.describe Circuitry::Publisher, type: :model do
subject { described_class.new(options) }
let(:options) { {} }
it { is_expected.to be_a Circuitry::Concerns::Async }
describe '#publish' do
describe 'when topic name is not set' do
let(:topic_name) { nil }
let(:object)... | ruby | MIT | d49325462ab43c98af6af18c98dbfa609fba1851 | 2026-01-04T17:44:26.741626Z | false |
kapost/circuitry | https://github.com/kapost/circuitry/blob/d49325462ab43c98af6af18c98dbfa609fba1851/spec/circuitry/services/sqs_spec.rb | spec/circuitry/services/sqs_spec.rb | require 'spec_helper'
sqs_class = Class.new do
include Circuitry::Services::SQS
end
RSpec.describe sqs_class, type: :model do
describe '#sqs' do
before do
allow(Circuitry.subscriber_config).to receive(:aws_options).and_return(aws_options)
end
let(:aws_options) { { access_key_id: 'foo', secret_a... | ruby | MIT | d49325462ab43c98af6af18c98dbfa609fba1851 | 2026-01-04T17:44:26.741626Z | false |
kapost/circuitry | https://github.com/kapost/circuitry/blob/d49325462ab43c98af6af18c98dbfa609fba1851/spec/circuitry/services/sns_spec.rb | spec/circuitry/services/sns_spec.rb | require 'spec_helper'
sns_class = Class.new do
include Circuitry::Services::SNS
end
RSpec.describe sns_class, type: :model do
describe '#sns' do
before do
allow(Circuitry.publisher_config).to receive(:aws_options).and_return(aws_options)
end
let(:aws_options) { { access_key_id: 'foo', secret_ac... | ruby | MIT | d49325462ab43c98af6af18c98dbfa609fba1851 | 2026-01-04T17:44:26.741626Z | false |
kapost/circuitry | https://github.com/kapost/circuitry/blob/d49325462ab43c98af6af18c98dbfa609fba1851/spec/circuitry/concerns/async_spec.rb | spec/circuitry/concerns/async_spec.rb | require 'spec_helper'
async_class = Class.new do
include Circuitry::Concerns::Async
def self.default_async_strategy
:thread
end
def self.async_strategies
[:fork, :thread, :batch]
end
end
incomplete_async_class = Class.new do
include Circuitry::Concerns::Async
end
RSpec.describe Circuitry::Conce... | ruby | MIT | d49325462ab43c98af6af18c98dbfa609fba1851 | 2026-01-04T17:44:26.741626Z | false |
kapost/circuitry | https://github.com/kapost/circuitry/blob/d49325462ab43c98af6af18c98dbfa609fba1851/spec/circuitry/provisioning/queue_creator_spec.rb | spec/circuitry/provisioning/queue_creator_spec.rb | require 'spec_helper'
RSpec.describe Circuitry::Provisioning::QueueCreator, type: :model do
describe '.find_or_create' do
subject { described_class }
before do
allow_any_instance_of(subject).to receive(:sqs).and_return(mock_sqs)
end
let(:queue_url) { 'http://sqs.amazontest.com/howdy' }
let... | ruby | MIT | d49325462ab43c98af6af18c98dbfa609fba1851 | 2026-01-04T17:44:26.741626Z | false |
kapost/circuitry | https://github.com/kapost/circuitry/blob/d49325462ab43c98af6af18c98dbfa609fba1851/spec/circuitry/provisioning/topic_creator_spec.rb | spec/circuitry/provisioning/topic_creator_spec.rb | require 'spec_helper'
RSpec.describe Circuitry::Provisioning::TopicCreator, type: :model do
describe '.find_or_create' do
subject { described_class }
let(:topic_name) { 'topic' }
let(:topic) { double('Topic') }
let(:instance) { double('TopicCreator', topic: topic) }
before do
allow(subjec... | ruby | MIT | d49325462ab43c98af6af18c98dbfa609fba1851 | 2026-01-04T17:44:26.741626Z | false |
kapost/circuitry | https://github.com/kapost/circuitry/blob/d49325462ab43c98af6af18c98dbfa609fba1851/spec/circuitry/provisioning/provisioner_spec.rb | spec/circuitry/provisioning/provisioner_spec.rb | require 'spec_helper'
RSpec.describe Circuitry::Provisioning::Provisioner do
subject { described_class.new(logger) }
let(:logger) { double('Logger', info: nil, fatal: nil) }
describe '#run' do
let(:queue) { Circuitry::Queue.new('my_queue_name') }
let(:topic) { Circuitry::Topic.new('my_topic_arn') }
... | ruby | MIT | d49325462ab43c98af6af18c98dbfa609fba1851 | 2026-01-04T17:44:26.741626Z | false |
kapost/circuitry | https://github.com/kapost/circuitry/blob/d49325462ab43c98af6af18c98dbfa609fba1851/spec/circuitry/provisioning/subscription_creator_spec.rb | spec/circuitry/provisioning/subscription_creator_spec.rb | require 'json'
require 'spec_helper'
RSpec::Matchers.define :policy_statement_count do |count|
match do |actual|
JSON.parse(actual[:attributes]['Policy'])['Statement'].length == count
end
end
RSpec::Matchers.define :policy_statement_arn_condition_count do |statement_position:, count:|
match do |actual|
... | ruby | MIT | d49325462ab43c98af6af18c98dbfa609fba1851 | 2026-01-04T17:44:26.741626Z | false |
kapost/circuitry | https://github.com/kapost/circuitry/blob/d49325462ab43c98af6af18c98dbfa609fba1851/spec/circuitry/middleware/entry_spec.rb | spec/circuitry/middleware/entry_spec.rb | require 'spec_helper'
class TestEntry
attr_accessor :value
def initialize(value)
self.value = value
end
end
RSpec.describe Circuitry::Middleware::Entry do
subject { described_class.new(klass, value) }
let(:klass) { TestEntry }
let(:value) { 'foo' }
its(:klass) { is_expected.to be klass }
its(:a... | ruby | MIT | d49325462ab43c98af6af18c98dbfa609fba1851 | 2026-01-04T17:44:26.741626Z | false |
kapost/circuitry | https://github.com/kapost/circuitry/blob/d49325462ab43c98af6af18c98dbfa609fba1851/spec/circuitry/middleware/chain_spec.rb | spec/circuitry/middleware/chain_spec.rb | require 'spec_helper'
RSpec.describe Circuitry::Middleware::Chain do
def entry
subject.detect { |entry| entry.klass == TestMiddleware }
end
describe '#entries' do
it 'returns an array' do
expect(subject.entries).to be_an Array
end
end
describe '#add' do
def add!(log: [])
subject... | ruby | MIT | d49325462ab43c98af6af18c98dbfa609fba1851 | 2026-01-04T17:44:26.741626Z | false |
kapost/circuitry | https://github.com/kapost/circuitry/blob/d49325462ab43c98af6af18c98dbfa609fba1851/spec/circuitry/locks/noop_spec.rb | spec/circuitry/locks/noop_spec.rb | require 'spec_helper'
RSpec.describe Circuitry::Locks::NOOP, type: :model do
subject { described_class.new }
let(:id) { SecureRandom.hex(100) }
describe '#soft_lock' do
it 'returns true' do
expect(subject.soft_lock(id)).to be true
end
end
describe '#lock!' do
it 'returns nil' do
ex... | ruby | MIT | d49325462ab43c98af6af18c98dbfa609fba1851 | 2026-01-04T17:44:26.741626Z | false |
kapost/circuitry | https://github.com/kapost/circuitry/blob/d49325462ab43c98af6af18c98dbfa609fba1851/spec/circuitry/locks/redis_spec.rb | spec/circuitry/locks/redis_spec.rb | require 'spec_helper'
RSpec.describe Circuitry::Locks::Redis, type: :model do
subject { described_class.new(soft_ttl: soft_ttl, hard_ttl: hard_ttl, client: client) }
let(:soft_ttl) { 30 }
let(:hard_ttl) { 60 }
let(:client) { MockRedis.new }
before do
client.respond_to?(:flushdb) ? client.flushdb : clie... | ruby | MIT | d49325462ab43c98af6af18c98dbfa609fba1851 | 2026-01-04T17:44:26.741626Z | false |
kapost/circuitry | https://github.com/kapost/circuitry/blob/d49325462ab43c98af6af18c98dbfa609fba1851/spec/circuitry/locks/base_spec.rb | spec/circuitry/locks/base_spec.rb | require 'spec_helper'
lock_class = Class.new do
include Circuitry::Locks::Base
def lock(key, ttl)
end
def lock!(key, ttl)
end
def unlock!(key)
end
end
incomplete_lock_class = Class.new do
include Circuitry::Locks::Base
end
RSpec.describe Circuitry::Locks::Base, type: :model do
subject { lock_cla... | ruby | MIT | d49325462ab43c98af6af18c98dbfa609fba1851 | 2026-01-04T17:44:26.741626Z | false |
kapost/circuitry | https://github.com/kapost/circuitry/blob/d49325462ab43c98af6af18c98dbfa609fba1851/spec/circuitry/locks/memcache_spec.rb | spec/circuitry/locks/memcache_spec.rb | require 'spec_helper'
RSpec.describe Circuitry::Locks::Memcache, type: :model do
subject { described_class.new(soft_ttl: soft_ttl, hard_ttl: hard_ttl, client: client) }
let(:soft_ttl) { 30 }
let(:hard_ttl) { 60 }
let(:client) { MemcacheMock.new }
before do
client.flush
end
it_behaves_like 'a lock'... | ruby | MIT | d49325462ab43c98af6af18c98dbfa609fba1851 | 2026-01-04T17:44:26.741626Z | false |
kapost/circuitry | https://github.com/kapost/circuitry/blob/d49325462ab43c98af6af18c98dbfa609fba1851/spec/circuitry/locks/memory_spec.rb | spec/circuitry/locks/memory_spec.rb | require 'spec_helper'
RSpec.describe Circuitry::Locks::Memory, type: :model do
subject { described_class.new(soft_ttl: soft_ttl, hard_ttl: hard_ttl) }
let(:soft_ttl) { 30 }
let(:hard_ttl) { 60 }
before do
described_class.store.clear
end
it_behaves_like 'a lock'
end
| ruby | MIT | d49325462ab43c98af6af18c98dbfa609fba1851 | 2026-01-04T17:44:26.741626Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.