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 |
|---|---|---|---|---|---|---|---|---|
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/config/initializers/004_constants.rb | config/initializers/004_constants.rb | # frozen_string_literal: true
GOOGLE_CLOUD_PROJECT_ID = GlobalConfig.get("GOOGLE_CLOUD_PROJECT_ID")
GUMROAD_ADMIN_ID = GlobalConfig.get("GUMROAD_ADMIN_ID", Rails.env.staging? ? 978 : 767082) # admin@gumroad.com
GUMROAD_STARTED_DATE = Date.parse("2011-04-04")
PRODUCT_EVENT_TRACKING_STARTED_DATE = Date.parse("2012-10-1... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/config/initializers/discord.rb | config/initializers/discord.rb | # frozen_string_literal: true
DISCORD_OAUTH_TOKEN_URL = GlobalConfig.get("DISCORD_OAUTH_TOKEN_URL", "https://discord.com/api/oauth2/token")
DISCORD_GUMROAD_BOT_ID = GlobalConfig.get("DISCORD_BOT_ID", "951121634046140416")
DISCORD_CLIENT_ID = GlobalConfig.get("DISCORD_CLIENT_ID")
DISCORD_CLIENT_SECRET = GlobalConfig.g... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/config/initializers/id_headers.rb | config/initializers/id_headers.rb | # frozen_string_literal: true
if Rails.env.staging? || Rails.env.production?
REVISION = ENV.fetch("REVISION")
else
REVISION = GlobalConfig.get("REVISION_DEFAULT", "no-revision")
end
GR_NUM = if Rails.env.production?
GlobalConfig.get("ENV_IDENTIFIER_PROD", "PROD")
else
GlobalConfig.get("ENV_IDENTIFIER_DEV", "D... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/config/initializers/pdfkit.rb | config/initializers/pdfkit.rb | # frozen_string_literal: true
if Rails.env.staging? || Rails.env.production?
PDFKit.configure do |config|
config.wkhtmltopdf = File.join("/", "usr", "local", "bin", "wkhtmltopdf")
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/config/initializers/redis_logger.rb | config/initializers/redis_logger.rb | # frozen_string_literal: true
if ENV["LOG_REDIS"] == "1"
$redis.client.logger = Rails.logger
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/config/initializers/assets.rb | config/initializers/assets.rb | # frozen_string_literal: true
# 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"
Rails.application.config.assets.digest = true
# Add additional assets to the asset load path
# Rails.... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/config/initializers/active_record_schema_dumper.rb | config/initializers/active_record_schema_dumper.rb | # frozen_string_literal: true
class ActiveRecord::SchemaDumper
alias_method :original_index_parts, :index_parts
def index_parts(index)
parts = original_index_parts(index)
parts[0].delete!("\\")
parts
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/config/initializers/sidekiq_cron.rb | config/initializers/sidekiq_cron.rb | # frozen_string_literal: true
Sidekiq.configure_server do |config|
config.on(:startup) do
sidekiq_schedule = YAML.load_file(Rails.root.join("config", "sidekiq_schedule.yml"))
Sidekiq::Cron::Job.load_from_hash!(sidekiq_schedule, source: "schedule")
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/config/initializers/elasticsearch.rb | config/initializers/elasticsearch.rb | # frozen_string_literal: true
EsClient = Elasticsearch::Model.client = Elasticsearch::Client.new(
host: ENV.fetch("ELASTICSEARCH_HOST"),
retry_on_failure: 5,
transport_options: { request: { timeout: 5 } },
log: true
)
USE_ES_ALIASES = Rails.env.production? || (Rails.env.staging? && ENV["BRANCH_DEPLOYMENT"] !=... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/config/initializers/form_tag_helper.rb | config/initializers/form_tag_helper.rb | # frozen_string_literal: true
ActionView::Helpers::CsrfHelper.class_eval do
def csrf_meta_tags
return unless protect_against_forgery?
[
tag(:meta, name: "csrf-param", content: request_forgery_protection_token),
tag(:meta, name: "csrf-token", content: ApplicationController::TOKEN_PLACEHOLDER)
... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/config/initializers/reset_cloudflare_hmac_key.rb | config/initializers/reset_cloudflare_hmac_key.rb | # frozen_string_literal: true
Rails.application.credentials.cloudflare_hmac_key = "sample_key" if Rails.env.test?
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/config/initializers/000_facebook.rb | config/initializers/000_facebook.rb | # frozen_string_literal: true
FACEBOOK_APP_ID = GlobalConfig.get("FACEBOOK_APP_ID")
FACEBOOK_APP_SECRET = GlobalConfig.get("FACEBOOK_APP_SECRET")
FACEBOOK_OG_NAMESPACE = GlobalConfig.get("FACEBOOK_OG_NAMESPACE")
FACEBOOK_API_VERSION = GlobalConfig.get("FACEBOOK_API_VERSION", "v19.0")
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/config/initializers/react_on_rails.rb | config/initializers/react_on_rails.rb | # frozen_string_literal: true
# See https://github.com/shakacode/react_on_rails/blob/master/docs/basics/configuration.md
# for many more options.
module RenderingExtension
extend self
def custom_context(view_context)
pundit_user = view_context.pundit_user
{
design_settings: { font: { name: "ABC Fav... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/config/initializers/taxjar.rb | config/initializers/taxjar.rb | # frozen_string_literal: true
# TaxJar gives us two API keys: one for Sandbox, and one for Live.
# We're using the Live key in production, and the Sandbox key everywhere else.
TAXJAR_API_KEY = GlobalConfig.get("TAXJAR_API_KEY")
if Rails.env.production?
TAXJAR_ENDPOINT = "https://api.taxjar.com"
else
TAXJAR_ENDPOI... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/config/initializers/sprockets.rb | config/initializers/sprockets.rb | # frozen_string_literal: true
# Work around a segfault during assets compilation
# https://github.com/sass/sassc-ruby/issues/207#issuecomment-674626874
Sprockets.export_concurrent = false
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/config/initializers/rpush.rb | config/initializers/rpush.rb | # frozen_string_literal: true
Rpush.configure do |config|
# Supported clients are :active_record and :redis
config.client = :redis
# Options passed to Redis.new
config.redis_options = { url: "redis://#{ENV["RPUSH_REDIS_HOST"]}" }
# Frequency in seconds to check for new notifications.
config.push_poll = 2... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/config/initializers/united_states_zip_codes.rb | config/initializers/united_states_zip_codes.rb | # frozen_string_literal: true
# Known zip codes that don't show up in the US Zip Codes database.
KNOWN_ZIP_CODES = { "85144" => "AZ" }
# The United States Zip Codes website recommends that we update this file annually. https://www.unitedstateszipcodes.org/zip-code-database/
# Changes to 5-digit zip codes are infreque... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/config/initializers/hash.rb | config/initializers/hash.rb | # frozen_string_literal: true
class Hash
def deep_reject!(&block)
reject! do |key, value|
value.deep_reject!(&block) if value.is_a?(Hash)
yield(key, value)
end
self
end
def deep_values_strip!
transform_values! do |value|
if value.is_a?(String)
value.strip
elsif v... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/config/initializers/custom_domain.rb | config/initializers/custom_domain.rb | # frozen_string_literal: true
if Rails.env.production?
CUSTOM_DOMAIN_CNAME = GlobalConfig.get("CUSTOM_DOMAIN_CNAME_PROD", "domains.gumroad.com")
# CUSTOM_DOMAIN_STATIC_IP_HOST is for internal use. It will be used only to
# check if the custom domain is pointed to the static IP address.
CUSTOM_DOMAIN_STATIC_IP... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/config/initializers/backtrace_silencers.rb | config/initializers/backtrace_silencers.rb | # frozen_string_literal: true
# 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 silence... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/config/initializers/mime_types.rb | config/initializers/mime_types.rb | # frozen_string_literal: true
# Be sure to restart your server when you modify this file.
# Add new mime types for use in respond_to blocks:
# Mime::Type.register "text/richtext", :rtf
# Mime::Type.register_alias "text/html", :iphone
Mime::Type.register "image/svg+xml", :svg
Mime::Type.register "application/smil+xml"... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/config/initializers/003_stripe.rb | config/initializers/003_stripe.rb | # frozen_string_literal: true
Stripe.api_version = Rails.env.test? ? "2023-10-16" : "2023-10-16; risk_in_requirements_beta=v1; retrieve_tax_forms_beta=v1;"
# Ref: https://github.com/gumroad/web/issues/17770, https://stripe.com/docs/rate-limits#object-lock-timeouts
Stripe.max_network_retries = 3
if Rails.env.production... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/config/initializers/rack_attack.rb | config/initializers/rack_attack.rb | # frozen_string_literal: true
class Rack::Attack
redis_url = ENV.fetch("RACK_ATTACK_REDIS_HOST")
redis_client = Redis.new(url: "redis://#{redis_url}")
Rack::Attack.cache.store = Rack::Attack::StoreProxy::RedisStoreProxy.new(redis_client)
class Request < ::Rack::Request
# When the server is behind a loa... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/config/initializers/discover_meta_tags.rb | config/initializers/discover_meta_tags.rb | # frozen_string_literal: true
DISCOVER_META_TAGS = YAML.load_file("#{Rails.root}/config/discover_meta_tags.yml").freeze
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/config/initializers/tagged_logging.rb | config/initializers/tagged_logging.rb | # frozen_string_literal: true
Rails.application.config.log_tags = %i[subdomain uuid]
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/config/initializers/new_framework_defaults_7_1.rb | config/initializers/new_framework_defaults_7_1.rb | # frozen_string_literal: true
# Be sure to restart your server when you modify this file.
#
# This file eases your Rails 7.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 an... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/config/initializers/cors.rb | config/initializers/cors.rb | # frozen_string_literal: true
# Allow requests from all origins to API domain
Rails.application.config.middleware.insert_before 0, Rack::Cors do
allow do
origins "*"
resource "*",
headers: :any,
methods: [:get, :post, :put, :delete],
if: proc { |env| VALID_API_REQUEST_H... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/config/routes/admin.rb | config/routes/admin.rb | # frozen_string_literal: true
concern :commentable do
resources :comments, only: [:index, :create]
end
namespace :admin do
get "/", to: "base#index"
get :impersonate, to: "base#impersonate"
delete :unimpersonate, to: "base#unimpersonate"
get :redirect_to_stripe_dashboard, to: "base#redirect_to_stripe_dashbo... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/config/environments/test.rb | config/environments/test.rb | # frozen_string_literal: true
require "active_support/core_ext/integer/time"
# 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 r... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/config/environments/development.rb | config/environments/development.rb | # frozen_string_literal: true
require "active_support/core_ext/integer/time"
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# In the development environment your application's code is reloaded any time
# it changes. This slows down response ti... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/config/environments/staging.rb | config/environments/staging.rb | # frozen_string_literal: true
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. This eager loads... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/config/environments/production.rb | config/environments/production.rb | # frozen_string_literal: true
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. This eager loads... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
simplecov-ruby/simplecov | https://github.com/simplecov-ruby/simplecov/blob/afcf15e42fde20abbdb6fe9591a3e5d98acc088e/benchmarks/result.rb | benchmarks/result.rb | # frozen_string_literal: true
require "benchmark/ips"
require "coverage"
Coverage.start
# such meta, many wow
require_relative "../lib/simplecov"
require_relative "../test_projects/faked_project/lib/faked_project"
result = Coverage.result
class MyFormatter
def format(result)
result.files.map do |file|
"#... | ruby | MIT | afcf15e42fde20abbdb6fe9591a3e5d98acc088e | 2026-01-04T15:45:13.013465Z | false |
simplecov-ruby/simplecov | https://github.com/simplecov-ruby/simplecov/blob/afcf15e42fde20abbdb6fe9591a3e5d98acc088e/features/support/env.rb | features/support/env.rb | # frozen_string_literal: true
# While you're here, handy tip for debugging: try to attach @announce-output
# @announce-command to the scenarios/features to see what's going on
require "bundler"
Bundler.setup
require "capybara/cucumber"
require "capybara/apparition"
require "aruba/cucumber"
require "aruba/config/jruby... | ruby | MIT | afcf15e42fde20abbdb6fe9591a3e5d98acc088e | 2026-01-04T15:45:13.013465Z | false |
simplecov-ruby/simplecov | https://github.com/simplecov-ruby/simplecov/blob/afcf15e42fde20abbdb6fe9591a3e5d98acc088e/features/step_definitions/parameter_types.rb | features/step_definitions/parameter_types.rb | # frozen_string_literal: true
#
# Enforce the alphabetical execution of specs because rspec 2+ executes them
# randomly with `rspec spec` while we need them in an accurate order for coverage
# reports that include the spec files.
#
# This is due to the fact that coverage will not include the first loaded spec/test fil... | ruby | MIT | afcf15e42fde20abbdb6fe9591a3e5d98acc088e | 2026-01-04T15:45:13.013465Z | false |
simplecov-ruby/simplecov | https://github.com/simplecov-ruby/simplecov/blob/afcf15e42fde20abbdb6fe9591a3e5d98acc088e/features/step_definitions/simplecov_steps.rb | features/step_definitions/simplecov_steps.rb | # frozen_string_literal: true
# Just a shortcut to make framework setup more readable
# The test project is using separate config files to avoid specifying all of
# test/spec_helper in the features every time.
Given /^SimpleCov for (.*) is configured with:$/ do |framework, config_body|
framework_dir =
case frame... | ruby | MIT | afcf15e42fde20abbdb6fe9591a3e5d98acc088e | 2026-01-04T15:45:13.013465Z | false |
simplecov-ruby/simplecov | https://github.com/simplecov-ruby/simplecov/blob/afcf15e42fde20abbdb6fe9591a3e5d98acc088e/features/step_definitions/web_steps.rb | features/step_definitions/web_steps.rb | # frozen_string_literal: true
module WithinHelpers
def with_scope(locator)
locator ? within(locator) { yield } : yield
end
end
World(WithinHelpers)
When /^I open the coverage report$/ do
visit "/"
end
Given /^(?:|I )am on (.+)$/ do |path|
visit path
end
When /^(?:|I )go to (.+)$/ do |path|
visit path
... | ruby | MIT | afcf15e42fde20abbdb6fe9591a3e5d98acc088e | 2026-01-04T15:45:13.013465Z | false |
simplecov-ruby/simplecov | https://github.com/simplecov-ruby/simplecov/blob/afcf15e42fde20abbdb6fe9591a3e5d98acc088e/features/step_definitions/json_steps.rb | features/step_definitions/json_steps.rb | # frozen_string_literal: true
Then /^the JSON coverage report should match the output for the basic case$/ do
cd(".") do
json_report = JSON.parse(File.read("coverage/coverage.json"))
coverage_hash = json_report.fetch "coverage"
directory = Dir.pwd
expect(coverage_hash.fetch("#{directory}/lib/faked_p... | ruby | MIT | afcf15e42fde20abbdb6fe9591a3e5d98acc088e | 2026-01-04T15:45:13.013465Z | false |
simplecov-ruby/simplecov | https://github.com/simplecov-ruby/simplecov/blob/afcf15e42fde20abbdb6fe9591a3e5d98acc088e/features/step_definitions/old_coverage_json_steps.rb | features/step_definitions/old_coverage_json_steps.rb | # frozen_string_literal: true
RESULTSET_JSON_PATH = "coverage/.resultset.json"
PATH_PLACE_HOLDER = "$$path"
COMMAND_NAME = "RSpec Different Name to avoid overriding"
Given "the paths in the old .resultset.json are adjusted to the current environment" do
in_current_directory do
resultset_json_content = File.read... | ruby | MIT | afcf15e42fde20abbdb6fe9591a3e5d98acc088e | 2026-01-04T15:45:13.013465Z | false |
simplecov-ruby/simplecov | https://github.com/simplecov-ruby/simplecov/blob/afcf15e42fde20abbdb6fe9591a3e5d98acc088e/features/step_definitions/html_steps.rb | features/step_definitions/html_steps.rb | # frozen_string_literal: true
Then /^I should see the groups:$/ do |table|
expected_groups = table.hashes
# Given group names should be the same number than those rendered in report
expect(page).to have_css("#content .file_list_container", count: expected_groups.count)
# Verify each of the expected groups has... | ruby | MIT | afcf15e42fde20abbdb6fe9591a3e5d98acc088e | 2026-01-04T15:45:13.013465Z | false |
simplecov-ruby/simplecov | https://github.com/simplecov-ruby/simplecov/blob/afcf15e42fde20abbdb6fe9591a3e5d98acc088e/features/step_definitions/parallel_tests_steps.rb | features/step_definitions/parallel_tests_steps.rb | # frozen_string_literal: true
Then "I should see the line coverage results for the parallel tests project" do
steps %(
Then I should see the groups:
| name | coverage | files |
| All Files | 89.36% | 9 |
And I should see the source files:
| name | coverage |
| li... | ruby | MIT | afcf15e42fde20abbdb6fe9591a3e5d98acc088e | 2026-01-04T15:45:13.013465Z | false |
simplecov-ruby/simplecov | https://github.com/simplecov-ruby/simplecov/blob/afcf15e42fde20abbdb6fe9591a3e5d98acc088e/spec/filters_spec.rb | spec/filters_spec.rb | # frozen_string_literal: true
require "helper"
describe SimpleCov::SourceFile do
subject do
SimpleCov::SourceFile.new(source_fixture("sample.rb"), [nil, 1, 1, 1, nil, nil, 1, 0, nil, nil])
end
it "doesn't match a new SimpleCov::StringFilter 'foobar'" do
expect(SimpleCov::StringFilter.new("foobar")).not... | ruby | MIT | afcf15e42fde20abbdb6fe9591a3e5d98acc088e | 2026-01-04T15:45:13.013465Z | false |
simplecov-ruby/simplecov | https://github.com/simplecov-ruby/simplecov/blob/afcf15e42fde20abbdb6fe9591a3e5d98acc088e/spec/result_spec.rb | spec/result_spec.rb | # frozen_string_literal: true
require "helper"
describe SimpleCov::Result do
context "with a (mocked) Coverage.result" do
before do
@prev_filters = SimpleCov.filters
SimpleCov.filters = []
@prev_groups = SimpleCov.groups
SimpleCov.groups = {}
@prev_formatter = SimpleCov.formatter
... | ruby | MIT | afcf15e42fde20abbdb6fe9591a3e5d98acc088e | 2026-01-04T15:45:13.013465Z | false |
simplecov-ruby/simplecov | https://github.com/simplecov-ruby/simplecov/blob/afcf15e42fde20abbdb6fe9591a3e5d98acc088e/spec/multi_formatter_spec.rb | spec/multi_formatter_spec.rb | # frozen_string_literal: true
require "helper"
require "simplecov/formatter/multi_formatter"
describe SimpleCov::Formatter::MultiFormatter do
describe ".[]" do
# Regression test for https://github.com/simplecov-ruby/simplecov/issues/428
it "constructs a formatter with multiple children" do
# Silence ... | ruby | MIT | afcf15e42fde20abbdb6fe9591a3e5d98acc088e | 2026-01-04T15:45:13.013465Z | false |
simplecov-ruby/simplecov | https://github.com/simplecov-ruby/simplecov/blob/afcf15e42fde20abbdb6fe9591a3e5d98acc088e/spec/file_list_spec.rb | spec/file_list_spec.rb | # frozen_string_literal: true
require "helper"
describe SimpleCov::Result do
subject do
original_result = {
source_fixture("sample.rb") => {
"lines" => [nil, 1, 1, 1, nil, nil, 1, 1, nil, nil],
"branches" => {}
},
source_fixture("app/models/user.rb") => {
"lines" => [ni... | ruby | MIT | afcf15e42fde20abbdb6fe9591a3e5d98acc088e | 2026-01-04T15:45:13.013465Z | false |
simplecov-ruby/simplecov | https://github.com/simplecov-ruby/simplecov/blob/afcf15e42fde20abbdb6fe9591a3e5d98acc088e/spec/coverage_for_eval_spec.rb | spec/coverage_for_eval_spec.rb | # frozen_string_literal: true
require "helper"
RSpec.describe "coverage for eval" do
if SimpleCov.coverage_for_eval_supported?
around do |test|
Dir.chdir(File.join(File.dirname(__FILE__), "fixtures", "eval_test")) do
FileUtils.rm_rf("./coverage")
test.call
end
end
before do
... | ruby | MIT | afcf15e42fde20abbdb6fe9591a3e5d98acc088e | 2026-01-04T15:45:13.013465Z | false |
simplecov-ruby/simplecov | https://github.com/simplecov-ruby/simplecov/blob/afcf15e42fde20abbdb6fe9591a3e5d98acc088e/spec/command_guesser_spec.rb | spec/command_guesser_spec.rb | # frozen_string_literal: true
require "helper"
describe SimpleCov::CommandGuesser do
subject { SimpleCov::CommandGuesser }
it 'correctly guesses "Unit Tests" for unit tests' do
subject.original_run_command = "/some/path/test/units/foo_bar_test.rb"
expect(subject.guess).to eq("Unit Tests")
subject.ori... | ruby | MIT | afcf15e42fde20abbdb6fe9591a3e5d98acc088e | 2026-01-04T15:45:13.013465Z | false |
simplecov-ruby/simplecov | https://github.com/simplecov-ruby/simplecov/blob/afcf15e42fde20abbdb6fe9591a3e5d98acc088e/spec/coverage_statistics_spec.rb | spec/coverage_statistics_spec.rb | # frozen_string_literal: true
require "helper"
RSpec.describe SimpleCov::CoverageStatistics do
describe ".new" do
it "retains statistics and computes new ones" do
statistics = described_class.new(covered: 4, missed: 6, total_strength: 14)
expect(statistics.covered).to eq 4
expect(statistics.m... | ruby | MIT | afcf15e42fde20abbdb6fe9591a3e5d98acc088e | 2026-01-04T15:45:13.013465Z | false |
simplecov-ruby/simplecov | https://github.com/simplecov-ruby/simplecov/blob/afcf15e42fde20abbdb6fe9591a3e5d98acc088e/spec/configuration_spec.rb | spec/configuration_spec.rb | # frozen_string_literal: true
require "helper"
describe SimpleCov::Configuration do
let(:config_class) do
Class.new do
include SimpleCov::Configuration
end
end
let(:config) { config_class.new }
describe "#print_error_status" do
subject { config.print_error_status }
context "when not ma... | ruby | MIT | afcf15e42fde20abbdb6fe9591a3e5d98acc088e | 2026-01-04T15:45:13.013465Z | false |
simplecov-ruby/simplecov | https://github.com/simplecov-ruby/simplecov/blob/afcf15e42fde20abbdb6fe9591a3e5d98acc088e/spec/default_formatter_spec.rb | spec/default_formatter_spec.rb | # frozen_string_literal: true
require "helper"
require "simplecov_json_formatter"
describe SimpleCov::Formatter do
describe ".from_env" do
let(:env) { {"CC_TEST_REPORTER_ID" => "4c9f1de6193f30799e9a5d5c082692abecc1fd2c6aa62c621af7b2a910761970"} }
context "when CC_TEST_REPORTER_ID environment variable is se... | ruby | MIT | afcf15e42fde20abbdb6fe9591a3e5d98acc088e | 2026-01-04T15:45:13.013465Z | false |
simplecov-ruby/simplecov | https://github.com/simplecov-ruby/simplecov/blob/afcf15e42fde20abbdb6fe9591a3e5d98acc088e/spec/gemspec_spec.rb | spec/gemspec_spec.rb | # frozen_string_literal: true
require "open3"
RSpec.describe "gemspec sanity" do
after do
File.delete(Dir.glob("simplecov-*.gem").first)
end
let(:build) do
Bundler.with_original_env do
Open3.capture3("gem build simplecov.gemspec")
end
end
it "has no warnings" do
expect(build[1]).not_... | ruby | MIT | afcf15e42fde20abbdb6fe9591a3e5d98acc088e | 2026-01-04T15:45:13.013465Z | false |
simplecov-ruby/simplecov | https://github.com/simplecov-ruby/simplecov/blob/afcf15e42fde20abbdb6fe9591a3e5d98acc088e/spec/last_run_spec.rb | spec/last_run_spec.rb | # frozen_string_literal: true
require "helper"
describe SimpleCov::LastRun do
subject { SimpleCov::LastRun }
it "defines a last_run_path" do
expect(subject.last_run_path).to include "tmp/coverage/.last_run.json"
end
it "writes json to its last_run_path that can be parsed again" do
structure = [{"key... | ruby | MIT | afcf15e42fde20abbdb6fe9591a3e5d98acc088e | 2026-01-04T15:45:13.013465Z | false |
simplecov-ruby/simplecov | https://github.com/simplecov-ruby/simplecov/blob/afcf15e42fde20abbdb6fe9591a3e5d98acc088e/spec/return_codes_spec.rb | spec/return_codes_spec.rb | # frozen_string_literal: true
require "helper"
# Make sure that exit codes of tests are propagated properly
# See https://github.com/simplecov-ruby/simplecov/issues/5
describe "return codes" do
context "inside fixtures/frameworks" do
around do |test|
Dir.chdir(File.join(File.dirname(__FILE__), "fixtures",... | ruby | MIT | afcf15e42fde20abbdb6fe9591a3e5d98acc088e | 2026-01-04T15:45:13.013465Z | false |
simplecov-ruby/simplecov | https://github.com/simplecov-ruby/simplecov/blob/afcf15e42fde20abbdb6fe9591a3e5d98acc088e/spec/result_merger_spec.rb | spec/result_merger_spec.rb | # frozen_string_literal: true
require "helper"
require "tempfile"
require "timeout"
describe SimpleCov::ResultMerger do
after do
FileUtils.rm_f(SimpleCov::ResultMerger.resultset_path)
end
let(:resultset1) do
{
source_fixture("sample.rb") => {"lines" => [nil, 1, 1, 1, nil, nil, 1, 1, nil, nil]},
... | ruby | MIT | afcf15e42fde20abbdb6fe9591a3e5d98acc088e | 2026-01-04T15:45:13.013465Z | false |
simplecov-ruby/simplecov | https://github.com/simplecov-ruby/simplecov/blob/afcf15e42fde20abbdb6fe9591a3e5d98acc088e/spec/lines_classifier_spec.rb | spec/lines_classifier_spec.rb | # frozen_string_literal: true
require "helper"
require "simplecov/lines_classifier"
describe SimpleCov::LinesClassifier do
describe "#classify" do
describe "relevant lines" do
it "determines code as relevant" do
classified_lines = subject.classify [
"module Foo",
" class Baz",... | ruby | MIT | afcf15e42fde20abbdb6fe9591a3e5d98acc088e | 2026-01-04T15:45:13.013465Z | false |
simplecov-ruby/simplecov | https://github.com/simplecov-ruby/simplecov/blob/afcf15e42fde20abbdb6fe9591a3e5d98acc088e/spec/source_file_spec.rb | spec/source_file_spec.rb | # frozen_string_literal: true
require "helper"
describe SimpleCov::SourceFile do
COVERAGE_FOR_SAMPLE_RB = {
"lines" => [nil, 1, 1, 1, nil, nil, 1, 0, nil, nil, nil, 1, 0, nil, nil, nil],
"branches" => {}
}.freeze
COVERAGE_FOR_SAMPLE_RB_WITH_MORE_LINES = {
"lines" => [nil, 1, 1, 1, nil, nil, 1... | ruby | MIT | afcf15e42fde20abbdb6fe9591a3e5d98acc088e | 2026-01-04T15:45:13.013465Z | false |
simplecov-ruby/simplecov | https://github.com/simplecov-ruby/simplecov/blob/afcf15e42fde20abbdb6fe9591a3e5d98acc088e/spec/config_loader_spec.rb | spec/config_loader_spec.rb | # frozen_string_literal: true
require "helper"
describe "loading config" do
context "without ENV[HOME]" do
it "does not raise any errors" do
home = ENV.delete("HOME")
begin
expect { load "simplecov/load_global_config.rb" }.not_to raise_error
ensure
ENV["HOME"] = home
end
... | ruby | MIT | afcf15e42fde20abbdb6fe9591a3e5d98acc088e | 2026-01-04T15:45:13.013465Z | false |
simplecov-ruby/simplecov | https://github.com/simplecov-ruby/simplecov/blob/afcf15e42fde20abbdb6fe9591a3e5d98acc088e/spec/helper.rb | spec/helper.rb | # frozen_string_literal: true
require "rspec"
require "stringio"
require "open3"
# loaded before simplecov to also capture parse time warnings
require "support/fail_rspec_on_ruby_warning"
require "simplecov"
SimpleCov.coverage_dir("tmp/coverage")
def source_fixture(filename)
File.join(source_fixture_base_directory... | ruby | MIT | afcf15e42fde20abbdb6fe9591a3e5d98acc088e | 2026-01-04T15:45:13.013465Z | false |
simplecov-ruby/simplecov | https://github.com/simplecov-ruby/simplecov/blob/afcf15e42fde20abbdb6fe9591a3e5d98acc088e/spec/deleted_source_spec.rb | spec/deleted_source_spec.rb | # frozen_string_literal: true
require "helper"
# Test to verify correct handling of deleted files
# See https://github.com/simplecov-ruby/simplecov/issues/9
describe "A source file which is subsequently deleted" do
it "does not cause an error" do
Dir.chdir(File.join(File.dirname(__FILE__), "fixtures")) do
... | ruby | MIT | afcf15e42fde20abbdb6fe9591a3e5d98acc088e | 2026-01-04T15:45:13.013465Z | false |
simplecov-ruby/simplecov | https://github.com/simplecov-ruby/simplecov/blob/afcf15e42fde20abbdb6fe9591a3e5d98acc088e/spec/defaults_spec.rb | spec/defaults_spec.rb | # frozen_string_literal: true
require "helper"
describe SimpleCov do
skip "requires the default configuration" if ENV["SIMPLECOV_NO_DEFAULTS"]
context "profiles" do
let(:config_class) do
Class.new do
include SimpleCov::Configuration
def load_profile(name)
configure(&SimpleCov... | ruby | MIT | afcf15e42fde20abbdb6fe9591a3e5d98acc088e | 2026-01-04T15:45:13.013465Z | false |
simplecov-ruby/simplecov | https://github.com/simplecov-ruby/simplecov/blob/afcf15e42fde20abbdb6fe9591a3e5d98acc088e/spec/useless_results_remover_spec.rb | spec/useless_results_remover_spec.rb | # frozen_string_literal: true
require "helper"
describe SimpleCov::UselessResultsRemover do
subject do
SimpleCov::UselessResultsRemover.call(result_set)
end
let(:gem_file_path) { "usr/bin/lib/2.5.0/gems/sample-gem/sample.rb" }
let(:source_path) { source_fixture("app/models/user.rb") }
let(:result_set)... | ruby | MIT | afcf15e42fde20abbdb6fe9591a3e5d98acc088e | 2026-01-04T15:45:13.013465Z | false |
simplecov-ruby/simplecov | https://github.com/simplecov-ruby/simplecov/blob/afcf15e42fde20abbdb6fe9591a3e5d98acc088e/spec/simplecov_spec.rb | spec/simplecov_spec.rb | # frozen_string_literal: true
require "helper"
require "coverage"
describe SimpleCov do
describe ".result" do
before do
SimpleCov.clear_result
allow(Coverage).to receive(:result).once.and_return({})
end
context "with merging disabled" do
before do
allow(SimpleCov).to receive(:... | ruby | MIT | afcf15e42fde20abbdb6fe9591a3e5d98acc088e | 2026-01-04T15:45:13.013465Z | false |
simplecov-ruby/simplecov | https://github.com/simplecov-ruby/simplecov/blob/afcf15e42fde20abbdb6fe9591a3e5d98acc088e/spec/support/fail_rspec_on_ruby_warning.rb | spec/support/fail_rspec_on_ruby_warning.rb | # frozen_string_literal: true
# Borrowed and heavily adjusted from:
# https://github.com/metricfu/metric_fu/blob/master/spec/capture_warnings.rb
require "fileutils"
class FailOnWarnings
def initialize
@stderr_stream = StringIO.new
@app_root = Dir.pwd
end
def collect_warnings
$stderr = @stderr_strea... | ruby | MIT | afcf15e42fde20abbdb6fe9591a3e5d98acc088e | 2026-01-04T15:45:13.013465Z | false |
simplecov-ruby/simplecov | https://github.com/simplecov-ruby/simplecov/blob/afcf15e42fde20abbdb6fe9591a3e5d98acc088e/spec/exit_codes/minimum_coverage_by_file_check_spec.rb | spec/exit_codes/minimum_coverage_by_file_check_spec.rb | # frozen_string_literal: true
require "helper"
RSpec.describe SimpleCov::ExitCodes::MinimumCoverageByFileCheck do
subject { described_class.new(result, minimum_coverage_by_file) }
let(:result) do
instance_double(SimpleCov::Result, coverage_statistics_by_file: stats)
end
let(:stats) do
{
line: [... | ruby | MIT | afcf15e42fde20abbdb6fe9591a3e5d98acc088e | 2026-01-04T15:45:13.013465Z | false |
simplecov-ruby/simplecov | https://github.com/simplecov-ruby/simplecov/blob/afcf15e42fde20abbdb6fe9591a3e5d98acc088e/spec/exit_codes/minimum_overall_coverage_check_spec.rb | spec/exit_codes/minimum_overall_coverage_check_spec.rb | # frozen_string_literal: true
require "helper"
RSpec.describe SimpleCov::ExitCodes::MinimumOverallCoverageCheck do
subject { described_class.new(result, minimum_coverage) }
let(:result) do
instance_double(SimpleCov::Result, coverage_statistics: stats)
end
let(:stats) do
{
line: SimpleCov::Cover... | ruby | MIT | afcf15e42fde20abbdb6fe9591a3e5d98acc088e | 2026-01-04T15:45:13.013465Z | false |
simplecov-ruby/simplecov | https://github.com/simplecov-ruby/simplecov/blob/afcf15e42fde20abbdb6fe9591a3e5d98acc088e/spec/exit_codes/maximum_coverage_drop_check_spec.rb | spec/exit_codes/maximum_coverage_drop_check_spec.rb | # frozen_string_literal: true
require "helper"
RSpec.describe SimpleCov::ExitCodes::MaximumCoverageDropCheck do
subject { described_class.new(result, maximum_coverage_drop) }
let(:result) do
instance_double(SimpleCov::Result, coverage_statistics: stats)
end
let(:stats) do
{
line: SimpleCov::Cov... | ruby | MIT | afcf15e42fde20abbdb6fe9591a3e5d98acc088e | 2026-01-04T15:45:13.013465Z | false |
simplecov-ruby/simplecov | https://github.com/simplecov-ruby/simplecov/blob/afcf15e42fde20abbdb6fe9591a3e5d98acc088e/spec/combine/results_combiner_spec.rb | spec/combine/results_combiner_spec.rb | # frozen_string_literal: true
require "helper"
describe SimpleCov::Combine::ResultsCombiner do
describe "with two faked coverage resultsets" do
let(:resultset1) do
{
source_fixture("sample.rb") => {
"lines" => [nil, 1, 1, 1, nil, nil, 1, 1, nil, nil],
"branches" => {[:if, 3, 8,... | ruby | MIT | afcf15e42fde20abbdb6fe9591a3e5d98acc088e | 2026-01-04T15:45:13.013465Z | false |
simplecov-ruby/simplecov | https://github.com/simplecov-ruby/simplecov/blob/afcf15e42fde20abbdb6fe9591a3e5d98acc088e/spec/fixtures/resultset2.rb | spec/fixtures/resultset2.rb | class Resultset
VERSION = 2
end
| ruby | MIT | afcf15e42fde20abbdb6fe9591a3e5d98acc088e | 2026-01-04T15:45:13.013465Z | false |
simplecov-ruby/simplecov | https://github.com/simplecov-ruby/simplecov/blob/afcf15e42fde20abbdb6fe9591a3e5d98acc088e/spec/fixtures/branches.rb | spec/fixtures/branches.rb | class Branches
def call(arg)
return if arg < 0
_val = (arg == 42 ? :yes : :no)
if arg.odd?
:yes
else
:no
end
end
end
| ruby | MIT | afcf15e42fde20abbdb6fe9591a3e5d98acc088e | 2026-01-04T15:45:13.013465Z | false |
simplecov-ruby/simplecov | https://github.com/simplecov-ruby/simplecov/blob/afcf15e42fde20abbdb6fe9591a3e5d98acc088e/spec/fixtures/inline.rb | spec/fixtures/inline.rb | class Inline
def call(arg)
String(arg == 42 ? :yes : :no)
String(
if arg.odd?
:yes
else
:no
end
)
end
end
| ruby | MIT | afcf15e42fde20abbdb6fe9591a3e5d98acc088e | 2026-01-04T15:45:13.013465Z | false |
simplecov-ruby/simplecov | https://github.com/simplecov-ruby/simplecov/blob/afcf15e42fde20abbdb6fe9591a3e5d98acc088e/spec/fixtures/nocov_complex.rb | spec/fixtures/nocov_complex.rb | # So much skippping
# rubocop:disable Metrics/MethodLength, Lint/Void
module NoCovComplex
def self.call(arg)
# :nocov:
if arg == 42
0
# :nocov:
else
puts "yolo"
end
arg += 1 if arg.odd?
# :nocov:
arg -= 1 while arg > 40
case arg
when 1..20
:nope
# :noco... | ruby | MIT | afcf15e42fde20abbdb6fe9591a3e5d98acc088e | 2026-01-04T15:45:13.013465Z | false |
simplecov-ruby/simplecov | https://github.com/simplecov-ruby/simplecov/blob/afcf15e42fde20abbdb6fe9591a3e5d98acc088e/spec/fixtures/parallel_tests.rb | spec/fixtures/parallel_tests.rb | # foo
puts "foo"
# bar
puts "bar"
| ruby | MIT | afcf15e42fde20abbdb6fe9591a3e5d98acc088e | 2026-01-04T15:45:13.013465Z | false |
simplecov-ruby/simplecov | https://github.com/simplecov-ruby/simplecov/blob/afcf15e42fde20abbdb6fe9591a3e5d98acc088e/spec/fixtures/uneven_nocovs.rb | spec/fixtures/uneven_nocovs.rb | module UnevenNocov
def self.call(arg)
# :nocov:
if arg.odd?
:odd
elsif arg == 30
:mop
# :nocov:
elsif arg == 42
:yay
# :nocov:
else
:nay
end
end
end
| ruby | MIT | afcf15e42fde20abbdb6fe9591a3e5d98acc088e | 2026-01-04T15:45:13.013465Z | false |
simplecov-ruby/simplecov | https://github.com/simplecov-ruby/simplecov/blob/afcf15e42fde20abbdb6fe9591a3e5d98acc088e/spec/fixtures/nested_branches.rb | spec/fixtures/nested_branches.rb | # yes rubocop you are right but I want to test nesting!
# rubocop:disable Metrics/BlockNesting
module NestedBranches
def self.call(arg)
if arg.even?
if arg == 42
arg -= 1 while arg > 40
:ok
end
else
:nope
end
end
end
# rubocop:enable Metrics/BlockNesting
| ruby | MIT | afcf15e42fde20abbdb6fe9591a3e5d98acc088e | 2026-01-04T15:45:13.013465Z | false |
simplecov-ruby/simplecov | https://github.com/simplecov-ruby/simplecov/blob/afcf15e42fde20abbdb6fe9591a3e5d98acc088e/spec/fixtures/resultset1.rb | spec/fixtures/resultset1.rb | puts "foo"
puts "foo"
puts "foo"
puts "foo"
| ruby | MIT | afcf15e42fde20abbdb6fe9591a3e5d98acc088e | 2026-01-04T15:45:13.013465Z | false |
simplecov-ruby/simplecov | https://github.com/simplecov-ruby/simplecov/blob/afcf15e42fde20abbdb6fe9591a3e5d98acc088e/spec/fixtures/skipped_and_executed.rb | spec/fixtures/skipped_and_executed.rb | # So much skipping
# :nocov:
class Foo
def bar(arg)
if arg == 42
0
else
1
end
end
end
# :nocov:
| ruby | MIT | afcf15e42fde20abbdb6fe9591a3e5d98acc088e | 2026-01-04T15:45:13.013465Z | false |
simplecov-ruby/simplecov | https://github.com/simplecov-ruby/simplecov/blob/afcf15e42fde20abbdb6fe9591a3e5d98acc088e/spec/fixtures/empty_euc-jp.rb | spec/fixtures/empty_euc-jp.rb | ruby | MIT | afcf15e42fde20abbdb6fe9591a3e5d98acc088e | 2026-01-04T15:45:13.013465Z | false | |
simplecov-ruby/simplecov | https://github.com/simplecov-ruby/simplecov/blob/afcf15e42fde20abbdb6fe9591a3e5d98acc088e/spec/fixtures/deleted_source_sample.rb | spec/fixtures/deleted_source_sample.rb | $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), "..", ".."))
require "lib/simplecov"
SimpleCov.start { command_name "Test" }
dir = __dir__
file = File.join(dir, "generated_buddha.rb")
code = %{
def kill_the_buddha(z)
z**z
end
}
File.open(file, "w") { |f| f.print code }
load file
File.unlink file
raise unl... | ruby | MIT | afcf15e42fde20abbdb6fe9591a3e5d98acc088e | 2026-01-04T15:45:13.013465Z | false |
simplecov-ruby/simplecov | https://github.com/simplecov-ruby/simplecov/blob/afcf15e42fde20abbdb6fe9591a3e5d98acc088e/spec/fixtures/coverer.rb | spec/fixtures/coverer.rb | # Script to gather coverage data to use in tests to go along with fixtures
require "coverage"
Coverage.start(:all)
require_relative "uneven_nocovs"
UnevenNocov.call(42)
p Coverage.result
| ruby | MIT | afcf15e42fde20abbdb6fe9591a3e5d98acc088e | 2026-01-04T15:45:13.013465Z | false |
simplecov-ruby/simplecov | https://github.com/simplecov-ruby/simplecov/blob/afcf15e42fde20abbdb6fe9591a3e5d98acc088e/spec/fixtures/case.rb | spec/fixtures/case.rb | module Case
def self.call(arg)
case arg
when 0...23
:foo
when 40..50
:bar
when Integer
:baz
else
:nope
end
end
end
| ruby | MIT | afcf15e42fde20abbdb6fe9591a3e5d98acc088e | 2026-01-04T15:45:13.013465Z | false |
simplecov-ruby/simplecov | https://github.com/simplecov-ruby/simplecov/blob/afcf15e42fde20abbdb6fe9591a3e5d98acc088e/spec/fixtures/conditionally_loaded_2.rb | spec/fixtures/conditionally_loaded_2.rb | # some comment
puts "wargh"
puts "wargh 2"
| ruby | MIT | afcf15e42fde20abbdb6fe9591a3e5d98acc088e | 2026-01-04T15:45:13.013465Z | false |
simplecov-ruby/simplecov | https://github.com/simplecov-ruby/simplecov/blob/afcf15e42fde20abbdb6fe9591a3e5d98acc088e/spec/fixtures/sample.rb | spec/fixtures/sample.rb | # Foo class
class Foo
def initialize
@foo = "baz"
end
def bar
@foo
end
# :nocov:
def skipped
@foo * 2
end
# :nocov:
end
| ruby | MIT | afcf15e42fde20abbdb6fe9591a3e5d98acc088e | 2026-01-04T15:45:13.013465Z | false |
simplecov-ruby/simplecov | https://github.com/simplecov-ruby/simplecov/blob/afcf15e42fde20abbdb6fe9591a3e5d98acc088e/spec/fixtures/elsif.rb | spec/fixtures/elsif.rb | module Elsif
def self.call(arg)
if arg.odd?
:odd
elsif arg == 30
:mop
elsif arg == 42
:yay
else
:nay
end
end
end
| ruby | MIT | afcf15e42fde20abbdb6fe9591a3e5d98acc088e | 2026-01-04T15:45:13.013465Z | false |
simplecov-ruby/simplecov | https://github.com/simplecov-ruby/simplecov/blob/afcf15e42fde20abbdb6fe9591a3e5d98acc088e/spec/fixtures/never.rb | spec/fixtures/never.rb | # This class is purely some
# comments
| ruby | MIT | afcf15e42fde20abbdb6fe9591a3e5d98acc088e | 2026-01-04T15:45:13.013465Z | false |
simplecov-ruby/simplecov | https://github.com/simplecov-ruby/simplecov/blob/afcf15e42fde20abbdb6fe9591a3e5d98acc088e/spec/fixtures/case_without_else.rb | spec/fixtures/case_without_else.rb | module Case
def self.call(arg)
case arg
when 0...23
:foo
when 40..50
:bar
when Integer
:baz
end
end
end
| ruby | MIT | afcf15e42fde20abbdb6fe9591a3e5d98acc088e | 2026-01-04T15:45:13.013465Z | false |
simplecov-ruby/simplecov | https://github.com/simplecov-ruby/simplecov/blob/afcf15e42fde20abbdb6fe9591a3e5d98acc088e/spec/fixtures/utf-8-magic.rb | spec/fixtures/utf-8-magic.rb | # encoding: UTF-8
puts "135°C"
| ruby | MIT | afcf15e42fde20abbdb6fe9591a3e5d98acc088e | 2026-01-04T15:45:13.013465Z | false |
simplecov-ruby/simplecov | https://github.com/simplecov-ruby/simplecov/blob/afcf15e42fde20abbdb6fe9591a3e5d98acc088e/spec/fixtures/utf-8.rb | spec/fixtures/utf-8.rb | puts "135°C"
| ruby | MIT | afcf15e42fde20abbdb6fe9591a3e5d98acc088e | 2026-01-04T15:45:13.013465Z | false |
simplecov-ruby/simplecov | https://github.com/simplecov-ruby/simplecov/blob/afcf15e42fde20abbdb6fe9591a3e5d98acc088e/spec/fixtures/conditionally_loaded_1.rb | spec/fixtures/conditionally_loaded_1.rb | # some comment
puts "wargh"
puts "wargh 1"
| ruby | MIT | afcf15e42fde20abbdb6fe9591a3e5d98acc088e | 2026-01-04T15:45:13.013465Z | false |
simplecov-ruby/simplecov | https://github.com/simplecov-ruby/simplecov/blob/afcf15e42fde20abbdb6fe9591a3e5d98acc088e/spec/fixtures/single_nocov.rb | spec/fixtures/single_nocov.rb | # :nocov:
module SingleNocov
def self.call(arg)
if arg.odd?
:odd
elsif arg == 30
:mop
elsif arg == 42
:yay
else
:nay
end
end
end
| ruby | MIT | afcf15e42fde20abbdb6fe9591a3e5d98acc088e | 2026-01-04T15:45:13.013465Z | false |
simplecov-ruby/simplecov | https://github.com/simplecov-ruby/simplecov/blob/afcf15e42fde20abbdb6fe9591a3e5d98acc088e/spec/fixtures/branch_tester_script.rb | spec/fixtures/branch_tester_script.rb | # Adapted from https://github.com/simplecov-ruby/simplecov/pull/694#issuecomment-562097006
# rubocop:disable all
x = 1
x.eql?(4) ? "4" : x
puts x unless x.eql?(5)
unless x == 5
puts "Ola.."
end
unless x != 5
puts "Ola.."
end
unless x != 5
puts "Ola.."
else
puts "text"
end
puts x if x.eql?(5)
if x != 5
pu... | ruby | MIT | afcf15e42fde20abbdb6fe9591a3e5d98acc088e | 2026-01-04T15:45:13.013465Z | false |
simplecov-ruby/simplecov | https://github.com/simplecov-ruby/simplecov/blob/afcf15e42fde20abbdb6fe9591a3e5d98acc088e/spec/fixtures/skipped.rb | spec/fixtures/skipped.rb | # Not relevant
# :nocov:
# Hash.new
# :nocov:
| ruby | MIT | afcf15e42fde20abbdb6fe9591a3e5d98acc088e | 2026-01-04T15:45:13.013465Z | false |
simplecov-ruby/simplecov | https://github.com/simplecov-ruby/simplecov/blob/afcf15e42fde20abbdb6fe9591a3e5d98acc088e/spec/fixtures/app/controllers/sample_controller.rb | spec/fixtures/app/controllers/sample_controller.rb | # Foo class
class Foo
def initialize
@foo = "baz"
end
def bar
@foo
end
end
| ruby | MIT | afcf15e42fde20abbdb6fe9591a3e5d98acc088e | 2026-01-04T15:45:13.013465Z | false |
simplecov-ruby/simplecov | https://github.com/simplecov-ruby/simplecov/blob/afcf15e42fde20abbdb6fe9591a3e5d98acc088e/spec/fixtures/app/models/user.rb | spec/fixtures/app/models/user.rb | # Foo class
class Foo
def initialize
@foo = "baz"
end
def bar
@foo
end
end
| ruby | MIT | afcf15e42fde20abbdb6fe9591a3e5d98acc088e | 2026-01-04T15:45:13.013465Z | false |
simplecov-ruby/simplecov | https://github.com/simplecov-ruby/simplecov/blob/afcf15e42fde20abbdb6fe9591a3e5d98acc088e/spec/fixtures/eval_test/eval_test.rb | spec/fixtures/eval_test/eval_test.rb | require "simplecov"
SimpleCov.enable_coverage_for_eval
SimpleCov.start "rails"
file = File.join(__dir__, "eval_test.erb")
erb = ERB.new(File.read(file))
erb.filename = file
erb.run
| ruby | MIT | afcf15e42fde20abbdb6fe9591a3e5d98acc088e | 2026-01-04T15:45:13.013465Z | false |
simplecov-ruby/simplecov | https://github.com/simplecov-ruby/simplecov/blob/afcf15e42fde20abbdb6fe9591a3e5d98acc088e/spec/fixtures/frameworks/rspec_bad.rb | spec/fixtures/frameworks/rspec_bad.rb | $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), "..", "..", ".."))
require "lib/simplecov"
require "rspec"
SimpleCov.print_error_status = ENV["PRINT_ERROR_STATUS"] == "true" if ENV.key? "PRINT_ERROR_STATUS"
SimpleCov.start
describe "exit status" do
it "exits with a non-zero exit status when assertion fails" do
... | ruby | MIT | afcf15e42fde20abbdb6fe9591a3e5d98acc088e | 2026-01-04T15:45:13.013465Z | false |
simplecov-ruby/simplecov | https://github.com/simplecov-ruby/simplecov/blob/afcf15e42fde20abbdb6fe9591a3e5d98acc088e/spec/fixtures/frameworks/rspec_good.rb | spec/fixtures/frameworks/rspec_good.rb | $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), "..", "..", ".."))
require "lib/simplecov"
require "rspec"
SimpleCov.start
describe "exit status" do
it "exits with a zero exit status when assertion fails" do
expect(1).to eq(1)
end
end
| ruby | MIT | afcf15e42fde20abbdb6fe9591a3e5d98acc088e | 2026-01-04T15:45:13.013465Z | false |
simplecov-ruby/simplecov | https://github.com/simplecov-ruby/simplecov/blob/afcf15e42fde20abbdb6fe9591a3e5d98acc088e/spec/fixtures/frameworks/testunit_good.rb | spec/fixtures/frameworks/testunit_good.rb | $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), "..", "..", ".."))
require "lib/simplecov"
SimpleCov.start
require "test/unit"
class FooTest < Test::Unit::TestCase
def test_foo
assert true
end
end
| ruby | MIT | afcf15e42fde20abbdb6fe9591a3e5d98acc088e | 2026-01-04T15:45:13.013465Z | false |
simplecov-ruby/simplecov | https://github.com/simplecov-ruby/simplecov/blob/afcf15e42fde20abbdb6fe9591a3e5d98acc088e/spec/fixtures/frameworks/testunit_bad.rb | spec/fixtures/frameworks/testunit_bad.rb | $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), "..", "..", ".."))
require "lib/simplecov"
SimpleCov.print_error_status = ENV["PRINT_ERROR_STATUS"] == "true" if ENV.key? "PRINT_ERROR_STATUS"
SimpleCov.start
require "test/unit"
class FooTest < Test::Unit::TestCase
def test_foo
assert false
end
end
| ruby | MIT | afcf15e42fde20abbdb6fe9591a3e5d98acc088e | 2026-01-04T15:45:13.013465Z | false |
simplecov-ruby/simplecov | https://github.com/simplecov-ruby/simplecov/blob/afcf15e42fde20abbdb6fe9591a3e5d98acc088e/spec/source_file/line_spec.rb | spec/source_file/line_spec.rb | # frozen_string_literal: true
require "helper"
describe SimpleCov::SourceFile::Line do
context "a source line" do
subject do
SimpleCov::SourceFile::Line.new("# the ruby source", 5, 3)
end
it 'returns "# the ruby source" as src' do
expect(subject.src).to eq("# the ruby source")
end
... | ruby | MIT | afcf15e42fde20abbdb6fe9591a3e5d98acc088e | 2026-01-04T15:45:13.013465Z | false |
simplecov-ruby/simplecov | https://github.com/simplecov-ruby/simplecov/blob/afcf15e42fde20abbdb6fe9591a3e5d98acc088e/spec/source_file/branch_spec.rb | spec/source_file/branch_spec.rb | # frozen_string_literal: true
require "helper"
describe SimpleCov::SourceFile::Branch do
let(:if_branch) do
described_class.new(start_line: 1, end_line: 3, coverage: 0, inline: false, type: :then)
end
let(:else_branch) do
described_class.new(start_line: 1, end_line: 3, coverage: 0, inline: false, type:... | ruby | MIT | afcf15e42fde20abbdb6fe9591a3e5d98acc088e | 2026-01-04T15:45:13.013465Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.