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
danmayer/coverband
https://github.com/danmayer/coverband/blob/2ee2e24185629fb8414301522b9dbae38dfc7aaf/lib/coverband/utils/lines_classifier.rb
lib/coverband/utils/lines_classifier.rb
# frozen_string_literal: true #### # # NOTE: with Ruby 2.6.0 and beyond we can replace this classifier with # ::Coverage.line_stub # https://ruby-doc.org/stdlib-2.6.1/libdoc/coverage/rdoc/Coverage.html#method-c-line_stub # # Thanks for all the help SimpleCov https://github.com/colszowka/simplecov-html # initial versio...
ruby
MIT
2ee2e24185629fb8414301522b9dbae38dfc7aaf
2026-01-04T15:53:56.976483Z
false
danmayer/coverband
https://github.com/danmayer/coverband/blob/2ee2e24185629fb8414301522b9dbae38dfc7aaf/lib/coverband/reporters/json_report.rb
lib/coverband/reporters/json_report.rb
# frozen_string_literal: true # Outputs data in json format similar to what is shown in the HTML page # Top level and file level coverage numbers module Coverband module Reporters class JSONReport < Base attr_accessor :filtered_report_files, :options, :page, :as_report, :store, :filename, :base_path, :line...
ruby
MIT
2ee2e24185629fb8414301522b9dbae38dfc7aaf
2026-01-04T15:53:56.976483Z
false
danmayer/coverband
https://github.com/danmayer/coverband/blob/2ee2e24185629fb8414301522b9dbae38dfc7aaf/lib/coverband/reporters/html_report.rb
lib/coverband/reporters/html_report.rb
# frozen_string_literal: true module Coverband module Reporters class HTMLReport < Base attr_accessor :filtered_report_files, :open_report, :notice, :base_path, :filename, :page def initialize(store, options = {}) self.page = options.fetch(:page) { nil } self.open_report = op...
ruby
MIT
2ee2e24185629fb8414301522b9dbae38dfc7aaf
2026-01-04T15:53:56.976483Z
false
danmayer/coverband
https://github.com/danmayer/coverband/blob/2ee2e24185629fb8414301522b9dbae38dfc7aaf/lib/coverband/reporters/base.rb
lib/coverband/reporters/base.rb
# frozen_string_literal: true module Coverband module Reporters ### # This is the base clase for report generation # it helps with filtering, normalization, etc for final report generation ### class Base class << self DATA_KEY = "data" def report(store, options = {}) ...
ruby
MIT
2ee2e24185629fb8414301522b9dbae38dfc7aaf
2026-01-04T15:53:56.976483Z
false
danmayer/coverband
https://github.com/danmayer/coverband/blob/2ee2e24185629fb8414301522b9dbae38dfc7aaf/lib/coverband/reporters/console_report.rb
lib/coverband/reporters/console_report.rb
# frozen_string_literal: true module Coverband module Reporters ### # Console Report allows for simple reporting via the command line. ### class ConsoleReport < Base def self.report(store, options = {}) coverband_reports = Coverband::Reporters::Base.report(store, options) fix_re...
ruby
MIT
2ee2e24185629fb8414301522b9dbae38dfc7aaf
2026-01-04T15:53:56.976483Z
false
danmayer/coverband
https://github.com/danmayer/coverband/blob/2ee2e24185629fb8414301522b9dbae38dfc7aaf/lib/coverband/reporters/web.rb
lib/coverband/reporters/web.rb
# frozen_string_literal: true require "base64" require "coverband" begin require "rack" rescue LoadError puts "error loading Coverband web reporter as Rack is not available" end module Coverband module Reporters class Web attr_reader :request CSP_HEADER = [ "default-src 'self' https: h...
ruby
MIT
2ee2e24185629fb8414301522b9dbae38dfc7aaf
2026-01-04T15:53:56.976483Z
false
danmayer/coverband
https://github.com/danmayer/coverband/blob/2ee2e24185629fb8414301522b9dbae38dfc7aaf/lib/coverband/adapters/memcached_store.rb
lib/coverband/adapters/memcached_store.rb
# frozen_string_literal: true module Coverband module Adapters class MemcachedStore < Base STORAGE_FORMAT_VERSION = "coverband_3_2" attr_reader :memcached_namespace def initialize(memcached, opts = {}) super() @memcached = memcached @memcached_namespace = opts[:memcach...
ruby
MIT
2ee2e24185629fb8414301522b9dbae38dfc7aaf
2026-01-04T15:53:56.976483Z
false
danmayer/coverband
https://github.com/danmayer/coverband/blob/2ee2e24185629fb8414301522b9dbae38dfc7aaf/lib/coverband/adapters/redis_store.rb
lib/coverband/adapters/redis_store.rb
# frozen_string_literal: true module Coverband module Adapters ### # RedisStore store a merged coverage file to redis ### class RedisStore < Base ### # This key isn't related to the coverband version, but to the internal format # used to store data to redis. It is changed only when ...
ruby
MIT
2ee2e24185629fb8414301522b9dbae38dfc7aaf
2026-01-04T15:53:56.976483Z
false
danmayer/coverband
https://github.com/danmayer/coverband/blob/2ee2e24185629fb8414301522b9dbae38dfc7aaf/lib/coverband/adapters/null_store.rb
lib/coverband/adapters/null_store.rb
# frozen_string_literal: true module Coverband module Adapters ### # NullStore is for benchmarking the impacts of calculating # and storing coverage data independent of Coverband/Coverage # # Usage: # config.store = Coverband::Adapters::NullStore.new ### class NullStore < Base d...
ruby
MIT
2ee2e24185629fb8414301522b9dbae38dfc7aaf
2026-01-04T15:53:56.976483Z
false
danmayer/coverband
https://github.com/danmayer/coverband/blob/2ee2e24185629fb8414301522b9dbae38dfc7aaf/lib/coverband/adapters/web_service_store.rb
lib/coverband/adapters/web_service_store.rb
# frozen_string_literal: true module Coverband module Adapters ### # WebServiceStore: store a checkpoint of coverage to a remote service ### class WebServiceStore < Base attr_reader :coverband_url, :process_type, :runtime_env, :hostname, :pid def initialize(coverband_url, opts = {}) ...
ruby
MIT
2ee2e24185629fb8414301522b9dbae38dfc7aaf
2026-01-04T15:53:56.976483Z
false
danmayer/coverband
https://github.com/danmayer/coverband/blob/2ee2e24185629fb8414301522b9dbae38dfc7aaf/lib/coverband/adapters/hash_redis_store.rb
lib/coverband/adapters/hash_redis_store.rb
# frozen_string_literal: true require "securerandom" module Coverband module Adapters class HashRedisStore < Base FILE_KEY = "file" FILE_LENGTH_KEY = "file_length" META_DATA_KEYS = [DATA_KEY, FIRST_UPDATED_KEY, LAST_UPDATED_KEY, FILE_HASH].freeze ### # This key isn't related to the...
ruby
MIT
2ee2e24185629fb8414301522b9dbae38dfc7aaf
2026-01-04T15:53:56.976483Z
false
danmayer/coverband
https://github.com/danmayer/coverband/blob/2ee2e24185629fb8414301522b9dbae38dfc7aaf/lib/coverband/adapters/base.rb
lib/coverband/adapters/base.rb
# frozen_string_literal: true module Coverband module Adapters class Base DATA_KEY = "data" FIRST_UPDATED_KEY = "first_updated_at" LAST_UPDATED_KEY = "last_updated_at" FILE_HASH = "file_hash" ABSTRACT_KEY = "abstract" attr_accessor :type def initialize @type = ...
ruby
MIT
2ee2e24185629fb8414301522b9dbae38dfc7aaf
2026-01-04T15:53:56.976483Z
false
danmayer/coverband
https://github.com/danmayer/coverband/blob/2ee2e24185629fb8414301522b9dbae38dfc7aaf/lib/coverband/adapters/stdout_store.rb
lib/coverband/adapters/stdout_store.rb
# frozen_string_literal: true module Coverband module Adapters ### # StdoutStore is for testing and development # # Usage: # config.store = Coverband::Adapters::StdoutStore.new ### class StdoutStore < Base def initialize(_opts = {}) super() end def clear! ...
ruby
MIT
2ee2e24185629fb8414301522b9dbae38dfc7aaf
2026-01-04T15:53:56.976483Z
false
danmayer/coverband
https://github.com/danmayer/coverband/blob/2ee2e24185629fb8414301522b9dbae38dfc7aaf/lib/coverband/adapters/file_store.rb
lib/coverband/adapters/file_store.rb
# frozen_string_literal: true module Coverband module Adapters ### # FileStore store a merged coverage file to local disk # # Notes: Concurrency # * threadsafe as the caller to save_report uses @semaphore.synchronize # * file access process safe as each file written per process PID # ...
ruby
MIT
2ee2e24185629fb8414301522b9dbae38dfc7aaf
2026-01-04T15:53:56.976483Z
false
danmayer/coverband
https://github.com/danmayer/coverband/blob/2ee2e24185629fb8414301522b9dbae38dfc7aaf/lib/coverband/collectors/delta.rb
lib/coverband/collectors/delta.rb
# frozen_string_literal: true module Coverband module Collectors class Delta @@previous_coverage = {} @@stubs = {} attr_reader :current_coverage def initialize(current_coverage) @current_coverage = current_coverage end class RubyCoverage def self.results ...
ruby
MIT
2ee2e24185629fb8414301522b9dbae38dfc7aaf
2026-01-04T15:53:56.976483Z
false
danmayer/coverband
https://github.com/danmayer/coverband/blob/2ee2e24185629fb8414301522b9dbae38dfc7aaf/lib/coverband/collectors/translation_tracker.rb
lib/coverband/collectors/translation_tracker.rb
# frozen_string_literal: true require "set" require "singleton" module Coverband module Collectors module I18n module KeyRegistry def lookup(locale, key, scope = [], options = {}) separator = options[:separator] || ::I18n.default_separator flat_key = ::I18n.normalize_keys(local...
ruby
MIT
2ee2e24185629fb8414301522b9dbae38dfc7aaf
2026-01-04T15:53:56.976483Z
false
danmayer/coverband
https://github.com/danmayer/coverband/blob/2ee2e24185629fb8414301522b9dbae38dfc7aaf/lib/coverband/collectors/coverage.rb
lib/coverband/collectors/coverage.rb
# frozen_string_literal: true require "singleton" require_relative "delta" module Coverband module Collectors ### # StandardError seems like be better option # coverband previously had RuntimeError here # but runtime error can let a large number of error crash this method # and this method is cu...
ruby
MIT
2ee2e24185629fb8414301522b9dbae38dfc7aaf
2026-01-04T15:53:56.976483Z
false
danmayer/coverband
https://github.com/danmayer/coverband/blob/2ee2e24185629fb8414301522b9dbae38dfc7aaf/lib/coverband/collectors/abstract_tracker.rb
lib/coverband/collectors/abstract_tracker.rb
# frozen_string_literal: true require "set" require "singleton" module Coverband module Collectors ### # This abstract class makes it easy to track any used/unused with timestamp set of usage ### class AbstractTracker REPORT_ROUTE = "/" TITLE = "abstract" attr_accessor :target ...
ruby
MIT
2ee2e24185629fb8414301522b9dbae38dfc7aaf
2026-01-04T15:53:56.976483Z
false
danmayer/coverband
https://github.com/danmayer/coverband/blob/2ee2e24185629fb8414301522b9dbae38dfc7aaf/lib/coverband/collectors/view_tracker_service.rb
lib/coverband/collectors/view_tracker_service.rb
# frozen_string_literal: true module Coverband module Collectors ### # This class extends view tracker to support web service reporting ### class ViewTrackerService < ViewTracker def save_report reported_time = Time.now.to_i if @views_to_record.any? relative_views = @v...
ruby
MIT
2ee2e24185629fb8414301522b9dbae38dfc7aaf
2026-01-04T15:53:56.976483Z
false
danmayer/coverband
https://github.com/danmayer/coverband/blob/2ee2e24185629fb8414301522b9dbae38dfc7aaf/lib/coverband/collectors/route_tracker.rb
lib/coverband/collectors/route_tracker.rb
# frozen_string_literal: true require "set" require "singleton" module Coverband module Collectors ### # This class tracks route usage via ActiveSupport::Notifications ### class RouteTracker < AbstractTracker REPORT_ROUTE = "routes_tracker" TITLE = "Routes" def initialize(options ...
ruby
MIT
2ee2e24185629fb8414301522b9dbae38dfc7aaf
2026-01-04T15:53:56.976483Z
false
danmayer/coverband
https://github.com/danmayer/coverband/blob/2ee2e24185629fb8414301522b9dbae38dfc7aaf/lib/coverband/collectors/view_tracker.rb
lib/coverband/collectors/view_tracker.rb
# frozen_string_literal: true require "set" require "singleton" module Coverband module Collectors ### # This class tracks view file usage via ActiveSupport::Notifications # # This is a port of Flatfoot, a project I open sourced years ago, # but am now rolling into Coverband # https://github...
ruby
MIT
2ee2e24185629fb8414301522b9dbae38dfc7aaf
2026-01-04T15:53:56.976483Z
false
lucasgomide/videos-pt.br-tecnologia
https://github.com/lucasgomide/videos-pt.br-tecnologia/blob/b78b514958713b54dc124ca3c9b5a67236cf16c3/readme_checker_test.rb
readme_checker_test.rb
require 'rubygems' require 'bundler' Bundler.require(:default) class ReadmeCheckerTest < Test::Unit::TestCase def readme @readme ||= File.read('./README.md') end def readme_as_html @readme_as_html ||= Kramdown::Document.new(readme).to_html end def elements @elements ||= Nokogiri::HTML(readme_as...
ruby
MIT
b78b514958713b54dc124ca3c9b5a67236cf16c3
2026-01-04T15:54:59.470170Z
false
teampoltergeist/poltergeist
https://github.com/teampoltergeist/poltergeist/blob/6a27b00407b7845d2b19d4ec1a1e269c207f8957/spec/spec_helper.rb
spec/spec_helper.rb
# frozen_string_literal: true POLTERGEIST_ROOT = File.expand_path('..', __dir__) $:.unshift(POLTERGEIST_ROOT + '/lib') require 'bundler/setup' require 'rspec' require 'capybara/spec/spec_helper' require 'capybara/poltergeist' require 'support/test_app' require 'support/spec_logger' Capybara.register_driver :polter...
ruby
MIT
6a27b00407b7845d2b19d4ec1a1e269c207f8957
2026-01-04T15:55:00.321556Z
false
teampoltergeist/poltergeist
https://github.com/teampoltergeist/poltergeist/blob/6a27b00407b7845d2b19d4ec1a1e269c207f8957/spec/support/test_app.rb
spec/support/test_app.rb
# frozen_string_literal: true require 'capybara/spec/test_app' class TestApp configure do set :protection, except: :frame_options end POLTERGEIST_VIEWS = File.dirname(__FILE__) + '/views' POLTERGEIST_PUBLIC = File.dirname(__FILE__) + '/public' helpers do def requires_credentials(login, password) ...
ruby
MIT
6a27b00407b7845d2b19d4ec1a1e269c207f8957
2026-01-04T15:55:00.321556Z
false
teampoltergeist/poltergeist
https://github.com/teampoltergeist/poltergeist/blob/6a27b00407b7845d2b19d4ec1a1e269c207f8957/spec/support/spec_logger.rb
spec/support/spec_logger.rb
# frozen_string_literal: true class SpecLogger attr_reader :messages def reset @messages = [] end def puts(message) @messages << message end end
ruby
MIT
6a27b00407b7845d2b19d4ec1a1e269c207f8957
2026-01-04T15:55:00.321556Z
false
teampoltergeist/poltergeist
https://github.com/teampoltergeist/poltergeist/blob/6a27b00407b7845d2b19d4ec1a1e269c207f8957/spec/integration/driver_spec.rb
spec/integration/driver_spec.rb
# frozen_string_literal: true require 'spec_helper' require 'image_size' require 'pdf/reader' module Capybara::Poltergeist describe Driver do before do @session = TestSessions::Poltergeist @driver = @session.driver end after { @driver.reset! } def session_url(path) server = @sess...
ruby
MIT
6a27b00407b7845d2b19d4ec1a1e269c207f8957
2026-01-04T15:55:00.321556Z
true
teampoltergeist/poltergeist
https://github.com/teampoltergeist/poltergeist/blob/6a27b00407b7845d2b19d4ec1a1e269c207f8957/spec/integration/session_spec.rb
spec/integration/session_spec.rb
# frozen_string_literal: true require 'spec_helper' skip = [] skip << :windows if ENV['TRAVIS'] skip << :download # PhantomJS doesn't support downloading files Capybara::SpecHelper.run_specs TestSessions::Poltergeist, 'Poltergeist', capybara_skip: skip describe Capybara::Session do context 'with poltergeist driver...
ruby
MIT
6a27b00407b7845d2b19d4ec1a1e269c207f8957
2026-01-04T15:55:00.321556Z
true
teampoltergeist/poltergeist
https://github.com/teampoltergeist/poltergeist/blob/6a27b00407b7845d2b19d4ec1a1e269c207f8957/spec/unit/client_spec.rb
spec/unit/client_spec.rb
# frozen_string_literal: true require 'spec_helper' module Capybara::Poltergeist describe Client do let(:server) { double(port: 6000, host: '127.0.0.1') } let(:client_params) { {} } subject { Client.new(server, client_params) } context '#initialize' do it 'raises an error if phantomjs is too ...
ruby
MIT
6a27b00407b7845d2b19d4ec1a1e269c207f8957
2026-01-04T15:55:00.321556Z
false
teampoltergeist/poltergeist
https://github.com/teampoltergeist/poltergeist/blob/6a27b00407b7845d2b19d4ec1a1e269c207f8957/spec/unit/driver_spec.rb
spec/unit/driver_spec.rb
# frozen_string_literal: true require 'spec_helper' module Capybara::Poltergeist describe Driver do let(:default_phantomjs_options) { %w[--ignore-ssl-errors=yes --ssl-protocol=TLSv1] } context 'with no options' do subject { Driver.new(nil) } it 'does not log' do expect(subject.logger)....
ruby
MIT
6a27b00407b7845d2b19d4ec1a1e269c207f8957
2026-01-04T15:55:00.321556Z
false
teampoltergeist/poltergeist
https://github.com/teampoltergeist/poltergeist/blob/6a27b00407b7845d2b19d4ec1a1e269c207f8957/spec/unit/browser_spec.rb
spec/unit/browser_spec.rb
# frozen_string_literal: true require 'spec_helper' require 'stringio' module Capybara::Poltergeist describe Browser do let(:server) { double('server').as_null_object } let(:client) { double('client').as_null_object } context 'with a logger' do let(:logger) { StringIO.new } subject { B...
ruby
MIT
6a27b00407b7845d2b19d4ec1a1e269c207f8957
2026-01-04T15:55:00.321556Z
false
teampoltergeist/poltergeist
https://github.com/teampoltergeist/poltergeist/blob/6a27b00407b7845d2b19d4ec1a1e269c207f8957/spec/unit/inspector_spec.rb
spec/unit/inspector_spec.rb
# frozen_string_literal: true require 'spec_helper' module Capybara::Poltergeist describe Inspector do it 'detects a browser by default' do allow(Inspector).to receive_messages(detect_browser: 'chromium') expect(Inspector.new.browser).to eq('chromium') expect(Inspector.new(true).browser).to eq...
ruby
MIT
6a27b00407b7845d2b19d4ec1a1e269c207f8957
2026-01-04T15:55:00.321556Z
false
teampoltergeist/poltergeist
https://github.com/teampoltergeist/poltergeist/blob/6a27b00407b7845d2b19d4ec1a1e269c207f8957/lib/capybara/poltergeist.rb
lib/capybara/poltergeist.rb
# frozen_string_literal: true require 'capybara' module Capybara module Poltergeist require 'capybara/poltergeist/utility' require 'capybara/poltergeist/driver' require 'capybara/poltergeist/browser' require 'capybara/poltergeist/node' require 'capybara/poltergeist/server' require 'capybara/...
ruby
MIT
6a27b00407b7845d2b19d4ec1a1e269c207f8957
2026-01-04T15:55:00.321556Z
false
teampoltergeist/poltergeist
https://github.com/teampoltergeist/poltergeist/blob/6a27b00407b7845d2b19d4ec1a1e269c207f8957/lib/capybara/poltergeist/command.rb
lib/capybara/poltergeist/command.rb
# frozen_string_literal: true require 'securerandom' module Capybara::Poltergeist class Command attr_reader :id attr_reader :name attr_accessor :args def initialize(name, *args) @id = SecureRandom.uuid @name = name @args = args end def message JSON.dump('id' => @id,...
ruby
MIT
6a27b00407b7845d2b19d4ec1a1e269c207f8957
2026-01-04T15:55:00.321556Z
false
teampoltergeist/poltergeist
https://github.com/teampoltergeist/poltergeist/blob/6a27b00407b7845d2b19d4ec1a1e269c207f8957/lib/capybara/poltergeist/version.rb
lib/capybara/poltergeist/version.rb
# frozen_string_literal: true module Capybara module Poltergeist VERSION = '1.18.1' end end
ruby
MIT
6a27b00407b7845d2b19d4ec1a1e269c207f8957
2026-01-04T15:55:00.321556Z
false
teampoltergeist/poltergeist
https://github.com/teampoltergeist/poltergeist/blob/6a27b00407b7845d2b19d4ec1a1e269c207f8957/lib/capybara/poltergeist/errors.rb
lib/capybara/poltergeist/errors.rb
# frozen_string_literal: true module Capybara module Poltergeist class Error < StandardError; end class NoSuchWindowError < Error; end class ClientError < Error attr_reader :response def initialize(response) @response = response end end class JSErrorItem attr_re...
ruby
MIT
6a27b00407b7845d2b19d4ec1a1e269c207f8957
2026-01-04T15:55:00.321556Z
false
teampoltergeist/poltergeist
https://github.com/teampoltergeist/poltergeist/blob/6a27b00407b7845d2b19d4ec1a1e269c207f8957/lib/capybara/poltergeist/utility.rb
lib/capybara/poltergeist/utility.rb
# frozen_string_literal: true module Capybara module Poltergeist class << self def windows? RbConfig::CONFIG['host_os'] =~ /mingw|mswin|cygwin/ end def mri? defined?(RUBY_ENGINE) && RUBY_ENGINE == 'ruby' end end end end
ruby
MIT
6a27b00407b7845d2b19d4ec1a1e269c207f8957
2026-01-04T15:55:00.321556Z
false
teampoltergeist/poltergeist
https://github.com/teampoltergeist/poltergeist/blob/6a27b00407b7845d2b19d4ec1a1e269c207f8957/lib/capybara/poltergeist/driver.rb
lib/capybara/poltergeist/driver.rb
# frozen_string_literal: true require 'uri' module Capybara::Poltergeist class Driver < Capybara::Driver::Base DEFAULT_TIMEOUT = 30 attr_reader :app, :options def initialize(app, options = {}) @app = app @options = options @browser = nil @inspector = nil @server...
ruby
MIT
6a27b00407b7845d2b19d4ec1a1e269c207f8957
2026-01-04T15:55:00.321556Z
false
teampoltergeist/poltergeist
https://github.com/teampoltergeist/poltergeist/blob/6a27b00407b7845d2b19d4ec1a1e269c207f8957/lib/capybara/poltergeist/browser.rb
lib/capybara/poltergeist/browser.rb
# frozen_string_literal: true require 'capybara/poltergeist/errors' require 'capybara/poltergeist/command' require 'json' require 'time' module Capybara::Poltergeist class Browser ERROR_MAPPINGS = { 'Poltergeist.JavascriptError' => JavascriptError, 'Poltergeist.FrameNotFound' => FrameNotFound, ...
ruby
MIT
6a27b00407b7845d2b19d4ec1a1e269c207f8957
2026-01-04T15:55:00.321556Z
false
teampoltergeist/poltergeist
https://github.com/teampoltergeist/poltergeist/blob/6a27b00407b7845d2b19d4ec1a1e269c207f8957/lib/capybara/poltergeist/node.rb
lib/capybara/poltergeist/node.rb
# frozen_string_literal: true module Capybara::Poltergeist class Node < Capybara::Driver::Node attr_reader :page_id, :id def initialize(driver, page_id, id) super(driver, self) @page_id = page_id @id = id end def browser driver.browser end def command(name, *a...
ruby
MIT
6a27b00407b7845d2b19d4ec1a1e269c207f8957
2026-01-04T15:55:00.321556Z
false
teampoltergeist/poltergeist
https://github.com/teampoltergeist/poltergeist/blob/6a27b00407b7845d2b19d4ec1a1e269c207f8957/lib/capybara/poltergeist/inspector.rb
lib/capybara/poltergeist/inspector.rb
# frozen_string_literal: true module Capybara::Poltergeist class Inspector BROWSERS = %w[chromium chromium-browser google-chrome open].freeze DEFAULT_PORT = 9664 def self.detect_browser @browser ||= BROWSERS.find { |name| browser_binary_exists?(name) } end attr_reader :port def i...
ruby
MIT
6a27b00407b7845d2b19d4ec1a1e269c207f8957
2026-01-04T15:55:00.321556Z
false
teampoltergeist/poltergeist
https://github.com/teampoltergeist/poltergeist/blob/6a27b00407b7845d2b19d4ec1a1e269c207f8957/lib/capybara/poltergeist/web_socket_server.rb
lib/capybara/poltergeist/web_socket_server.rb
# frozen_string_literal: true require 'socket' require 'websocket/driver' module Capybara::Poltergeist # This is a 'custom' Web Socket server that is designed to be synchronous. What # this means is that it sends a message, and then waits for a response. It does # not expect to receive a message at any other ti...
ruby
MIT
6a27b00407b7845d2b19d4ec1a1e269c207f8957
2026-01-04T15:55:00.321556Z
false
teampoltergeist/poltergeist
https://github.com/teampoltergeist/poltergeist/blob/6a27b00407b7845d2b19d4ec1a1e269c207f8957/lib/capybara/poltergeist/network_traffic.rb
lib/capybara/poltergeist/network_traffic.rb
# frozen_string_literal: true module Capybara::Poltergeist module NetworkTraffic require 'capybara/poltergeist/network_traffic/request' require 'capybara/poltergeist/network_traffic/response' require 'capybara/poltergeist/network_traffic/error' end end
ruby
MIT
6a27b00407b7845d2b19d4ec1a1e269c207f8957
2026-01-04T15:55:00.321556Z
false
teampoltergeist/poltergeist
https://github.com/teampoltergeist/poltergeist/blob/6a27b00407b7845d2b19d4ec1a1e269c207f8957/lib/capybara/poltergeist/client.rb
lib/capybara/poltergeist/client.rb
# frozen_string_literal: true require 'capybara/poltergeist/utility' require 'cliver' module Capybara::Poltergeist class Client PHANTOMJS_SCRIPT = File.expand_path('client/compiled/main.js', __dir__) PHANTOMJS_VERSION = ['>= 1.8.1', '< 3.0'].freeze PHANTOMJS_NAME = 'phantomjs' KILL_TIMEOUT = 2 ...
ruby
MIT
6a27b00407b7845d2b19d4ec1a1e269c207f8957
2026-01-04T15:55:00.321556Z
false
teampoltergeist/poltergeist
https://github.com/teampoltergeist/poltergeist/blob/6a27b00407b7845d2b19d4ec1a1e269c207f8957/lib/capybara/poltergeist/server.rb
lib/capybara/poltergeist/server.rb
# frozen_string_literal: true module Capybara::Poltergeist class Server attr_reader :socket, :fixed_port, :timeout, :custom_host def initialize(fixed_port = nil, timeout = nil, custom_host = nil) @fixed_port = fixed_port @timeout = timeout @custom_host = custom_host start end ...
ruby
MIT
6a27b00407b7845d2b19d4ec1a1e269c207f8957
2026-01-04T15:55:00.321556Z
false
teampoltergeist/poltergeist
https://github.com/teampoltergeist/poltergeist/blob/6a27b00407b7845d2b19d4ec1a1e269c207f8957/lib/capybara/poltergeist/cookie.rb
lib/capybara/poltergeist/cookie.rb
# frozen_string_literal: true module Capybara::Poltergeist class Cookie def initialize(attributes) @attributes = attributes end def name @attributes['name'] end def value @attributes['value'] end def domain @attributes['domain'] end def path @attr...
ruby
MIT
6a27b00407b7845d2b19d4ec1a1e269c207f8957
2026-01-04T15:55:00.321556Z
false
teampoltergeist/poltergeist
https://github.com/teampoltergeist/poltergeist/blob/6a27b00407b7845d2b19d4ec1a1e269c207f8957/lib/capybara/poltergeist/network_traffic/response.rb
lib/capybara/poltergeist/network_traffic/response.rb
# frozen_string_literal: true module Capybara::Poltergeist::NetworkTraffic class Response def initialize(data) @data = data end def url @data['url'] end def status @data['status'] end def status_text @data['statusText'] end def headers @data['head...
ruby
MIT
6a27b00407b7845d2b19d4ec1a1e269c207f8957
2026-01-04T15:55:00.321556Z
false
teampoltergeist/poltergeist
https://github.com/teampoltergeist/poltergeist/blob/6a27b00407b7845d2b19d4ec1a1e269c207f8957/lib/capybara/poltergeist/network_traffic/request.rb
lib/capybara/poltergeist/network_traffic/request.rb
# frozen_string_literal: true module Capybara::Poltergeist::NetworkTraffic class Request attr_reader :response_parts, :error def initialize(data, response_parts = [], error = nil) @data = data @response_parts = response_parts @error = error end def url @data['url']...
ruby
MIT
6a27b00407b7845d2b19d4ec1a1e269c207f8957
2026-01-04T15:55:00.321556Z
false
teampoltergeist/poltergeist
https://github.com/teampoltergeist/poltergeist/blob/6a27b00407b7845d2b19d4ec1a1e269c207f8957/lib/capybara/poltergeist/network_traffic/error.rb
lib/capybara/poltergeist/network_traffic/error.rb
# frozen_string_literal: true module Capybara::Poltergeist::NetworkTraffic class Error def initialize(data) @data = data end def url @data['url'] end def code @data['errorCode'] end def description @data['errorString'] end end end
ruby
MIT
6a27b00407b7845d2b19d4ec1a1e269c207f8957
2026-01-04T15:55:00.321556Z
false
trailblazer/reform
https://github.com/trailblazer/reform/blob/94b0916746a237fc696e1831af3d5db8302650ae/test/errors_test.rb
test/errors_test.rb
require "test_helper" class ErrorsTest < Minitest::Spec class AlbumForm < TestForm property :title validation do params { required(:title).filled } end property :artists, default: [] property :producer do property :name end property :hit do property :title valida...
ruby
MIT
94b0916746a237fc696e1831af3d5db8302650ae
2026-01-04T15:55:03.310193Z
false
trailblazer/reform
https://github.com/trailblazer/reform/blob/94b0916746a237fc696e1831af3d5db8302650ae/test/form_test.rb
test/form_test.rb
require "test_helper" class FormTest < Minitest::Spec Artist = Struct.new(:name) class AlbumForm < TestForm property :title property :hit do property :title end collection :songs do property :title end property :band do # yepp, people do crazy stuff like that. property...
ruby
MIT
94b0916746a237fc696e1831af3d5db8302650ae
2026-01-04T15:55:03.310193Z
false
trailblazer/reform
https://github.com/trailblazer/reform/blob/94b0916746a237fc696e1831af3d5db8302650ae/test/deserialize_test.rb
test/deserialize_test.rb
require "test_helper" require "representable/json" class DeserializeTest < Minitest::Spec Song = Struct.new(:title, :album, :composer) Album = Struct.new(:title, :artist) Artist = Struct.new(:name, :callname) class JsonAlbumForm < TestForm module Json def deserialize(params) deserializer.ne...
ruby
MIT
94b0916746a237fc696e1831af3d5db8302650ae
2026-01-04T15:55:03.310193Z
false
trailblazer/reform
https://github.com/trailblazer/reform/blob/94b0916746a237fc696e1831af3d5db8302650ae/test/from_test.rb
test/from_test.rb
require "test_helper" class AsTest < BaseTest class AlbumForm < TestForm property :name, from: :title property :single, from: :hit do property :title end collection :tracks, from: :songs do property :name, from: :title end property :band do property :company, from: :label...
ruby
MIT
94b0916746a237fc696e1831af3d5db8302650ae
2026-01-04T15:55:03.310193Z
false
trailblazer/reform
https://github.com/trailblazer/reform/blob/94b0916746a237fc696e1831af3d5db8302650ae/test/coercion_test.rb
test/coercion_test.rb
require "test_helper" require "reform/form/coercion" require "disposable/twin/property/hash" class CoercionTest < BaseTest class Irreversible def self.call(value) value * 2 end end class Form < TestForm feature Coercion include Disposable::Twin::Property::Hash property :released_at, t...
ruby
MIT
94b0916746a237fc696e1831af3d5db8302650ae
2026-01-04T15:55:03.310193Z
false
trailblazer/reform
https://github.com/trailblazer/reform/blob/94b0916746a237fc696e1831af3d5db8302650ae/test/prepopulator_test.rb
test/prepopulator_test.rb
require "test_helper" class PrepopulatorTest < Minitest::Spec Song = Struct.new(:title, :band, :length) Band = Struct.new(:name) class AlbumForm < TestForm property :title, prepopulator: ->(*) { self.title = "Another Day At Work" } # normal assignment. property :length property :hi...
ruby
MIT
94b0916746a237fc696e1831af3d5db8302650ae
2026-01-04T15:55:03.310193Z
false
trailblazer/reform
https://github.com/trailblazer/reform/blob/94b0916746a237fc696e1831af3d5db8302650ae/test/validation_library_provided_test.rb
test/validation_library_provided_test.rb
require "reform" require "minitest/autorun" class ValidationLibraryProvidedTest < Minitest::Spec it "no validation library loaded" do assert_raises Reform::Validation::NoValidationLibraryError do class PersonForm < Reform::Form property :name validation do required(:name).maybe(:...
ruby
MIT
94b0916746a237fc696e1831af3d5db8302650ae
2026-01-04T15:55:03.310193Z
false
trailblazer/reform
https://github.com/trailblazer/reform/blob/94b0916746a237fc696e1831af3d5db8302650ae/test/changed_test.rb
test/changed_test.rb
require "test_helper" require "reform/form/coercion" class ChangedTest < Minitest::Spec Song = Struct.new(:title, :album, :composer) Album = Struct.new(:name, :songs, :artist) Artist = Struct.new(:name) class AlbumForm < TestForm property :name collection :songs do property :title prope...
ruby
MIT
94b0916746a237fc696e1831af3d5db8302650ae
2026-01-04T15:55:03.310193Z
false
trailblazer/reform
https://github.com/trailblazer/reform/blob/94b0916746a237fc696e1831af3d5db8302650ae/test/feature_test.rb
test/feature_test.rb
class FeatureInheritanceTest < BaseTest Song = Struct.new(:title, :album, :composer) Album = Struct.new(:name, :songs, :artist) Artist = Struct.new(:name) module Date def date "May 16" end def self.included(includer) includer.send :register_feature, self end end # module Name...
ruby
MIT
94b0916746a237fc696e1831af3d5db8302650ae
2026-01-04T15:55:03.310193Z
false
trailblazer/reform
https://github.com/trailblazer/reform/blob/94b0916746a237fc696e1831af3d5db8302650ae/test/populator_skip_test.rb
test/populator_skip_test.rb
require "test_helper" class PopulatorSkipTest < Minitest::Spec Album = Struct.new(:songs) Song = Struct.new(:title) class AlbumForm < TestForm collection :songs, populator: :my_populator do property :title end def my_populator(options) return skip! if options[:fragment][:title] == "Goo...
ruby
MIT
94b0916746a237fc696e1831af3d5db8302650ae
2026-01-04T15:55:03.310193Z
false
trailblazer/reform
https://github.com/trailblazer/reform/blob/94b0916746a237fc696e1831af3d5db8302650ae/test/contract_test.rb
test/contract_test.rb
require "test_helper" class ContractTest < Minitest::Spec Song = Struct.new(:title, :album, :composer) Album = Struct.new(:name, :duration, :songs, :artist) Artist = Struct.new(:name) class ArtistForm < TestForm property :name end class AlbumForm < TestContract property :name properties :du...
ruby
MIT
94b0916746a237fc696e1831af3d5db8302650ae
2026-01-04T15:55:03.310193Z
false
trailblazer/reform
https://github.com/trailblazer/reform/blob/94b0916746a237fc696e1831af3d5db8302650ae/test/inherit_test.rb
test/inherit_test.rb
require "test_helper" require "representable/json" class InheritTest < BaseTest Populator = Reform::Form::Populator class SkipParse include Uber::Callable def call(*_args) false end end class AlbumForm < TestForm property :title, deserializer: {instance: "Instance"}, skip_if: "skip_if i...
ruby
MIT
94b0916746a237fc696e1831af3d5db8302650ae
2026-01-04T15:55:03.310193Z
false
trailblazer/reform
https://github.com/trailblazer/reform/blob/94b0916746a237fc696e1831af3d5db8302650ae/test/test_helper.rb
test/test_helper.rb
# frozen_string_literal: true begin require "debug" rescue LoadError # debug gem not available, continue without it end require "reform" require "minitest/autorun" require "representable/debug" require "declarative/testing" require "pp" require "reform/form/dry" # setup test classes so we can test without dry b...
ruby
MIT
94b0916746a237fc696e1831af3d5db8302650ae
2026-01-04T15:55:03.310193Z
false
trailblazer/reform
https://github.com/trailblazer/reform/blob/94b0916746a237fc696e1831af3d5db8302650ae/test/virtual_test.rb
test/virtual_test.rb
require "test_helper" class VirtualTest < Minitest::Spec class CreditCardForm < TestForm property :credit_card_number, virtual: true # no read, no write, it's virtual. collection :transactions, virtual: true, populate_if_empty: OpenStruct do property :id end end let(:form) { CreditCardForm.new...
ruby
MIT
94b0916746a237fc696e1831af3d5db8302650ae
2026-01-04T15:55:03.310193Z
false
trailblazer/reform
https://github.com/trailblazer/reform/blob/94b0916746a237fc696e1831af3d5db8302650ae/test/read_only_test.rb
test/read_only_test.rb
require "test_helper" class ReadonlyTest < Minitest::Spec class SongForm < TestForm property :artist property :title, writeable: false # TODO: what to do with virtual values? end let(:form) { SongForm.new(OpenStruct.new) } it { refute form.readonly?(:artist) } it { assert form.readonly?(:title)...
ruby
MIT
94b0916746a237fc696e1831af3d5db8302650ae
2026-01-04T15:55:03.310193Z
false
trailblazer/reform
https://github.com/trailblazer/reform/blob/94b0916746a237fc696e1831af3d5db8302650ae/test/readable_test.rb
test/readable_test.rb
require "test_helper" class ReadableTest < Minitest::Spec Credentials = Struct.new(:password) class PasswordForm < TestForm property :password, readable: false end let(:cred) { Credentials.new } let(:form) { PasswordForm.new(cred) } it { assert_nil form.password # password not read. form.va...
ruby
MIT
94b0916746a237fc696e1831af3d5db8302650ae
2026-01-04T15:55:03.310193Z
false
trailblazer/reform
https://github.com/trailblazer/reform/blob/94b0916746a237fc696e1831af3d5db8302650ae/test/parse_pipeline_test.rb
test/parse_pipeline_test.rb
require "test_helper" class ParsePipelineTest < Minitest::Spec Album = Struct.new(:name) class AlbumForm < TestForm property :name, deserializer: {parse_pipeline: ->(input, options) { Representable::Pipeline[->(ipt, opts) { opts[:represented].name = ipt.inspect }] }} end it "allows passing :parse_pipelin...
ruby
MIT
94b0916746a237fc696e1831af3d5db8302650ae
2026-01-04T15:55:03.310193Z
false
trailblazer/reform
https://github.com/trailblazer/reform/blob/94b0916746a237fc696e1831af3d5db8302650ae/test/skip_setter_and_getter_test.rb
test/skip_setter_and_getter_test.rb
require "test_helper" # Overridden setter won't be called in setup. # Overridden getter won't be called in sync. class SetupSkipSetterAndGetterTest < Minitest::Spec Song = Struct.new(:title, :album, :composer) Album = Struct.new(:title, :artist) Artist = Struct.new(:name) class AlbumForm < TestForm prope...
ruby
MIT
94b0916746a237fc696e1831af3d5db8302650ae
2026-01-04T15:55:03.310193Z
false
trailblazer/reform
https://github.com/trailblazer/reform/blob/94b0916746a237fc696e1831af3d5db8302650ae/test/call_test.rb
test/call_test.rb
require "test_helper" class CallTest < Minitest::Spec Song = Struct.new(:title) class SongForm < TestForm property :title validation do params { required(:title).filled } end end let(:form) { SongForm.new(Song.new) } it { assert form.(title: "True North").success? } it { refute form.(...
ruby
MIT
94b0916746a237fc696e1831af3d5db8302650ae
2026-01-04T15:55:03.310193Z
false
trailblazer/reform
https://github.com/trailblazer/reform/blob/94b0916746a237fc696e1831af3d5db8302650ae/test/form_option_test.rb
test/form_option_test.rb
require "test_helper" class FormOptionTest < Minitest::Spec Song = Struct.new(:title) Album = Struct.new(:song) class SongForm < TestForm property :title validation do params { required(:title).filled } end end class AlbumForm < TestForm property :song, form: SongForm end it do ...
ruby
MIT
94b0916746a237fc696e1831af3d5db8302650ae
2026-01-04T15:55:03.310193Z
false
trailblazer/reform
https://github.com/trailblazer/reform/blob/94b0916746a237fc696e1831af3d5db8302650ae/test/composition_test.rb
test/composition_test.rb
require "test_helper" class FormCompositionInheritanceTest < Minitest::Spec module SizePrice include Reform::Form::Module property :price property :size module InstanceMethods def price(for_size: size) case for_size.to_sym when :s then super() * 1 when :m then supe...
ruby
MIT
94b0916746a237fc696e1831af3d5db8302650ae
2026-01-04T15:55:03.310193Z
false
trailblazer/reform
https://github.com/trailblazer/reform/blob/94b0916746a237fc696e1831af3d5db8302650ae/test/benchmarking.rb
test/benchmarking.rb
require "reform" require "benchmark/ips" require "reform/form/dry" class BandForm < Reform::Form feature Reform::Form::Dry property :name #, validates: {presence: true} collection :songs do property :title #, validates: {presence: true} end end class OptimizedBandForm < Reform::Form feature Reform::Form...
ruby
MIT
94b0916746a237fc696e1831af3d5db8302650ae
2026-01-04T15:55:03.310193Z
false
trailblazer/reform
https://github.com/trailblazer/reform/blob/94b0916746a237fc696e1831af3d5db8302650ae/test/default_test.rb
test/default_test.rb
require "test_helper" class DefaultTest < Minitest::Spec Song = Struct.new(:title, :album, :composer) Album = Struct.new(:name, :songs, :artist) Artist = Struct.new(:name) class AlbumForm < TestForm property :name, default: "Wrong" collection :songs do property :title, default: "It's Catching ...
ruby
MIT
94b0916746a237fc696e1831af3d5db8302650ae
2026-01-04T15:55:03.310193Z
false
trailblazer/reform
https://github.com/trailblazer/reform/blob/94b0916746a237fc696e1831af3d5db8302650ae/test/validate_test.rb
test/validate_test.rb
require "test_helper" class ContractValidateTest < Minitest::Spec class AlbumForm < TestContract property :name validation do params { required(:name).filled } end collection :songs do property :title validation do params { required(:title).filled } end propert...
ruby
MIT
94b0916746a237fc696e1831af3d5db8302650ae
2026-01-04T15:55:03.310193Z
false
trailblazer/reform
https://github.com/trailblazer/reform/blob/94b0916746a237fc696e1831af3d5db8302650ae/test/skip_if_test.rb
test/skip_if_test.rb
require "test_helper" class SkipIfTest < BaseTest let(:hit) { Song.new } let(:album) { Album.new(nil, hit, [], nil) } class AlbumForm < TestForm property :title property :hit, skip_if: ->(options) { options[:fragment]["title"] == "" } do property :title validation do params { requir...
ruby
MIT
94b0916746a237fc696e1831af3d5db8302650ae
2026-01-04T15:55:03.310193Z
false
trailblazer/reform
https://github.com/trailblazer/reform/blob/94b0916746a237fc696e1831af3d5db8302650ae/test/reform_test.rb
test/reform_test.rb
require "test_helper" class ReformTest < Minitest::Spec let(:comp) { OpenStruct.new(name: "Duran Duran", title: "Rio") } let(:form) { SongForm.new(comp) } class SongForm < TestForm property :name property :title validation do params { required(:name).filled } end end describe "(new)...
ruby
MIT
94b0916746a237fc696e1831af3d5db8302650ae
2026-01-04T15:55:03.310193Z
false
trailblazer/reform
https://github.com/trailblazer/reform/blob/94b0916746a237fc696e1831af3d5db8302650ae/test/populate_test.rb
test/populate_test.rb
require "test_helper" class PopulatorTest < Minitest::Spec Song = Struct.new(:title, :album, :composer) Album = Struct.new(:name, :songs, :artist) Artist = Struct.new(:name) class AlbumForm < TestForm property :name, populator: ->(options) { self.name = options[:fragment].reverse } validation do ...
ruby
MIT
94b0916746a237fc696e1831af3d5db8302650ae
2026-01-04T15:55:03.310193Z
false
trailblazer/reform
https://github.com/trailblazer/reform/blob/94b0916746a237fc696e1831af3d5db8302650ae/test/writeable_test.rb
test/writeable_test.rb
require "test_helper" class WriteableTest < Minitest::Spec Location = Struct.new(:country) class LocationForm < TestForm property :country, writeable: false end let(:loc) { Location.new("Australia") } let(:form) { LocationForm.new(loc) } it do assert_equal form.country, "Australia" form.val...
ruby
MIT
94b0916746a237fc696e1831af3d5db8302650ae
2026-01-04T15:55:03.310193Z
false
trailblazer/reform
https://github.com/trailblazer/reform/blob/94b0916746a237fc696e1831af3d5db8302650ae/test/parse_option_test.rb
test/parse_option_test.rb
require "test_helper" class ParseOptionTest < Minitest::Spec Comment = Struct.new(:content, :user) User = Struct.new(:name) class CommentForm < TestForm property :content property :user, parse: false end let(:current_user) { User.new("Peter") } let(:form) { CommentForm.new(Comment.new, user: c...
ruby
MIT
94b0916746a237fc696e1831af3d5db8302650ae
2026-01-04T15:55:03.310193Z
false
trailblazer/reform
https://github.com/trailblazer/reform/blob/94b0916746a237fc696e1831af3d5db8302650ae/test/module_test.rb
test/module_test.rb
require "test_helper" require "reform/form/coercion" class ModuleInclusionTest < Minitest::Spec module BandPropertyForm include Reform::Form::Module property :band do property :title validation do params { required(:title).filled } end def id # gets mixed into Form, too. ...
ruby
MIT
94b0916746a237fc696e1831af3d5db8302650ae
2026-01-04T15:55:03.310193Z
false
trailblazer/reform
https://github.com/trailblazer/reform/blob/94b0916746a237fc696e1831af3d5db8302650ae/test/setup_test.rb
test/setup_test.rb
require "test_helper" class SetupTest < Minitest::Spec Song = Struct.new(:title, :album, :composer) Album = Struct.new(:name, :songs, :artist) Artist = Struct.new(:name) class AlbumForm < TestForm property :name collection :songs do property :title property :composer do property ...
ruby
MIT
94b0916746a237fc696e1831af3d5db8302650ae
2026-01-04T15:55:03.310193Z
false
trailblazer/reform
https://github.com/trailblazer/reform/blob/94b0916746a237fc696e1831af3d5db8302650ae/test/save_test.rb
test/save_test.rb
require "test_helper" class SaveTest < BaseTest Song = Struct.new(:title, :album, :composer) Album = Struct.new(:name, :songs, :artist) Artist = Struct.new(:name) class AlbumForm < TestForm property :name validation do params { required(:name).filled } end collection :songs do pr...
ruby
MIT
94b0916746a237fc696e1831af3d5db8302650ae
2026-01-04T15:55:03.310193Z
false
trailblazer/reform
https://github.com/trailblazer/reform/blob/94b0916746a237fc696e1831af3d5db8302650ae/test/validation/dry_validation_test.rb
test/validation/dry_validation_test.rb
require "test_helper" require "reform/form/dry" require "reform/form/coercion" #--- # one "nested" Schema per form. class DryValidationErrorsAPITest < Minitest::Spec Album = Struct.new(:title, :artist, :songs) Song = Struct.new(:title) Artist = Struct.new(:email, :label) Label = Struct.new(:location) cla...
ruby
MIT
94b0916746a237fc696e1831af3d5db8302650ae
2026-01-04T15:55:03.310193Z
false
trailblazer/reform
https://github.com/trailblazer/reform/blob/94b0916746a237fc696e1831af3d5db8302650ae/test/validation/result_test.rb
test/validation/result_test.rb
require "test_helper" class ErrorsResultTest < Minitest::Spec MyResult = Struct.new(:success?, :errors) do def failure?; !success? end end # TODO: errors(args) not tested. describe "Contract::Result#success?" do let(:failed) { MyResult.new(false) } let(:succeeded) { MyResult.new(true) } it {...
ruby
MIT
94b0916746a237fc696e1831af3d5db8302650ae
2026-01-04T15:55:03.310193Z
false
trailblazer/reform
https://github.com/trailblazer/reform/blob/94b0916746a237fc696e1831af3d5db8302650ae/test/docs/validation_test.rb
test/docs/validation_test.rb
require 'test_helper' require 'reform/form/dry' class DocsDryVTest < Minitest::Spec #:basic class AlbumForm < Reform::Form feature Reform::Form::Dry property :name validation do params do required(:name).filled end end end #:basic end it 'validates correctly' do for...
ruby
MIT
94b0916746a237fc696e1831af3d5db8302650ae
2026-01-04T15:55:03.310193Z
false
trailblazer/reform
https://github.com/trailblazer/reform/blob/94b0916746a237fc696e1831af3d5db8302650ae/test/contract/custom_error_test.rb
test/contract/custom_error_test.rb
require "test_helper" class CustomerErrorTest < Minitest::Spec let(:key) { :name } let(:error_text) { "text2" } let(:starting_error) { [OpenStruct.new(errors: {title: ["text1"]})] } let(:custom_error) { Reform::Contract::CustomError.new(key, error_text, @results) } before { @results = starti...
ruby
MIT
94b0916746a237fc696e1831af3d5db8302650ae
2026-01-04T15:55:03.310193Z
false
trailblazer/reform
https://github.com/trailblazer/reform/blob/94b0916746a237fc696e1831af3d5db8302650ae/lib/reform.rb
lib/reform.rb
module Reform end require "disposable" require "reform/contract" require "reform/form" require "reform/form/composition" require "reform/form/module" require "reform/errors" # TODO: remove in Reform 3.
ruby
MIT
94b0916746a237fc696e1831af3d5db8302650ae
2026-01-04T15:55:03.310193Z
false
trailblazer/reform
https://github.com/trailblazer/reform/blob/94b0916746a237fc696e1831af3d5db8302650ae/lib/reform/version.rb
lib/reform/version.rb
module Reform VERSION = "2.6.2".freeze end
ruby
MIT
94b0916746a237fc696e1831af3d5db8302650ae
2026-01-04T15:55:03.310193Z
false
trailblazer/reform
https://github.com/trailblazer/reform/blob/94b0916746a237fc696e1831af3d5db8302650ae/lib/reform/contract.rb
lib/reform/contract.rb
module Reform # Define your form structure and its validations. Instantiate it with a model, # and then +validate+ this object graph. class Contract < Disposable::Twin require "reform/contract/custom_error" require "disposable/twin/composition" # Expose. include Expose feature Setup feature S...
ruby
MIT
94b0916746a237fc696e1831af3d5db8302650ae
2026-01-04T15:55:03.310193Z
false
trailblazer/reform
https://github.com/trailblazer/reform/blob/94b0916746a237fc696e1831af3d5db8302650ae/lib/reform/errors.rb
lib/reform/errors.rb
# Provides the old API for Rails and friends. # Note that this might become an optional "deprecation" gem in Reform 3. class Reform::Contract::Result::Errors def initialize(result, form) @result = result # DISCUSS: we don't use this ATM? @form = form @dotted_errors = {} # Reform does not e...
ruby
MIT
94b0916746a237fc696e1831af3d5db8302650ae
2026-01-04T15:55:03.310193Z
false
trailblazer/reform
https://github.com/trailblazer/reform/blob/94b0916746a237fc696e1831af3d5db8302650ae/lib/reform/form.rb
lib/reform/form.rb
module Reform class Form < Contract class InvalidOptionsCombinationError < StandardError; end def self.default_nested_class Form end require "reform/form/validate" include Validate # override Contract#validate with additional behaviour. require "reform/form/populator" # called af...
ruby
MIT
94b0916746a237fc696e1831af3d5db8302650ae
2026-01-04T15:55:03.310193Z
false
trailblazer/reform
https://github.com/trailblazer/reform/blob/94b0916746a237fc696e1831af3d5db8302650ae/lib/reform/result.rb
lib/reform/result.rb
module Reform class Contract < Disposable::Twin # Collects all native results of a form of all groups and provides # a unified API: #success?, #errors, #messages, #hints. # #success? returns validity of the branch. class Result def initialize(results, nested_results = []) # DISCUSS: do we like t...
ruby
MIT
94b0916746a237fc696e1831af3d5db8302650ae
2026-01-04T15:55:03.310193Z
false
trailblazer/reform
https://github.com/trailblazer/reform/blob/94b0916746a237fc696e1831af3d5db8302650ae/lib/reform/validation.rb
lib/reform/validation.rb
# Adds ::validates and friends, and #valid? to the object. # This is completely form-independent. module Reform::Validation module ClassMethods def validation_groups @groups ||= Groups.new(validation_group_class) end # DSL. def validation(name = nil, options = {}, &block) options = deprec...
ruby
MIT
94b0916746a237fc696e1831af3d5db8302650ae
2026-01-04T15:55:03.310193Z
false
trailblazer/reform
https://github.com/trailblazer/reform/blob/94b0916746a237fc696e1831af3d5db8302650ae/lib/reform/validation/groups.rb
lib/reform/validation/groups.rb
module Reform::Validation # A Group is a set of native validations, targeting a validation backend (AM, Lotus, Dry). # Group receives configuration via #validates and #validate and translates that to its # internal backend. # # The #call method will run those validations on the provided objects. # Set of V...
ruby
MIT
94b0916746a237fc696e1831af3d5db8302650ae
2026-01-04T15:55:03.310193Z
false
trailblazer/reform
https://github.com/trailblazer/reform/blob/94b0916746a237fc696e1831af3d5db8302650ae/lib/reform/form/composition.rb
lib/reform/form/composition.rb
require "disposable/twin/composition" module Reform::Form::Composition # Automatically creates a Composition object for you when initializing the form. def self.included(base) base.class_eval do # extend Reform::Form::ActiveModel::ClassMethods # ::model. extend ClassMethods include Disposable...
ruby
MIT
94b0916746a237fc696e1831af3d5db8302650ae
2026-01-04T15:55:03.310193Z
false
trailblazer/reform
https://github.com/trailblazer/reform/blob/94b0916746a237fc696e1831af3d5db8302650ae/lib/reform/form/dry.rb
lib/reform/form/dry.rb
gem 'dry-validation', '~> 1.5' require "dry-validation" require "reform/validation" require "reform/form/dry/input_hash" ::Dry::Validation.load_extensions(:hints) module Reform::Form::Dry class Contract < Dry::Validation::Contract end def self.included(includer) includer.send :include, Validations incl...
ruby
MIT
94b0916746a237fc696e1831af3d5db8302650ae
2026-01-04T15:55:03.310193Z
false
trailblazer/reform
https://github.com/trailblazer/reform/blob/94b0916746a237fc696e1831af3d5db8302650ae/lib/reform/form/prepopulate.rb
lib/reform/form/prepopulate.rb
# prepopulate!(options) # prepopulator: ->(model, user_options) module Reform::Form::Prepopulate def prepopulate!(options = {}) prepopulate_local!(options) # call #prepopulate! on local properties. prepopulate_nested!(options) # THEN call #prepopulate! on nested forms. self end private def prepo...
ruby
MIT
94b0916746a237fc696e1831af3d5db8302650ae
2026-01-04T15:55:03.310193Z
false
trailblazer/reform
https://github.com/trailblazer/reform/blob/94b0916746a237fc696e1831af3d5db8302650ae/lib/reform/form/validate.rb
lib/reform/form/validate.rb
# Mechanics for writing to forms in #validate. module Reform::Form::Validate module Skip class AllBlank include Uber::Callable def call(input:, binding:, **) # TODO: Schema should provide property names as plain list. # ensure param keys are strings. params = input.each_with_o...
ruby
MIT
94b0916746a237fc696e1831af3d5db8302650ae
2026-01-04T15:55:03.310193Z
false
trailblazer/reform
https://github.com/trailblazer/reform/blob/94b0916746a237fc696e1831af3d5db8302650ae/lib/reform/form/module.rb
lib/reform/form/module.rb
# Include this in every module that gets further included. module Reform::Form::Module # DISCUSS: could this be part of Declarative? def self.included(base) base.extend ClassMethods base.extend Declarative::Heritage::DSL # ::heritage # base.extend Declarative::Heritage::Included # ::included base.ex...
ruby
MIT
94b0916746a237fc696e1831af3d5db8302650ae
2026-01-04T15:55:03.310193Z
false
trailblazer/reform
https://github.com/trailblazer/reform/blob/94b0916746a237fc696e1831af3d5db8302650ae/lib/reform/form/coercion.rb
lib/reform/form/coercion.rb
require "disposable/twin/coercion" Reform::Form::Coercion = Disposable::Twin::Coercion
ruby
MIT
94b0916746a237fc696e1831af3d5db8302650ae
2026-01-04T15:55:03.310193Z
false
trailblazer/reform
https://github.com/trailblazer/reform/blob/94b0916746a237fc696e1831af3d5db8302650ae/lib/reform/form/populator.rb
lib/reform/form/populator.rb
# Implements the :populator option. # # populator: -> (fragment:, model:, :binding) # populator: -> (fragment:, collection:, index:, binding:) # # For collections, the entire collection and the currently deserialised index is passed in. class Reform::Form::Populator def initialize(user_proc) @user_proc = user_p...
ruby
MIT
94b0916746a237fc696e1831af3d5db8302650ae
2026-01-04T15:55:03.310193Z
false
trailblazer/reform
https://github.com/trailblazer/reform/blob/94b0916746a237fc696e1831af3d5db8302650ae/lib/reform/form/call.rb
lib/reform/form/call.rb
module Reform::Form::Call def call(params, &block) bool = validate(params, &block) Result.new(bool, self) end # TODO: the result object might soon come from dry. class Result < SimpleDelegator def initialize(success, data) @success = success super(data) end def success? ...
ruby
MIT
94b0916746a237fc696e1831af3d5db8302650ae
2026-01-04T15:55:03.310193Z
false