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
mojombo/chronic
https://github.com/mojombo/chronic/blob/416d50434204c9929a321af508d4289e11a6cf69/lib/chronic/repeaters/repeater_month.rb
lib/chronic/repeaters/repeater_month.rb
module Chronic class RepeaterMonth < Repeater #:nodoc: MONTH_SECONDS = 2_592_000 # 30 * 24 * 60 * 60 YEAR_MONTHS = 12 MONTH_DAYS = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] MONTH_DAYS_LEAP = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] def initialize(type, width = nil, options = {}) ...
ruby
MIT
416d50434204c9929a321af508d4289e11a6cf69
2026-01-04T15:51:17.260733Z
false
mojombo/chronic
https://github.com/mojombo/chronic/blob/416d50434204c9929a321af508d4289e11a6cf69/lib/chronic/repeaters/repeater_season_name.rb
lib/chronic/repeaters/repeater_season_name.rb
module Chronic class RepeaterSeasonName < RepeaterSeason #:nodoc: SEASON_SECONDS = 7_862_400 # 91 * 24 * 60 * 60 DAY_SECONDS = 86_400 # (24 * 60 * 60) def next(pointer) direction = pointer == :future ? 1 : -1 find_next_season_span(direction, @type) end def this(pointer = :future) ...
ruby
MIT
416d50434204c9929a321af508d4289e11a6cf69
2026-01-04T15:51:17.260733Z
false
mojombo/chronic
https://github.com/mojombo/chronic/blob/416d50434204c9929a321af508d4289e11a6cf69/lib/chronic/repeaters/repeater_minute.rb
lib/chronic/repeaters/repeater_minute.rb
module Chronic class RepeaterMinute < Repeater #:nodoc: MINUTE_SECONDS = 60 def initialize(type, width = nil, options = {}) super @current_minute_start = nil end def next(pointer = :future) super unless @current_minute_start case pointer when :future ...
ruby
MIT
416d50434204c9929a321af508d4289e11a6cf69
2026-01-04T15:51:17.260733Z
false
mojombo/chronic
https://github.com/mojombo/chronic/blob/416d50434204c9929a321af508d4289e11a6cf69/lib/chronic/repeaters/repeater_month_name.rb
lib/chronic/repeaters/repeater_month_name.rb
module Chronic class RepeaterMonthName < Repeater #:nodoc: MONTH_SECONDS = 2_592_000 # 30 * 24 * 60 * 60 MONTHS = { :january => 1, :february => 2, :march => 3, :april => 4, :may => 5, :june => 6, :july => 7, :august => 8, :september => 9, :october =>...
ruby
MIT
416d50434204c9929a321af508d4289e11a6cf69
2026-01-04T15:51:17.260733Z
false
mojombo/chronic
https://github.com/mojombo/chronic/blob/416d50434204c9929a321af508d4289e11a6cf69/lib/chronic/repeaters/repeater_year.rb
lib/chronic/repeaters/repeater_year.rb
module Chronic class RepeaterYear < Repeater #:nodoc: YEAR_SECONDS = 31536000 # 365 * 24 * 60 * 60 def initialize(type, width = nil, options = {}) super @current_year_start = nil end def next(pointer) super unless @current_year_start case pointer when :futu...
ruby
MIT
416d50434204c9929a321af508d4289e11a6cf69
2026-01-04T15:51:17.260733Z
false
mojombo/chronic
https://github.com/mojombo/chronic/blob/416d50434204c9929a321af508d4289e11a6cf69/lib/chronic/repeaters/repeater_hour.rb
lib/chronic/repeaters/repeater_hour.rb
module Chronic class RepeaterHour < Repeater #:nodoc: HOUR_SECONDS = 3600 # 60 * 60 def initialize(type, width = nil, options = {}) super @current_hour_start = nil end def next(pointer) super unless @current_hour_start case pointer when :future @cur...
ruby
MIT
416d50434204c9929a321af508d4289e11a6cf69
2026-01-04T15:51:17.260733Z
false
mojombo/chronic
https://github.com/mojombo/chronic/blob/416d50434204c9929a321af508d4289e11a6cf69/lib/chronic/repeaters/repeater_weekday.rb
lib/chronic/repeaters/repeater_weekday.rb
module Chronic class RepeaterWeekday < Repeater #:nodoc: DAY_SECONDS = 86400 # (24 * 60 * 60) DAYS = { :sunday => 0, :monday => 1, :tuesday => 2, :wednesday => 3, :thursday => 4, :friday => 5, :saturday => 6 } def initialize(type, width = nil, options = {}) ...
ruby
MIT
416d50434204c9929a321af508d4289e11a6cf69
2026-01-04T15:51:17.260733Z
false
mojombo/chronic
https://github.com/mojombo/chronic/blob/416d50434204c9929a321af508d4289e11a6cf69/lib/chronic/repeaters/repeater_second.rb
lib/chronic/repeaters/repeater_second.rb
module Chronic class RepeaterSecond < Repeater #:nodoc: SECOND_SECONDS = 1 # haha, awesome def initialize(type, width = nil, options = {}) super @second_start = nil end def next(pointer = :future) super direction = pointer == :future ? 1 : -1 unless @second_start ...
ruby
MIT
416d50434204c9929a321af508d4289e11a6cf69
2026-01-04T15:51:17.260733Z
false
mojombo/chronic
https://github.com/mojombo/chronic/blob/416d50434204c9929a321af508d4289e11a6cf69/lib/chronic/repeaters/repeater_day_name.rb
lib/chronic/repeaters/repeater_day_name.rb
module Chronic class RepeaterDayName < Repeater #:nodoc: DAY_SECONDS = 86400 # (24 * 60 * 60) def initialize(type, width = nil, options = {}) super @current_date = nil end def next(pointer) super direction = pointer == :future ? 1 : -1 unless @current_date @cu...
ruby
MIT
416d50434204c9929a321af508d4289e11a6cf69
2026-01-04T15:51:17.260733Z
false
mojombo/chronic
https://github.com/mojombo/chronic/blob/416d50434204c9929a321af508d4289e11a6cf69/lib/chronic/repeaters/repeater_season.rb
lib/chronic/repeaters/repeater_season.rb
module Chronic class RepeaterSeason < Repeater #:nodoc: SEASON_SECONDS = 7_862_400 # 91 * 24 * 60 * 60 SEASONS = { :spring => Season.new(MiniDate.new(3,20), MiniDate.new(6,20)), :summer => Season.new(MiniDate.new(6,21), MiniDate.new(9,22)), :autumn => Season.new(MiniDate.new(9,23), MiniDate....
ruby
MIT
416d50434204c9929a321af508d4289e11a6cf69
2026-01-04T15:51:17.260733Z
false
mojombo/chronic
https://github.com/mojombo/chronic/blob/416d50434204c9929a321af508d4289e11a6cf69/lib/chronic/repeaters/repeater_weekend.rb
lib/chronic/repeaters/repeater_weekend.rb
module Chronic class RepeaterWeekend < Repeater #:nodoc: WEEKEND_SECONDS = 172_800 # (2 * 24 * 60 * 60) def initialize(type, width = nil, options = {}) super @current_week_start = nil end def next(pointer) super unless @current_week_start case pointer when :f...
ruby
MIT
416d50434204c9929a321af508d4289e11a6cf69
2026-01-04T15:51:17.260733Z
false
mojombo/chronic
https://github.com/mojombo/chronic/blob/416d50434204c9929a321af508d4289e11a6cf69/lib/chronic/repeaters/repeater_time.rb
lib/chronic/repeaters/repeater_time.rb
module Chronic class RepeaterTime < Repeater #:nodoc: class Tick #:nodoc: attr_accessor :time def initialize(time, ambiguous = false) @time = time @ambiguous = ambiguous end def ambiguous? @ambiguous end def *(other) Tick.new(@time * other, @a...
ruby
MIT
416d50434204c9929a321af508d4289e11a6cf69
2026-01-04T15:51:17.260733Z
false
mojombo/chronic
https://github.com/mojombo/chronic/blob/416d50434204c9929a321af508d4289e11a6cf69/lib/chronic/repeaters/repeater_quarter.rb
lib/chronic/repeaters/repeater_quarter.rb
module Chronic class RepeaterQuarter < Repeater #:nodoc: MONTHS_PER_QUARTER = 3 QUARTER_SECONDS = 7_776_000 # 3 * 30 * 24 * 60 * 60 def next(pointer) @current_span ||= quarter(@now) offset_quarter_amount = pointer == :future ? 1 : -1 @current_span = offset_quarter(@current_span.begin, o...
ruby
MIT
416d50434204c9929a321af508d4289e11a6cf69
2026-01-04T15:51:17.260733Z
false
mojombo/chronic
https://github.com/mojombo/chronic/blob/416d50434204c9929a321af508d4289e11a6cf69/lib/chronic/repeaters/repeater_week.rb
lib/chronic/repeaters/repeater_week.rb
module Chronic class RepeaterWeek < Repeater #:nodoc: WEEK_SECONDS = 604800 # (7 * 24 * 60 * 60) def initialize(type, width = nil, options = {}) super @repeater_day_name = options[:week_start] || :sunday @current_week_start = nil end def next(pointer) super unless @cur...
ruby
MIT
416d50434204c9929a321af508d4289e11a6cf69
2026-01-04T15:51:17.260733Z
false
mojombo/chronic
https://github.com/mojombo/chronic/blob/416d50434204c9929a321af508d4289e11a6cf69/lib/chronic/repeaters/repeater_day.rb
lib/chronic/repeaters/repeater_day.rb
module Chronic class RepeaterDay < Repeater #:nodoc: DAY_SECONDS = 86_400 # (24 * 60 * 60) def initialize(type, width = nil, options = {}) super @current_day_start = nil end def next(pointer) super unless @current_day_start @current_day_start = Chronic.time_class.loc...
ruby
MIT
416d50434204c9929a321af508d4289e11a6cf69
2026-01-04T15:51:17.260733Z
false
mojombo/chronic
https://github.com/mojombo/chronic/blob/416d50434204c9929a321af508d4289e11a6cf69/lib/chronic/repeaters/repeater_fortnight.rb
lib/chronic/repeaters/repeater_fortnight.rb
module Chronic class RepeaterFortnight < Repeater #:nodoc: FORTNIGHT_SECONDS = 1_209_600 # (14 * 24 * 60 * 60) def initialize(type, width = nil, options = {}) super @current_fortnight_start = nil end def next(pointer) super unless @current_fortnight_start case pointe...
ruby
MIT
416d50434204c9929a321af508d4289e11a6cf69
2026-01-04T15:51:17.260733Z
false
mojombo/chronic
https://github.com/mojombo/chronic/blob/416d50434204c9929a321af508d4289e11a6cf69/lib/chronic/repeaters/repeater_quarter_name.rb
lib/chronic/repeaters/repeater_quarter_name.rb
module Chronic class RepeaterQuarterName < RepeaterQuarter #:nodoc: QUARTERS = { :q1 => 0, :q2 => 1, :q3 => 2, :q4 => 3 } def next(pointer) unless @current_span @current_span = this(pointer) else year_offset = pointer == :future ? 1 : -1 new_yea...
ruby
MIT
416d50434204c9929a321af508d4289e11a6cf69
2026-01-04T15:51:17.260733Z
false
mojombo/chronic
https://github.com/mojombo/chronic/blob/416d50434204c9929a321af508d4289e11a6cf69/lib/chronic/tags/repeater.rb
lib/chronic/tags/repeater.rb
module Chronic class Repeater < Tag # Scan an Array of Token objects and apply any necessary Repeater # tags to each token. # # tokens - An Array of tokens to scan. # options - The Hash of options specified in Chronic::parse. # # Returns an Array of tokens. def self.scan(tokens, optio...
ruby
MIT
416d50434204c9929a321af508d4289e11a6cf69
2026-01-04T15:51:17.260733Z
false
mojombo/chronic
https://github.com/mojombo/chronic/blob/416d50434204c9929a321af508d4289e11a6cf69/lib/chronic/tags/ordinal.rb
lib/chronic/tags/ordinal.rb
module Chronic class Ordinal < Tag # Scan an Array of Token objects and apply any necessary Ordinal # tags to each token. # # tokens - An Array of tokens to scan. # options - The Hash of options specified in Chronic::parse. # # Returns an Array of tokens. def self.scan(tokens, options...
ruby
MIT
416d50434204c9929a321af508d4289e11a6cf69
2026-01-04T15:51:17.260733Z
false
mojombo/chronic
https://github.com/mojombo/chronic/blob/416d50434204c9929a321af508d4289e11a6cf69/lib/chronic/tags/time_zone.rb
lib/chronic/tags/time_zone.rb
module Chronic class TimeZone < Tag # Scan an Array of Token objects and apply any necessary TimeZone # tags to each token. # # tokens - An Array of tokens to scan. # options - The Hash of options specified in Chronic::parse. # # Returns an Array of tokens. def self.scan(tokens, optio...
ruby
MIT
416d50434204c9929a321af508d4289e11a6cf69
2026-01-04T15:51:17.260733Z
false
mojombo/chronic
https://github.com/mojombo/chronic/blob/416d50434204c9929a321af508d4289e11a6cf69/lib/chronic/tags/separator.rb
lib/chronic/tags/separator.rb
module Chronic class Separator < Tag # Scan an Array of Token objects and apply any necessary Separator # tags to each token. # # tokens - An Array of tokens to scan. # options - The Hash of options specified in Chronic::parse. # # Returns an Array of tokens. def self.scan(tokens, opt...
ruby
MIT
416d50434204c9929a321af508d4289e11a6cf69
2026-01-04T15:51:17.260733Z
false
mojombo/chronic
https://github.com/mojombo/chronic/blob/416d50434204c9929a321af508d4289e11a6cf69/lib/chronic/tags/pointer.rb
lib/chronic/tags/pointer.rb
module Chronic class Pointer < Tag # Scan an Array of Token objects and apply any necessary Pointer # tags to each token. # # tokens - An Array of tokens to scan. # options - The Hash of options specified in Chronic::parse. # # Returns an Array of tokens. def self.scan(tokens, options...
ruby
MIT
416d50434204c9929a321af508d4289e11a6cf69
2026-01-04T15:51:17.260733Z
false
mojombo/chronic
https://github.com/mojombo/chronic/blob/416d50434204c9929a321af508d4289e11a6cf69/lib/chronic/tags/scalar.rb
lib/chronic/tags/scalar.rb
module Chronic class Scalar < Tag DAY_PORTIONS = %w( am pm morning afternoon evening night ) # Scan an Array of Token objects and apply any necessary Scalar # tags to each token. # # tokens - An Array of tokens to scan. # options - The Hash of options specified in Chronic::parse. # # ...
ruby
MIT
416d50434204c9929a321af508d4289e11a6cf69
2026-01-04T15:51:17.260733Z
false
mojombo/chronic
https://github.com/mojombo/chronic/blob/416d50434204c9929a321af508d4289e11a6cf69/lib/chronic/tags/grabber.rb
lib/chronic/tags/grabber.rb
module Chronic class Grabber < Tag # Scan an Array of Tokens and apply any necessary Grabber tags to # each token. # # tokens - An Array of Token objects to scan. # options - The Hash of options specified in Chronic::parse. # # Returns an Array of Token objects. def self.scan(tokens,...
ruby
MIT
416d50434204c9929a321af508d4289e11a6cf69
2026-01-04T15:51:17.260733Z
false
mojombo/chronic
https://github.com/mojombo/chronic/blob/416d50434204c9929a321af508d4289e11a6cf69/lib/chronic/tags/sign.rb
lib/chronic/tags/sign.rb
module Chronic class Sign < Tag # Scan an Array of Token objects and apply any necessary Sign # tags to each token. # # tokens - An Array of tokens to scan. # options - The Hash of options specified in Chronic::parse. # # Returns an Array of tokens. def self.scan(tokens, options) ...
ruby
MIT
416d50434204c9929a321af508d4289e11a6cf69
2026-01-04T15:51:17.260733Z
false
thoughtbot/shoulda-matchers
https://github.com/thoughtbot/shoulda-matchers/blob/c0b8352200b90642fef2edadfe0c4fb58f6ec0f8/REPRODUCTION_SCRIPT.rb
REPRODUCTION_SCRIPT.rb
require 'bundler/inline' gemfile(true) do source 'https://rubygems.org' gem 'shoulda-matchers' gem 'activerecord' gem 'sqlite3' gem 'rspec' end require 'active_record' require 'shoulda-matchers' require 'logger' ActiveRecord::Base.establish_connection(adapter: 'sqlite3', database: ':memory:') ActiveRecord:...
ruby
MIT
c0b8352200b90642fef2edadfe0c4fb58f6ec0f8
2026-01-04T15:50:06.860443Z
false
thoughtbot/shoulda-matchers
https://github.com/thoughtbot/shoulda-matchers/blob/c0b8352200b90642fef2edadfe0c4fb58f6ec0f8/custom_plan.rb
custom_plan.rb
require 'zeus' require 'zeus/plan' require_relative 'spec/support/tests/current_bundle' class CouldNotBootZeusError < StandardError def self.create(underlying_error:) new(<<-MESSAGE) Couldn't boot Zeus. Bundler tried to load a gem that has already been loaded (but the versions are different). Note that Apprais...
ruby
MIT
c0b8352200b90642fef2edadfe0c4fb58f6ec0f8
2026-01-04T15:50:06.860443Z
false
thoughtbot/shoulda-matchers
https://github.com/thoughtbot/shoulda-matchers/blob/c0b8352200b90642fef2edadfe0c4fb58f6ec0f8/tasks/documentation.rb
tasks/documentation.rb
require 'shoulda/matchers/version' require 'erb' module Shoulda module Matchers module DocumentationTasks extend Rake::DSL def self.create # rubocop:disable Metrics/MethodLength publisher = DocumentationPublisher.new namespace :docs do file DocumentationPublisher.gh_pages_...
ruby
MIT
c0b8352200b90642fef2edadfe0c4fb58f6ec0f8
2026-01-04T15:50:06.860443Z
false
thoughtbot/shoulda-matchers
https://github.com/thoughtbot/shoulda-matchers/blob/c0b8352200b90642fef2edadfe0c4fb58f6ec0f8/doc_config/yard/setup.rb
doc_config/yard/setup.rb
YARD::Templates::Engine.register_template_path( "#{File.dirname(__FILE__)}/templates", ) require 'rouge' module YARD module Templates module Helpers module HtmlSyntaxHighlightHelper def html_syntax_highlight_ruby(source) highlight(:ruby, source) end private de...
ruby
MIT
c0b8352200b90642fef2edadfe0c4fb58f6ec0f8
2026-01-04T15:50:06.860443Z
false
thoughtbot/shoulda-matchers
https://github.com/thoughtbot/shoulda-matchers/blob/c0b8352200b90642fef2edadfe0c4fb58f6ec0f8/doc_config/yard/templates/default/fulldoc/html/setup.rb
doc_config/yard/templates/default/fulldoc/html/setup.rb
def stylesheets_full_list %w(css/solarized.css css/bootstrap.css css/global.css) + super end def javascripts javascripts = super javascripts.insert 1, 'js/jquery.stickyheaders.js' end def class_list(root = Registry.root, tree = TreeContext.new) out = String.new('') children = run_verifier(root.children) i...
ruby
MIT
c0b8352200b90642fef2edadfe0c4fb58f6ec0f8
2026-01-04T15:50:06.860443Z
false
thoughtbot/shoulda-matchers
https://github.com/thoughtbot/shoulda-matchers/blob/c0b8352200b90642fef2edadfe0c4fb58f6ec0f8/doc_config/yard/templates/default/layout/html/setup.rb
doc_config/yard/templates/default/layout/html/setup.rb
def stylesheets %w(css/solarized.css css/bootstrap.css css/global.css) + super end def javascripts javascripts = super javascripts.insert 1, 'js/jquery.stickyheaders.js', 'js/underscore.min.js' end def diskfile @file.attributes[:markup] ||= markup_for_file('', @file.filename) contents = if @file.filena...
ruby
MIT
c0b8352200b90642fef2edadfe0c4fb58f6ec0f8
2026-01-04T15:50:06.860443Z
false
thoughtbot/shoulda-matchers
https://github.com/thoughtbot/shoulda-matchers/blob/c0b8352200b90642fef2edadfe0c4fb58f6ec0f8/spec/unit_spec_helper.rb
spec/unit_spec_helper.rb
require_relative 'support/unit/load_environment' require 'rspec/rails' require 'rspec/matchers/fail_matchers' require 'shoulda-matchers' require 'spec_helper' $VERBOSE = true Dir[File.join(File.expand_path('support/unit/**/*.rb', __dir__))].sort.each do |file| require file end RSpec.configure do |config| confi...
ruby
MIT
c0b8352200b90642fef2edadfe0c4fb58f6ec0f8
2026-01-04T15:50:06.860443Z
false
thoughtbot/shoulda-matchers
https://github.com/thoughtbot/shoulda-matchers/blob/c0b8352200b90642fef2edadfe0c4fb58f6ec0f8/spec/report_warnings.rb
spec/report_warnings.rb
require 'warnings_logger' WarningsLogger.configure do |config| config.project_name = 'shoulda-matchers' config.project_directory = Pathname.new('..').expand_path(__dir__) end WarningsLogger.enable
ruby
MIT
c0b8352200b90642fef2edadfe0c4fb58f6ec0f8
2026-01-04T15:50:06.860443Z
false
thoughtbot/shoulda-matchers
https://github.com/thoughtbot/shoulda-matchers/blob/c0b8352200b90642fef2edadfe0c4fb58f6ec0f8/spec/acceptance_spec_helper.rb
spec/acceptance_spec_helper.rb
require_relative 'support/tests/current_bundle' Tests::CurrentBundle.instance.assert_appraisal! #--- require 'rspec/core' require 'spec_helper' Dir[File.join(File.expand_path('support/acceptance/**/*.rb', __dir__))].sort.each do |file| require file end RSpec.configure do |config| if config.respond_to?(:infer_...
ruby
MIT
c0b8352200b90642fef2edadfe0c4fb58f6ec0f8
2026-01-04T15:50:06.860443Z
false
thoughtbot/shoulda-matchers
https://github.com/thoughtbot/shoulda-matchers/blob/c0b8352200b90642fef2edadfe0c4fb58f6ec0f8/spec/doublespeak_spec_helper.rb
spec/doublespeak_spec_helper.rb
require 'shoulda/matchers/doublespeak' require 'spec_helper'
ruby
MIT
c0b8352200b90642fef2edadfe0c4fb58f6ec0f8
2026-01-04T15:50:06.860443Z
false
thoughtbot/shoulda-matchers
https://github.com/thoughtbot/shoulda-matchers/blob/c0b8352200b90642fef2edadfe0c4fb58f6ec0f8/spec/spec_helper.rb
spec/spec_helper.rb
PROJECT_ROOT = File.expand_path('..', __dir__) $LOAD_PATH << File.join(PROJECT_ROOT, 'lib') require 'pry' require 'rspec' RSpec.configure do |config| config.expect_with :rspec do |c| c.syntax = :expect end config.order = :random config.default_formatter = 'doc' config.mock_with :rspec config.example...
ruby
MIT
c0b8352200b90642fef2edadfe0c4fb58f6ec0f8
2026-01-04T15:50:06.860443Z
false
thoughtbot/shoulda-matchers
https://github.com/thoughtbot/shoulda-matchers/blob/c0b8352200b90642fef2edadfe0c4fb58f6ec0f8/spec/support/tests/bundle.rb
spec/support/tests/bundle.rb
require_relative 'filesystem' require_relative 'command_runner' require_relative 'version' module Tests class Bundle def initialize @already_updating = false @fs = Filesystem.new end def updating if already_updating? yield self return end @already_updating ...
ruby
MIT
c0b8352200b90642fef2edadfe0c4fb58f6ec0f8
2026-01-04T15:50:06.860443Z
false
thoughtbot/shoulda-matchers
https://github.com/thoughtbot/shoulda-matchers/blob/c0b8352200b90642fef2edadfe0c4fb58f6ec0f8/spec/support/tests/version.rb
spec/support/tests/version.rb
module Tests class Version def initialize(version) @version = Gem::Version.new(version.to_s) end def <(other_version) compare?(:<, other_version) end def <=(other_version) compare?(:<=, other_version) end def ==(other_version) compare?(:==, other_version) end...
ruby
MIT
c0b8352200b90642fef2edadfe0c4fb58f6ec0f8
2026-01-04T15:50:06.860443Z
false
thoughtbot/shoulda-matchers
https://github.com/thoughtbot/shoulda-matchers/blob/c0b8352200b90642fef2edadfe0c4fb58f6ec0f8/spec/support/tests/database_configuration_registry.rb
spec/support/tests/database_configuration_registry.rb
require 'singleton' module Tests class DatabaseConfigurationRegistry include Singleton def initialize @registry = {} end def register(config_class) registry[config_class.name] = config_class end def get(name) registry.fetch(name) do raise KeyError, "No such adapte...
ruby
MIT
c0b8352200b90642fef2edadfe0c4fb58f6ec0f8
2026-01-04T15:50:06.860443Z
false
thoughtbot/shoulda-matchers
https://github.com/thoughtbot/shoulda-matchers/blob/c0b8352200b90642fef2edadfe0c4fb58f6ec0f8/spec/support/tests/command_runner.rb
spec/support/tests/command_runner.rb
require 'timeout' require 'shellwords' module Tests class CommandRunner TimeoutError = Class.new(StandardError) def self.run(*args) new(*args).tap do |runner| yield runner runner.call end end def self.run!(*args) run(*args) do |runner| runner.run_successful...
ruby
MIT
c0b8352200b90642fef2edadfe0c4fb58f6ec0f8
2026-01-04T15:50:06.860443Z
false
thoughtbot/shoulda-matchers
https://github.com/thoughtbot/shoulda-matchers/blob/c0b8352200b90642fef2edadfe0c4fb58f6ec0f8/spec/support/tests/current_bundle.rb
spec/support/tests/current_bundle.rb
require 'bundler' require 'appraisal' module Tests class CurrentBundle AppraisalNotSpecified = Class.new(ArgumentError) include Singleton def assert_appraisal! unless appraisal_in_use? message = <<EOT Please run tests starting with `appraisal <appraisal_name>`. Possible appraisals are: ...
ruby
MIT
c0b8352200b90642fef2edadfe0c4fb58f6ec0f8
2026-01-04T15:50:06.860443Z
false
thoughtbot/shoulda-matchers
https://github.com/thoughtbot/shoulda-matchers/blob/c0b8352200b90642fef2edadfe0c4fb58f6ec0f8/spec/support/tests/database_configuration.rb
spec/support/tests/database_configuration.rb
require_relative 'database_configuration_registry' require 'delegate' module Tests class DatabaseConfiguration < SimpleDelegator attr_reader :adapter_class def self.for(database_name, adapter_name) config_class = DatabaseConfigurationRegistry.instance.get(adapter_name) config = config_class.new(...
ruby
MIT
c0b8352200b90642fef2edadfe0c4fb58f6ec0f8
2026-01-04T15:50:06.860443Z
false
thoughtbot/shoulda-matchers
https://github.com/thoughtbot/shoulda-matchers/blob/c0b8352200b90642fef2edadfe0c4fb58f6ec0f8/spec/support/tests/filesystem.rb
spec/support/tests/filesystem.rb
require 'fileutils' module Tests class Filesystem PROJECT_NAME = 'test-project'.freeze ROOT_DIRECTORY = Pathname.new('../../../..').expand_path(__FILE__) TEMP_DIRECTORY = Pathname.new('/tmp/shoulda-matchers-acceptance') PROJECT_DIRECTORY = TEMP_DIRECTORY.join(PROJECT_NAME) def root_directory ...
ruby
MIT
c0b8352200b90642fef2edadfe0c4fb58f6ec0f8
2026-01-04T15:50:06.860443Z
false
thoughtbot/shoulda-matchers
https://github.com/thoughtbot/shoulda-matchers/blob/c0b8352200b90642fef2edadfe0c4fb58f6ec0f8/spec/support/tests/database.rb
spec/support/tests/database.rb
require_relative 'database_configuration' module Tests class Database NAME = 'shoulda-matchers-test'.freeze ADAPTER_NAME = ENV.fetch('DATABASE_ADAPTER', 'sqlite3').to_sym include Singleton attr_reader :config def initialize @config = Tests::DatabaseConfiguration.for(NAME, ADAPTER_NAME) ...
ruby
MIT
c0b8352200b90642fef2edadfe0c4fb58f6ec0f8
2026-01-04T15:50:06.860443Z
false
thoughtbot/shoulda-matchers
https://github.com/thoughtbot/shoulda-matchers/blob/c0b8352200b90642fef2edadfe0c4fb58f6ec0f8/spec/support/tests/database_adapters/postgresql.rb
spec/support/tests/database_adapters/postgresql.rb
module Tests module DatabaseAdapters class PostgreSQL def self.name :postgresql end attr_reader :database def initialize(database) @database = database end def adapter self.class.name end def require_dependencies require 'pg' ...
ruby
MIT
c0b8352200b90642fef2edadfe0c4fb58f6ec0f8
2026-01-04T15:50:06.860443Z
false
thoughtbot/shoulda-matchers
https://github.com/thoughtbot/shoulda-matchers/blob/c0b8352200b90642fef2edadfe0c4fb58f6ec0f8/spec/support/tests/database_adapters/sqlite3.rb
spec/support/tests/database_adapters/sqlite3.rb
module Tests module DatabaseAdapters class SQLite3 def self.name :sqlite3 end def initialize(_database) end def adapter self.class.name end def database 'db/db.sqlite3' end def require_dependencies require 'sqlite3' en...
ruby
MIT
c0b8352200b90642fef2edadfe0c4fb58f6ec0f8
2026-01-04T15:50:06.860443Z
false
thoughtbot/shoulda-matchers
https://github.com/thoughtbot/shoulda-matchers/blob/c0b8352200b90642fef2edadfe0c4fb58f6ec0f8/spec/support/acceptance/helpers.rb
spec/support/acceptance/helpers.rb
require_relative 'helpers/active_model_helpers' require_relative 'helpers/active_record_helpers' require_relative 'helpers/base_helpers' require_relative 'helpers/command_helpers' require_relative 'helpers/gem_helpers' require_relative 'helpers/n_unit_helpers' require_relative 'helpers/rails_migration_helpers' require_...
ruby
MIT
c0b8352200b90642fef2edadfe0c4fb58f6ec0f8
2026-01-04T15:50:06.860443Z
false
thoughtbot/shoulda-matchers
https://github.com/thoughtbot/shoulda-matchers/blob/c0b8352200b90642fef2edadfe0c4fb58f6ec0f8/spec/support/acceptance/adds_shoulda_matchers_to_project.rb
spec/support/acceptance/adds_shoulda_matchers_to_project.rb
require_relative 'helpers/base_helpers' require_relative 'helpers/rspec_helpers' module AcceptanceTests class AddsShouldaMatchersToProject def self.call(options) new(options).call end include BaseHelpers include RspecHelpers def initialize(options) @options = options end de...
ruby
MIT
c0b8352200b90642fef2edadfe0c4fb58f6ec0f8
2026-01-04T15:50:06.860443Z
false
thoughtbot/shoulda-matchers
https://github.com/thoughtbot/shoulda-matchers/blob/c0b8352200b90642fef2edadfe0c4fb58f6ec0f8/spec/support/acceptance/helpers/active_model_helpers.rb
spec/support/acceptance/helpers/active_model_helpers.rb
require_relative 'gem_helpers' module AcceptanceTests module ActiveModelHelpers include GemHelpers def active_model_version bundle_version_of('activemodel') end end end
ruby
MIT
c0b8352200b90642fef2edadfe0c4fb58f6ec0f8
2026-01-04T15:50:06.860443Z
false
thoughtbot/shoulda-matchers
https://github.com/thoughtbot/shoulda-matchers/blob/c0b8352200b90642fef2edadfe0c4fb58f6ec0f8/spec/support/acceptance/helpers/pluralization_helpers.rb
spec/support/acceptance/helpers/pluralization_helpers.rb
module AcceptanceTests module PluralizationHelpers def pluralize(count, singular_version, plural_version = nil) plural_version ||= "#{singular_version}s" if count == 1 "#{count} #{singular_version}" else "#{count} #{plural_version}" end end end end
ruby
MIT
c0b8352200b90642fef2edadfe0c4fb58f6ec0f8
2026-01-04T15:50:06.860443Z
false
thoughtbot/shoulda-matchers
https://github.com/thoughtbot/shoulda-matchers/blob/c0b8352200b90642fef2edadfe0c4fb58f6ec0f8/spec/support/acceptance/helpers/file_helpers.rb
spec/support/acceptance/helpers/file_helpers.rb
require_relative 'base_helpers' module AcceptanceTests module FileHelpers include BaseHelpers def append_to_file(path, content, options = {}) fs.append_to_file(path, content, options) end def remove_from_file(path, pattern) fs.remove_from_file(path, pattern) end def write_file(...
ruby
MIT
c0b8352200b90642fef2edadfe0c4fb58f6ec0f8
2026-01-04T15:50:06.860443Z
false
thoughtbot/shoulda-matchers
https://github.com/thoughtbot/shoulda-matchers/blob/c0b8352200b90642fef2edadfe0c4fb58f6ec0f8/spec/support/acceptance/helpers/base_helpers.rb
spec/support/acceptance/helpers/base_helpers.rb
require_relative '../../tests/bundle' require_relative '../../tests/database' require_relative '../../tests/filesystem' module AcceptanceTests module BaseHelpers def fs @_fs ||= Tests::Filesystem.new end def bundle @_bundle ||= Tests::Bundle.new end def database @_database ||=...
ruby
MIT
c0b8352200b90642fef2edadfe0c4fb58f6ec0f8
2026-01-04T15:50:06.860443Z
false
thoughtbot/shoulda-matchers
https://github.com/thoughtbot/shoulda-matchers/blob/c0b8352200b90642fef2edadfe0c4fb58f6ec0f8/spec/support/acceptance/helpers/gem_helpers.rb
spec/support/acceptance/helpers/gem_helpers.rb
require_relative 'base_helpers' require_relative 'command_helpers' require_relative 'file_helpers' module AcceptanceTests module GemHelpers include BaseHelpers include CommandHelpers include FileHelpers def add_gem(gem, *args) bundle.add_gem(gem, *args) end def install_gems bund...
ruby
MIT
c0b8352200b90642fef2edadfe0c4fb58f6ec0f8
2026-01-04T15:50:06.860443Z
false
thoughtbot/shoulda-matchers
https://github.com/thoughtbot/shoulda-matchers/blob/c0b8352200b90642fef2edadfe0c4fb58f6ec0f8/spec/support/acceptance/helpers/command_helpers.rb
spec/support/acceptance/helpers/command_helpers.rb
require_relative 'base_helpers' require_relative '../../tests/command_runner' module AcceptanceTests module CommandHelpers include BaseHelpers extend RSpec::Matchers::DSL def run_command(*args) Tests::CommandRunner.run(*args) do |runner| runner.directory = fs.project_directory yiel...
ruby
MIT
c0b8352200b90642fef2edadfe0c4fb58f6ec0f8
2026-01-04T15:50:06.860443Z
false
thoughtbot/shoulda-matchers
https://github.com/thoughtbot/shoulda-matchers/blob/c0b8352200b90642fef2edadfe0c4fb58f6ec0f8/spec/support/acceptance/helpers/rspec_helpers.rb
spec/support/acceptance/helpers/rspec_helpers.rb
require_relative 'gem_helpers' module AcceptanceTests module RspecHelpers include GemHelpers def rspec_core_version bundle_version_of('rspec-core') end def rspec_expectations_version bundle_version_of('rspec-expectations') end def rspec_rails_version bundle_version_of('rs...
ruby
MIT
c0b8352200b90642fef2edadfe0c4fb58f6ec0f8
2026-01-04T15:50:06.860443Z
false
thoughtbot/shoulda-matchers
https://github.com/thoughtbot/shoulda-matchers/blob/c0b8352200b90642fef2edadfe0c4fb58f6ec0f8/spec/support/acceptance/helpers/rails_migration_helpers.rb
spec/support/acceptance/helpers/rails_migration_helpers.rb
require_relative 'gem_helpers' module AcceptanceTests module RailsMigrationHelpers include RailsVersionHelpers def migration_class_name "ActiveRecord::Migration[#{rails_version_for_migration}]" end private def rails_version_for_migration rails_version.to_s.split('.')[0..1].join('.'...
ruby
MIT
c0b8352200b90642fef2edadfe0c4fb58f6ec0f8
2026-01-04T15:50:06.860443Z
false
thoughtbot/shoulda-matchers
https://github.com/thoughtbot/shoulda-matchers/blob/c0b8352200b90642fef2edadfe0c4fb58f6ec0f8/spec/support/acceptance/helpers/array_helpers.rb
spec/support/acceptance/helpers/array_helpers.rb
module AcceptanceTests module ArrayHelpers def to_sentence(array) case array.size when 1 array[0] when 2 array.join(' and ') else to_sentence(array[1..-2].join(', '), [array[-1]]) end end end end
ruby
MIT
c0b8352200b90642fef2edadfe0c4fb58f6ec0f8
2026-01-04T15:50:06.860443Z
false
thoughtbot/shoulda-matchers
https://github.com/thoughtbot/shoulda-matchers/blob/c0b8352200b90642fef2edadfe0c4fb58f6ec0f8/spec/support/acceptance/helpers/ruby_version_helpers.rb
spec/support/acceptance/helpers/ruby_version_helpers.rb
require_relative '../../tests/version' module AcceptanceTests module RubyVersionHelpers def ruby_version Tests::Version.new(RUBY_VERSION) end end end
ruby
MIT
c0b8352200b90642fef2edadfe0c4fb58f6ec0f8
2026-01-04T15:50:06.860443Z
false
thoughtbot/shoulda-matchers
https://github.com/thoughtbot/shoulda-matchers/blob/c0b8352200b90642fef2edadfe0c4fb58f6ec0f8/spec/support/acceptance/helpers/minitest_helpers.rb
spec/support/acceptance/helpers/minitest_helpers.rb
require_relative 'gem_helpers' module AcceptanceTests module MinitestHelpers include GemHelpers def minitest_version bundle_version_of('minitest') end end end
ruby
MIT
c0b8352200b90642fef2edadfe0c4fb58f6ec0f8
2026-01-04T15:50:06.860443Z
false
thoughtbot/shoulda-matchers
https://github.com/thoughtbot/shoulda-matchers/blob/c0b8352200b90642fef2edadfe0c4fb58f6ec0f8/spec/support/acceptance/helpers/active_record_helpers.rb
spec/support/acceptance/helpers/active_record_helpers.rb
require_relative 'gem_helpers' module AcceptanceTests module ActiveRecordHelpers include GemHelpers def active_record_version bundle_version_of('activerecord') end end end
ruby
MIT
c0b8352200b90642fef2edadfe0c4fb58f6ec0f8
2026-01-04T15:50:06.860443Z
false
thoughtbot/shoulda-matchers
https://github.com/thoughtbot/shoulda-matchers/blob/c0b8352200b90642fef2edadfe0c4fb58f6ec0f8/spec/support/acceptance/helpers/n_unit_helpers.rb
spec/support/acceptance/helpers/n_unit_helpers.rb
require_relative 'rails_version_helpers' module AcceptanceTests module NUnitHelpers include RailsVersionHelpers def n_unit_test_case_superclass case default_test_framework when :test_unit then 'Test::Unit::TestCase' when :minitest_4 then 'MiniTest::Unit::TestCase' else 'Minitest::Tes...
ruby
MIT
c0b8352200b90642fef2edadfe0c4fb58f6ec0f8
2026-01-04T15:50:06.860443Z
false
thoughtbot/shoulda-matchers
https://github.com/thoughtbot/shoulda-matchers/blob/c0b8352200b90642fef2edadfe0c4fb58f6ec0f8/spec/support/acceptance/helpers/step_helpers.rb
spec/support/acceptance/helpers/step_helpers.rb
require_relative 'file_helpers' require_relative 'gem_helpers' require_relative 'minitest_helpers' require 'yaml' module AcceptanceTests module StepHelpers include FileHelpers include GemHelpers include MinitestHelpers extend RSpec::Matchers::DSL def create_active_model_project create_ge...
ruby
MIT
c0b8352200b90642fef2edadfe0c4fb58f6ec0f8
2026-01-04T15:50:06.860443Z
false
thoughtbot/shoulda-matchers
https://github.com/thoughtbot/shoulda-matchers/blob/c0b8352200b90642fef2edadfe0c4fb58f6ec0f8/spec/support/acceptance/helpers/rails_version_helpers.rb
spec/support/acceptance/helpers/rails_version_helpers.rb
require_relative 'gem_helpers' module AcceptanceTests module RailsVersionHelpers include GemHelpers def rails_version bundle_version_of('rails') end def rails_7_2_x? rails_version =~ '~> 7.2' end def rails_gte_7_2? Gem::Version.new(rails_version) >= Gem::Version.new('7.2....
ruby
MIT
c0b8352200b90642fef2edadfe0c4fb58f6ec0f8
2026-01-04T15:50:06.860443Z
false
thoughtbot/shoulda-matchers
https://github.com/thoughtbot/shoulda-matchers/blob/c0b8352200b90642fef2edadfe0c4fb58f6ec0f8/spec/support/acceptance/matchers/indicate_number_of_tests_was_run_matcher.rb
spec/support/acceptance/matchers/indicate_number_of_tests_was_run_matcher.rb
require_relative '../helpers/pluralization_helpers' require_relative '../helpers/rails_version_helpers' module AcceptanceTests module Matchers def indicate_number_of_tests_was_run(expected_output) IndicateNumberOfTestsWasRunMatcher.new(expected_output) end class IndicateNumberOfTestsWasRunMatcher ...
ruby
MIT
c0b8352200b90642fef2edadfe0c4fb58f6ec0f8
2026-01-04T15:50:06.860443Z
false
thoughtbot/shoulda-matchers
https://github.com/thoughtbot/shoulda-matchers/blob/c0b8352200b90642fef2edadfe0c4fb58f6ec0f8/spec/support/acceptance/matchers/indicate_that_tests_were_run_matcher.rb
spec/support/acceptance/matchers/indicate_that_tests_were_run_matcher.rb
require_relative '../helpers/array_helpers' require_relative '../helpers/pluralization_helpers' require_relative '../helpers/rails_version_helpers' module AcceptanceTests module Matchers def indicate_that_tests_were_run(series) IndicateThatTestsWereRunMatcher.new(series) end class IndicateThatTest...
ruby
MIT
c0b8352200b90642fef2edadfe0c4fb58f6ec0f8
2026-01-04T15:50:06.860443Z
false
thoughtbot/shoulda-matchers
https://github.com/thoughtbot/shoulda-matchers/blob/c0b8352200b90642fef2edadfe0c4fb58f6ec0f8/spec/support/acceptance/matchers/have_output.rb
spec/support/acceptance/matchers/have_output.rb
module AcceptanceTests module Matchers def have_output(output) HaveOutputMatcher.new(output) end class HaveOutputMatcher def initialize(output) @output = output end def matches?(runner) @runner = runner runner.has_output?(output) end def failu...
ruby
MIT
c0b8352200b90642fef2edadfe0c4fb58f6ec0f8
2026-01-04T15:50:06.860443Z
false
thoughtbot/shoulda-matchers
https://github.com/thoughtbot/shoulda-matchers/blob/c0b8352200b90642fef2edadfe0c4fb58f6ec0f8/spec/support/unit/capture.rb
spec/support/unit/capture.rb
module Kernel # #capture, #silence_stream, and #silence_stderr were removed in rails 5.0, # but we keep it them here if method_defined?(:capture) undef_method :capture end def capture(stream) stream = stream.to_s captured_stream = Tempfile.new(stream) stream_io = eval("$#{stream}", binding, ...
ruby
MIT
c0b8352200b90642fef2edadfe0c4fb58f6ec0f8
2026-01-04T15:50:06.860443Z
false
thoughtbot/shoulda-matchers
https://github.com/thoughtbot/shoulda-matchers/blob/c0b8352200b90642fef2edadfe0c4fb58f6ec0f8/spec/support/unit/record_builder_with_i18n_validation_message.rb
spec/support/unit/record_builder_with_i18n_validation_message.rb
require 'delegate' module UnitTests class RecordBuilderWithI18nValidationMessage < SimpleDelegator def initialize(builder, options = {}) super(builder) @options = default_options.merge!(options) builder.message = validation_message_key end def validation_message_key options[:vali...
ruby
MIT
c0b8352200b90642fef2edadfe0c4fb58f6ec0f8
2026-01-04T15:50:06.860443Z
false
thoughtbot/shoulda-matchers
https://github.com/thoughtbot/shoulda-matchers/blob/c0b8352200b90642fef2edadfe0c4fb58f6ec0f8/spec/support/unit/attribute.rb
spec/support/unit/attribute.rb
module UnitTests class Attribute DEFAULT_COLUMN_TYPE = :string DEFAULT_COLUMN_OPTIONS = { null: false, array: false, }.freeze def initialize(args) @args = args end def name args.fetch(:name) end def column_type args.fetch(:column_type, DEFAULT_COLUMN_TY...
ruby
MIT
c0b8352200b90642fef2edadfe0c4fb58f6ec0f8
2026-01-04T15:50:06.860443Z
false
thoughtbot/shoulda-matchers
https://github.com/thoughtbot/shoulda-matchers/blob/c0b8352200b90642fef2edadfe0c4fb58f6ec0f8/spec/support/unit/model_creators.rb
spec/support/unit/model_creators.rb
module UnitTests module ModelCreators class << self def register(name, klass) registrations[name] = klass end def retrieve(name) registrations[name] end private def registrations @_registrations ||= {} end end end end
ruby
MIT
c0b8352200b90642fef2edadfe0c4fb58f6ec0f8
2026-01-04T15:50:06.860443Z
false
thoughtbot/shoulda-matchers
https://github.com/thoughtbot/shoulda-matchers/blob/c0b8352200b90642fef2edadfe0c4fb58f6ec0f8/spec/support/unit/rails_application.rb
spec/support/unit/rails_application.rb
require_relative '../tests/bundle' require_relative '../tests/command_runner' require_relative '../tests/database' require_relative '../tests/filesystem' require_relative 'helpers/rails_versions' require_relative 'helpers/ruby_versions' require 'yaml' module UnitTests class RailsApplication def initialize ...
ruby
MIT
c0b8352200b90642fef2edadfe0c4fb58f6ec0f8
2026-01-04T15:50:06.860443Z
false
thoughtbot/shoulda-matchers
https://github.com/thoughtbot/shoulda-matchers/blob/c0b8352200b90642fef2edadfe0c4fb58f6ec0f8/spec/support/unit/configuration.rb
spec/support/unit/configuration.rb
module UnitTests class Configuration CLASSES = %i[ ActiveModelHelpers ActiveModelVersions ActiveRecordVersions ClassBuilder ColumnTypeHelpers ControllerBuilder DatabaseHelpers I18nFaker MailerBuilder MessageHelpers ModelBuilder RailsVersions ...
ruby
MIT
c0b8352200b90642fef2edadfe0c4fb58f6ec0f8
2026-01-04T15:50:06.860443Z
false
thoughtbot/shoulda-matchers
https://github.com/thoughtbot/shoulda-matchers/blob/c0b8352200b90642fef2edadfe0c4fb58f6ec0f8/spec/support/unit/i18n.rb
spec/support/unit/i18n.rb
RSpec.configure do |config| config.after do # Clear any translations added during tests by telling the backend to # replace its translations with whatever is in the YAML files. I18n.backend.reload! end end
ruby
MIT
c0b8352200b90642fef2edadfe0c4fb58f6ec0f8
2026-01-04T15:50:06.860443Z
false
thoughtbot/shoulda-matchers
https://github.com/thoughtbot/shoulda-matchers/blob/c0b8352200b90642fef2edadfe0c4fb58f6ec0f8/spec/support/unit/record_with_unrelated_error_builder.rb
spec/support/unit/record_with_unrelated_error_builder.rb
require_relative 'helpers/model_builder' module UnitTests class RecordWithUnrelatedErrorBuilder include ModelBuilder def initialize(options) @options = options.reverse_merge(default_options) end def attribute_that_receives_error options[:attribute_that_receives_error] end def a...
ruby
MIT
c0b8352200b90642fef2edadfe0c4fb58f6ec0f8
2026-01-04T15:50:06.860443Z
false
thoughtbot/shoulda-matchers
https://github.com/thoughtbot/shoulda-matchers/blob/c0b8352200b90642fef2edadfe0c4fb58f6ec0f8/spec/support/unit/validation_matcher_scenario.rb
spec/support/unit/validation_matcher_scenario.rb
require 'forwardable' module UnitTests class ValidationMatcherScenario extend Forwardable def initialize(arguments) @arguments = arguments.dup @matcher_proc = @arguments.delete(:matcher_proc) @specified_model_creator = @arguments.delete(:model_creator) do raise KeyError.new(<<-MES...
ruby
MIT
c0b8352200b90642fef2edadfe0c4fb58f6ec0f8
2026-01-04T15:50:06.860443Z
false
thoughtbot/shoulda-matchers
https://github.com/thoughtbot/shoulda-matchers/blob/c0b8352200b90642fef2edadfe0c4fb58f6ec0f8/spec/support/unit/record_with_different_error_attribute_builder.rb
spec/support/unit/record_with_different_error_attribute_builder.rb
require_relative 'helpers/model_builder' module UnitTests class RecordWithDifferentErrorAttributeBuilder include ModelBuilder def initialize(options) @options = options.reverse_merge(default_options) end def attribute_that_receives_error options[:attribute_that_receives_error] end ...
ruby
MIT
c0b8352200b90642fef2edadfe0c4fb58f6ec0f8
2026-01-04T15:50:06.860443Z
false
thoughtbot/shoulda-matchers
https://github.com/thoughtbot/shoulda-matchers/blob/c0b8352200b90642fef2edadfe0c4fb58f6ec0f8/spec/support/unit/record_validating_confirmation_builder.rb
spec/support/unit/record_validating_confirmation_builder.rb
require_relative 'helpers/model_builder' module UnitTests class RecordValidatingConfirmationBuilder include ModelBuilder def initialize(options) @options = options end def model @_model ||= create_model end def model_name options.fetch(:model_name, 'Example') end ...
ruby
MIT
c0b8352200b90642fef2edadfe0c4fb58f6ec0f8
2026-01-04T15:50:06.860443Z
false
thoughtbot/shoulda-matchers
https://github.com/thoughtbot/shoulda-matchers/blob/c0b8352200b90642fef2edadfe0c4fb58f6ec0f8/spec/support/unit/load_environment.rb
spec/support/unit/load_environment.rb
require_relative '../tests/current_bundle' require_relative 'rails_application' Tests::CurrentBundle.instance.assert_appraisal! $test_app = UnitTests::RailsApplication.new $test_app.create $test_app.load require 'active_record/base' ENV['RAILS_ENV'] = 'test'
ruby
MIT
c0b8352200b90642fef2edadfe0c4fb58f6ec0f8
2026-01-04T15:50:06.860443Z
false
thoughtbot/shoulda-matchers
https://github.com/thoughtbot/shoulda-matchers/blob/c0b8352200b90642fef2edadfe0c4fb58f6ec0f8/spec/support/unit/change_value.rb
spec/support/unit/change_value.rb
module UnitTests class ChangeValue def self.call(column_type, value, value_changer) new(column_type, value, value_changer).call end def initialize(column_type, value, value_changer) @column_type = column_type @value = value @value_changer = value_changer end def call ...
ruby
MIT
c0b8352200b90642fef2edadfe0c4fb58f6ec0f8
2026-01-04T15:50:06.860443Z
false
thoughtbot/shoulda-matchers
https://github.com/thoughtbot/shoulda-matchers/blob/c0b8352200b90642fef2edadfe0c4fb58f6ec0f8/spec/support/unit/helpers/i18n_faker.rb
spec/support/unit/helpers/i18n_faker.rb
module UnitTests module I18nFaker extend self def self.configure_example_group(example_group) example_group.include(self) end def stubbing_translations(translations) stub_translations(translations) yield ensure I18n.backend.reload! I18n.backend.send(:init_translatio...
ruby
MIT
c0b8352200b90642fef2edadfe0c4fb58f6ec0f8
2026-01-04T15:50:06.860443Z
false
thoughtbot/shoulda-matchers
https://github.com/thoughtbot/shoulda-matchers/blob/c0b8352200b90642fef2edadfe0c4fb58f6ec0f8/spec/support/unit/helpers/message_helpers.rb
spec/support/unit/helpers/message_helpers.rb
module UnitTests module MessageHelpers include Shoulda::Matchers::WordWrap def self.configure_example_group(example_group) example_group.include(self) end def format_message(message, one_line: false) stripped_message = message.strip_heredoc.strip if one_line stripped_messa...
ruby
MIT
c0b8352200b90642fef2edadfe0c4fb58f6ec0f8
2026-01-04T15:50:06.860443Z
false
thoughtbot/shoulda-matchers
https://github.com/thoughtbot/shoulda-matchers/blob/c0b8352200b90642fef2edadfe0c4fb58f6ec0f8/spec/support/unit/helpers/active_model_helpers.rb
spec/support/unit/helpers/active_model_helpers.rb
module UnitTests module ActiveModelHelpers def self.configure_example_group(example_group) example_group.include(self) end def custom_validation(options = {}, &block) attribute_name = options.fetch(:attribute_name, :attr) attribute_type = options.fetch(:attribute_type, :integer) c...
ruby
MIT
c0b8352200b90642fef2edadfe0c4fb58f6ec0f8
2026-01-04T15:50:06.860443Z
false
thoughtbot/shoulda-matchers
https://github.com/thoughtbot/shoulda-matchers/blob/c0b8352200b90642fef2edadfe0c4fb58f6ec0f8/spec/support/unit/helpers/model_builder.rb
spec/support/unit/helpers/model_builder.rb
require_relative 'class_builder' module UnitTests module ModelBuilder def create_table(*args, &block) ModelBuilder.create_table(*args, &block) end def define_model(*args, &block) ModelBuilder.define_model(*args, &block) end def define_model_instance(*args, &block) define_model...
ruby
MIT
c0b8352200b90642fef2edadfe0c4fb58f6ec0f8
2026-01-04T15:50:06.860443Z
false
thoughtbot/shoulda-matchers
https://github.com/thoughtbot/shoulda-matchers/blob/c0b8352200b90642fef2edadfe0c4fb58f6ec0f8/spec/support/unit/helpers/class_builder.rb
spec/support/unit/helpers/class_builder.rb
module UnitTests module ClassBuilder def define_module(*args, &block) ClassBuilder.define_module(*args, &block) end def define_class(*args, &block) ClassBuilder.define_class(*args, &block) end class << self def configure_example_group(example_group) example_group.includ...
ruby
MIT
c0b8352200b90642fef2edadfe0c4fb58f6ec0f8
2026-01-04T15:50:06.860443Z
false
thoughtbot/shoulda-matchers
https://github.com/thoughtbot/shoulda-matchers/blob/c0b8352200b90642fef2edadfe0c4fb58f6ec0f8/spec/support/unit/helpers/database_helpers.rb
spec/support/unit/helpers/database_helpers.rb
module UnitTests module DatabaseHelpers def self.configure_example_group(example_group) example_group.include(self) example_group.extend(self) end extend self def database_adapter Tests::Database.instance.adapter_name end def postgresql? database_adapter == :postgres...
ruby
MIT
c0b8352200b90642fef2edadfe0c4fb58f6ec0f8
2026-01-04T15:50:06.860443Z
false
thoughtbot/shoulda-matchers
https://github.com/thoughtbot/shoulda-matchers/blob/c0b8352200b90642fef2edadfe0c4fb58f6ec0f8/spec/support/unit/helpers/active_record_versions.rb
spec/support/unit/helpers/active_record_versions.rb
module UnitTests module ActiveRecordVersions def self.configure_example_group(example_group) example_group.include(self) example_group.extend(self) end extend self def active_record_version Tests::Version.new(::ActiveRecord::VERSION::STRING) end def active_record_gte_8_1? ...
ruby
MIT
c0b8352200b90642fef2edadfe0c4fb58f6ec0f8
2026-01-04T15:50:06.860443Z
false
thoughtbot/shoulda-matchers
https://github.com/thoughtbot/shoulda-matchers/blob/c0b8352200b90642fef2edadfe0c4fb58f6ec0f8/spec/support/unit/helpers/ruby_versions.rb
spec/support/unit/helpers/ruby_versions.rb
module UnitTests module RubyVersions extend self def self.configure_example_group(example_group) example_group.include(self) example_group.extend(self) end def ruby_version Tests::Version.new(RUBY_VERSION) end def ruby_gt_3_4? ruby_version >= '3.4' end end end
ruby
MIT
c0b8352200b90642fef2edadfe0c4fb58f6ec0f8
2026-01-04T15:50:06.860443Z
false
thoughtbot/shoulda-matchers
https://github.com/thoughtbot/shoulda-matchers/blob/c0b8352200b90642fef2edadfe0c4fb58f6ec0f8/spec/support/unit/helpers/application_configuration_helpers.rb
spec/support/unit/helpers/application_configuration_helpers.rb
module UnitTests module ApplicationConfigurationHelpers def with_belongs_to_as_required_by_default(&block) configuring_application( ::ActiveRecord::Base, :belongs_to_required_by_default, true, &block ) end def with_belongs_to_as_optional_by_default(&block) ...
ruby
MIT
c0b8352200b90642fef2edadfe0c4fb58f6ec0f8
2026-01-04T15:50:06.860443Z
false
thoughtbot/shoulda-matchers
https://github.com/thoughtbot/shoulda-matchers/blob/c0b8352200b90642fef2edadfe0c4fb58f6ec0f8/spec/support/unit/helpers/allow_value_matcher_helpers.rb
spec/support/unit/helpers/allow_value_matcher_helpers.rb
require_relative '../record_with_different_error_attribute_builder' require_relative '../record_builder_with_i18n_validation_message' module UnitTests module AllowValueMatcherHelpers def builder_for_record_with_different_error_attribute(options = {}) RecordWithDifferentErrorAttributeBuilder.new(options) ...
ruby
MIT
c0b8352200b90642fef2edadfe0c4fb58f6ec0f8
2026-01-04T15:50:06.860443Z
false
thoughtbot/shoulda-matchers
https://github.com/thoughtbot/shoulda-matchers/blob/c0b8352200b90642fef2edadfe0c4fb58f6ec0f8/spec/support/unit/helpers/column_type_helpers.rb
spec/support/unit/helpers/column_type_helpers.rb
module UnitTests module ColumnTypeHelpers def self.configure_example_group(example_group) example_group.include(self) end def column_type_class_namespace if database_adapter == :postgresql ActiveRecord::ConnectionAdapters::PostgreSQL else ActiveRecord::Type end ...
ruby
MIT
c0b8352200b90642fef2edadfe0c4fb58f6ec0f8
2026-01-04T15:50:06.860443Z
false
thoughtbot/shoulda-matchers
https://github.com/thoughtbot/shoulda-matchers/blob/c0b8352200b90642fef2edadfe0c4fb58f6ec0f8/spec/support/unit/helpers/confirmation_matcher_helpers.rb
spec/support/unit/helpers/confirmation_matcher_helpers.rb
require_relative '../record_validating_confirmation_builder' require_relative '../record_builder_with_i18n_validation_message' module UnitTests module ConfirmationMatcherHelpers def builder_for_record_validating_confirmation(options = {}) RecordValidatingConfirmationBuilder.new(options) end def bu...
ruby
MIT
c0b8352200b90642fef2edadfe0c4fb58f6ec0f8
2026-01-04T15:50:06.860443Z
false
thoughtbot/shoulda-matchers
https://github.com/thoughtbot/shoulda-matchers/blob/c0b8352200b90642fef2edadfe0c4fb58f6ec0f8/spec/support/unit/helpers/active_resource_builder.rb
spec/support/unit/helpers/active_resource_builder.rb
module UnitTests module ActiveResourceBuilder def self.configure_example_group(example_group) require 'active_resource' example_group.include ActiveResourceBuilder example_group.after do ActiveSupport::Dependencies.clear end end def define_active_resource_class(class_nam...
ruby
MIT
c0b8352200b90642fef2edadfe0c4fb58f6ec0f8
2026-01-04T15:50:06.860443Z
false
thoughtbot/shoulda-matchers
https://github.com/thoughtbot/shoulda-matchers/blob/c0b8352200b90642fef2edadfe0c4fb58f6ec0f8/spec/support/unit/helpers/mailer_builder.rb
spec/support/unit/helpers/mailer_builder.rb
module UnitTests module MailerBuilder def self.configure_example_group(example_group) example_group.include(self) end def define_mailer(name, _paths, &block) class_name = name.to_s.pluralize.classify define_class(class_name, ActionMailer::Base, &block) end end end
ruby
MIT
c0b8352200b90642fef2edadfe0c4fb58f6ec0f8
2026-01-04T15:50:06.860443Z
false
thoughtbot/shoulda-matchers
https://github.com/thoughtbot/shoulda-matchers/blob/c0b8352200b90642fef2edadfe0c4fb58f6ec0f8/spec/support/unit/helpers/active_model_versions.rb
spec/support/unit/helpers/active_model_versions.rb
module UnitTests module ActiveModelVersions def self.configure_example_group(example_group) example_group.include(self) example_group.extend(self) end def active_model_version Tests::Version.new(::ActiveModel::VERSION::STRING) end end end
ruby
MIT
c0b8352200b90642fef2edadfe0c4fb58f6ec0f8
2026-01-04T15:50:06.860443Z
false
thoughtbot/shoulda-matchers
https://github.com/thoughtbot/shoulda-matchers/blob/c0b8352200b90642fef2edadfe0c4fb58f6ec0f8/spec/support/unit/helpers/validation_matcher_scenario_helpers.rb
spec/support/unit/helpers/validation_matcher_scenario_helpers.rb
module UnitTests module ValidationMatcherScenarioHelpers def self.configure_example_group(example_group) example_group.include(self) end def build_scenario_for_validation_matcher(args) UnitTests::ValidationMatcherScenario.new( build_validation_matcher_scenario_args(args), ) ...
ruby
MIT
c0b8352200b90642fef2edadfe0c4fb58f6ec0f8
2026-01-04T15:50:06.860443Z
false
thoughtbot/shoulda-matchers
https://github.com/thoughtbot/shoulda-matchers/blob/c0b8352200b90642fef2edadfe0c4fb58f6ec0f8/spec/support/unit/helpers/rails_versions.rb
spec/support/unit/helpers/rails_versions.rb
module UnitTests module RailsVersions extend self def self.configure_example_group(example_group) example_group.include(self) example_group.extend(self) end def rails_version Tests::Version.new(Rails::VERSION::STRING) end def rails_oldest_version_supported 7.1 en...
ruby
MIT
c0b8352200b90642fef2edadfe0c4fb58f6ec0f8
2026-01-04T15:50:06.860443Z
false
thoughtbot/shoulda-matchers
https://github.com/thoughtbot/shoulda-matchers/blob/c0b8352200b90642fef2edadfe0c4fb58f6ec0f8/spec/support/unit/helpers/controller_builder.rb
spec/support/unit/helpers/controller_builder.rb
module UnitTests module ControllerBuilder def self.configure_example_group(example_group) example_group.include(self) example_group.after do delete_temporary_views restore_original_routes end end def define_controller(class_name, &block) new_class_name = if class_...
ruby
MIT
c0b8352200b90642fef2edadfe0c4fb58f6ec0f8
2026-01-04T15:50:06.860443Z
false
thoughtbot/shoulda-matchers
https://github.com/thoughtbot/shoulda-matchers/blob/c0b8352200b90642fef2edadfe0c4fb58f6ec0f8/spec/support/unit/model_creation_strategies/active_record.rb
spec/support/unit/model_creation_strategies/active_record.rb
module UnitTests module ModelCreationStrategies class ActiveRecord def self.call(name, columns = {}, options = {}, &block) new(name, columns, options, &block).call end def initialize(name, columns = {}, options = {}, &block) @name = name @columns = columns @optio...
ruby
MIT
c0b8352200b90642fef2edadfe0c4fb58f6ec0f8
2026-01-04T15:50:06.860443Z
false
thoughtbot/shoulda-matchers
https://github.com/thoughtbot/shoulda-matchers/blob/c0b8352200b90642fef2edadfe0c4fb58f6ec0f8/spec/support/unit/model_creation_strategies/active_model.rb
spec/support/unit/model_creation_strategies/active_model.rb
module UnitTests module ModelCreationStrategies class ActiveModel def self.call(name, attribute_names = [], options = {}, &block) new(name, attribute_names, options, &block).call end def initialize(name, attribute_names = [], options = {}, &block) @name = name @attribute...
ruby
MIT
c0b8352200b90642fef2edadfe0c4fb58f6ec0f8
2026-01-04T15:50:06.860443Z
false
thoughtbot/shoulda-matchers
https://github.com/thoughtbot/shoulda-matchers/blob/c0b8352200b90642fef2edadfe0c4fb58f6ec0f8/spec/support/unit/shared_examples/ignoring_interference_by_writer.rb
spec/support/unit/shared_examples/ignoring_interference_by_writer.rb
shared_examples_for 'ignoring_interference_by_writer' do |common_config| valid_tests = [ :accept_if_qualified_but_changing_value_does_not_interfere, :reject_if_qualified_but_changing_value_interferes, ] tests = common_config.fetch(:tests) tests.assert_valid_keys(valid_tests) define_method(:common_con...
ruby
MIT
c0b8352200b90642fef2edadfe0c4fb58f6ec0f8
2026-01-04T15:50:06.860443Z
false