source
stringclasses
1 value
repo
stringlengths
5
63
repo_url
stringlengths
24
82
path
stringlengths
5
167
language
stringclasses
1 value
license
stringclasses
5 values
stars
int64
10
51.4k
ref
stringclasses
23 values
size_bytes
int64
200
258k
text
stringlengths
137
258k
github
sergiobayona/easy_talk
https://github.com/sergiobayona/easy_talk
spec/easy_talk/extensions/ruby_llm_compatibility_spec.rb
Ruby
mit
96
main
3,180
# frozen_string_literal: true require 'spec_helper' require 'easy_talk/extensions/ruby_llm_compatibility' RSpec.describe EasyTalk::Extensions::RubyLLMCompatibility do let(:model_class) do Class.new do include EasyTalk::Model def self.name 'TestModel' end define_schema do ...
github
sergiobayona/easy_talk
https://github.com/sergiobayona/easy_talk
spec/easy_talk/tools/function_builder_spec.rb
Ruby
mit
96
main
1,569
# frozen_string_literal: true require 'spec_helper' RSpec.describe EasyTalk::Tools::FunctionBuilder do let(:model) do Class.new do include EasyTalk::Model def self.name 'MyModel' end define_schema do property :name, String property :age, Integer end en...
github
sergiobayona/easy_talk
https://github.com/sergiobayona/easy_talk
examples/ruby_llm/structured_output.rb
Ruby
mit
96
main
1,592
# frozen_string_literal: true require 'bundler/setup' require 'ruby_llm' require 'easy_talk' # Example: Structured Outputs # Demonstrates using EasyTalk models to generate structured JSON responses. RubyLLM.configure do |config| config.openai_api_key = ENV.fetch('OPENAI_API_KEY', nil) end # 1. Define the Schema u...
github
sergiobayona/easy_talk
https://github.com/sergiobayona/easy_talk
examples/ruby_llm/tools_integration.rb
Ruby
mit
96
main
1,495
# frozen_string_literal: true require 'bundler/setup' require 'ruby_llm' require 'easy_talk' require 'faraday' # Example: Tools Integration # Demonstrates using EasyTalk models as Tools for RubyLLM. # # To create a tool, inherit from RubyLLM::Tool and include EasyTalk::Model. # This gives you: # - Full access to Ruby...
github
sergiobayona/easy_talk
https://github.com/sergiobayona/easy_talk
examples/ruby_llm/Gemfile
Ruby
mit
96
main
244
# frozen_string_literal: true source 'https://rubygems.org' # EasyTalk from the parent directory gem 'easy_talk', path: '../..' # RubyLLM for LLM interactions gem 'ruby_llm' # HTTP client for API calls (used in tools example) gem 'faraday'
github
sergiobayona/easy_talk
https://github.com/sergiobayona/easy_talk
lib/easy_talk.rb
Ruby
mit
96
main
3,133
# frozen_string_literal: true # The EasyTalk module is the main namespace for the gem. module EasyTalk require 'sorbet-runtime' require 'easy_talk/sorbet_extension' require 'easy_talk/errors' require 'easy_talk/type_introspection' require 'easy_talk/errors_helper' require 'easy_talk/configuration' requir...
github
sergiobayona/easy_talk
https://github.com/sergiobayona/easy_talk
lib/easy_talk/schema_base.rb
Ruby
mit
96
main
5,941
# frozen_string_literal: true # typed: true require_relative 'builders/object_builder' require_relative 'schema_definition' module EasyTalk # Shared foundation for both EasyTalk::Schema and EasyTalk::Model. # # This module extracts the common instance and class methods so that # Schema (lightweight, no valida...
github
sergiobayona/easy_talk
https://github.com/sergiobayona/easy_talk
lib/easy_talk/keywords.rb
Ruby
mit
96
main
588
# frozen_string_literal: true module EasyTalk KEYWORDS = %i[ schema_id schema_version description type title required items additional_items pattern_properties additional_properties dependencies dependent_required format content_media_type content_encoding ...
github
sergiobayona/easy_talk
https://github.com/sergiobayona/easy_talk
lib/easy_talk/model.rb
Ruby
mit
96
main
7,018
# frozen_string_literal: true # typed: true require 'json' require 'active_support' require 'active_support/core_ext' require 'active_support/time' require 'active_support/concern' require 'active_support/json' require 'active_model' require_relative 'schema_base' require_relative 'validation_builder' require_relative...
github
sergiobayona/easy_talk
https://github.com/sergiobayona/easy_talk
lib/easy_talk/error_formatter.rb
Ruby
mit
96
main
5,845
# frozen_string_literal: true require_relative 'error_formatter/error_code_mapper' require_relative 'error_formatter/path_converter' require_relative 'error_formatter/base' require_relative 'error_formatter/flat' require_relative 'error_formatter/json_pointer' require_relative 'error_formatter/rfc7807' require_relativ...
github
sergiobayona/easy_talk
https://github.com/sergiobayona/easy_talk
lib/easy_talk/model_helper.rb
Ruby
mit
96
main
393
# frozen_string_literal: true # typed: true module EasyTalk module ModelHelper extend T::Sig sig { params(type: T.untyped).returns(T::Boolean) } def self.easytalk_model?(type) type.is_a?(Class) && type.respond_to?(:schema) && type.respond_to?(:ref_template) && defined?(Easy...
github
sergiobayona/easy_talk
https://github.com/sergiobayona/easy_talk
lib/easy_talk/schema_methods.rb
Ruby
mit
96
main
3,726
# frozen_string_literal: true # typed: true module EasyTalk # Shared methods for JSON Schema generation. # # This module provides common functionality for building JSON schemas, # including $schema and $id resolution. It is included in both # EasyTalk::Model and EasyTalk::Schema to avoid code duplication. ...
github
sergiobayona/easy_talk
https://github.com/sergiobayona/easy_talk
lib/easy_talk/property.rb
Ruby
mit
96
main
7,860
# frozen_string_literal: true # typed: true require 'json' require_relative 'builders/integer_builder' require_relative 'builders/number_builder' require_relative 'builders/boolean_builder' require_relative 'builders/null_builder' require_relative 'builders/string_builder' require_relative 'builders/temporal_builder' ...
github
sergiobayona/easy_talk
https://github.com/sergiobayona/easy_talk
lib/easy_talk/schema_definition.rb
Ruby
mit
96
main
4,868
# frozen_string_literal: true # typed: true require_relative 'keywords' require_relative 'types/composer' require_relative 'validation_builder' module EasyTalk # #= EasyTalk \SchemaDefinition # SchemaDefinition provides the methods for defining a schema within the define_schema block. # The @schema is a hash ...
github
sergiobayona/easy_talk
https://github.com/sergiobayona/easy_talk
lib/easy_talk/schema.rb
Ruby
mit
96
main
2,797
# frozen_string_literal: true # typed: true require 'json' require 'active_support' require 'active_support/core_ext' require 'active_support/time' require 'active_support/concern' require 'active_support/json' require_relative 'schema_base' module EasyTalk # A lightweight module for schema generation without Activ...
github
sergiobayona/easy_talk
https://github.com/sergiobayona/easy_talk
lib/easy_talk/json_schema_equality.rb
Ruby
mit
96
main
1,812
# frozen_string_literal: true module EasyTalk # Implements JSON Schema equality semantics for comparing values. # # Per JSON Schema specification: # - Objects with same keys/values in different order are equal # - Numbers that are mathematically equal are equal (1 == 1.0) # - Type matters for non-numbers (...
github
sergiobayona/easy_talk
https://github.com/sergiobayona/easy_talk
lib/easy_talk/validation_builder.rb
Ruby
mit
96
main
1,783
# frozen_string_literal: true # typed: true module EasyTalk # @deprecated Use EasyTalk::ValidationAdapters::ActiveModelAdapter instead. # # The ValidationBuilder class is kept for backward compatibility. # It delegates to the ActiveModelAdapter and shows a deprecation warning. # # This class will be remove...
github
sergiobayona/easy_talk
https://github.com/sergiobayona/easy_talk
lib/easy_talk/naming_strategies.rb
Ruby
mit
96
main
873
# frozen_string_literal: true # typed: true module EasyTalk module NamingStrategies extend T::Sig IDENTITY = lambda(&:to_sym) SNAKE_CASE = ->(property_name) { property_name.to_s.underscore.to_sym } CAMEL_CASE = ->(property_name) { property_name.to_s.tr('-', '_').camelize(:lower).to_sym } PASCAL_...
github
sergiobayona/easy_talk
https://github.com/sergiobayona/easy_talk
lib/easy_talk/sorbet_extension.rb
Ruby
mit
96
main
457
# frozen_string_literal: true # typed: true # This module provides additional functionality for working with Sorbet types. module SorbetExtension # Checks if the types in the collection include the NilClass type. # # @return [Boolean] true if the types include NilClass, false otherwise. def nilable? types....
github
sergiobayona/easy_talk
https://github.com/sergiobayona/easy_talk
lib/easy_talk/errors_helper.rb
Ruby
mit
96
main
6,439
# frozen_string_literal: true # typed: true module EasyTalk # Helper module for generating consistent error messages module ErrorHelper extend T::Sig def self.raise_constraint_error(property_name:, constraint_name:, expected:, got:) message = "Error in property '#{property_name}': Constraint '#{cons...
github
sergiobayona/easy_talk
https://github.com/sergiobayona/easy_talk
lib/easy_talk/ref_helper.rb
Ruby
mit
96
main
1,109
# frozen_string_literal: true # typed: true require_relative 'model_helper' module EasyTalk module RefHelper extend T::Sig sig { params(type: T.untyped, constraints: T::Hash[Symbol, T.untyped]).returns(T::Boolean) } def self.should_use_ref?(type, constraints) ModelHelper.easytalk_model?(type) && ...
github
sergiobayona/easy_talk
https://github.com/sergiobayona/easy_talk
lib/easy_talk/type_introspection.rb
Ruby
mit
96
main
8,425
# frozen_string_literal: true # typed: true require 'bigdecimal' module EasyTalk # Centralized module for robust type introspection. # # This module provides predicate methods for detecting types without relying # on brittle string-based checks. It uses Sorbet's type system properly and # handles edge cases...
github
sergiobayona/easy_talk
https://github.com/sergiobayona/easy_talk
lib/easy_talk/configuration.rb
Ruby
mit
96
main
3,078
# frozen_string_literal: true # typed: true require_relative 'naming_strategies' module EasyTalk class Configuration extend T::Sig # JSON Schema draft version URIs SCHEMA_VERSIONS = { draft202012: 'https://json-schema.org/draft/2020-12/schema', draft201909: 'https://json-schema.org/draft/20...
github
sergiobayona/easy_talk
https://github.com/sergiobayona/easy_talk
lib/easy_talk/errors.rb
Ruby
mit
96
main
307
# frozen_string_literal: true # typed: true module EasyTalk class Error < StandardError; end class ConstraintError < Error; end class UnknownOptionError < Error; end class UnknownTypeError < Error; end class InvalidInstructionsError < Error; end class InvalidPropertyNameError < Error; end end
github
sergiobayona/easy_talk
https://github.com/sergiobayona/easy_talk
lib/easy_talk/builders/typed_array_builder.rb
Ruby
mit
96
main
2,277
# frozen_string_literal: true # typed: true require_relative 'collection_helpers' module EasyTalk module Builders # Builder class for homogeneous array properties (T::Array[Type]). class TypedArrayBuilder < BaseBuilder extend CollectionHelpers extend T::Sig VALID_OPTIONS = { min_i...
github
sergiobayona/easy_talk
https://github.com/sergiobayona/easy_talk
lib/easy_talk/builders/base_builder.rb
Ruby
mit
96
main
2,441
# frozen_string_literal: true # typed: true module EasyTalk module Builders # BaseBuilder is a class that provides a common structure for building schema properties class BaseBuilder extend T::Sig # BaseBuilder is a class that provides a common structure for building objects # representing...
github
sergiobayona/easy_talk
https://github.com/sergiobayona/easy_talk
lib/easy_talk/builders/boolean_builder.rb
Ruby
mit
96
main
662
# frozen_string_literal: true # typed: true require_relative 'base_builder' module EasyTalk module Builders # Builder class for boolean properties. class BooleanBuilder < BaseBuilder extend T::Sig # VALID_OPTIONS defines the valid options for a boolean property. VALID_OPTIONS = { ...
github
sergiobayona/easy_talk
https://github.com/sergiobayona/easy_talk
lib/easy_talk/builders/composition_builder.rb
Ruby
mit
96
main
2,838
# frozen_string_literal: true # typed: true require_relative 'collection_helpers' require_relative '../ref_helper' module EasyTalk module Builders # This class represents a builder for composing JSON schemas using the "allOf", "anyOf", or "oneOf" keywords. class CompositionBuilder extend CollectionHel...
github
sergiobayona/easy_talk
https://github.com/sergiobayona/easy_talk
lib/easy_talk/builders/number_builder.rb
Ruby
mit
96
main
1,103
# frozen_string_literal: true # typed: true require_relative 'base_builder' module EasyTalk module Builders # Builder class for number properties. class NumberBuilder < BaseBuilder extend T::Sig VALID_OPTIONS = { multiple_of: { type: T.any(Integer, Float), key: :multipleOf }, mi...
github
sergiobayona/easy_talk
https://github.com/sergiobayona/easy_talk
lib/easy_talk/builders/tuple_builder.rb
Ruby
mit
96
main
2,960
# frozen_string_literal: true # typed: true module EasyTalk module Builders # Builder class for tuple array properties (T::Tuple[Type1, Type2, ...]). # # Tuples are arrays with positional type validation where each index # has a specific expected type. # # @example Basic tuple # propert...
github
sergiobayona/easy_talk
https://github.com/sergiobayona/easy_talk
lib/easy_talk/builders/string_builder.rb
Ruby
mit
96
main
1,198
# frozen_string_literal: true # typed: true require_relative 'base_builder' require 'js_regex' # Compile the ruby regex to JS regex require 'sorbet-runtime' # Add the import statement for the T module module EasyTalk module Builders # Builder class for string properties. class StringBuilder < BaseBuilder ...
github
sergiobayona/easy_talk
https://github.com/sergiobayona/easy_talk
lib/easy_talk/builders/integer_builder.rb
Ruby
mit
96
main
995
# frozen_string_literal: true # typed: true require_relative 'base_builder' module EasyTalk module Builders # Builder class for integer properties. class IntegerBuilder < BaseBuilder extend T::Sig VALID_OPTIONS = { minimum: { type: Integer, key: :minimum }, maximum: { type: Inte...
github
sergiobayona/easy_talk
https://github.com/sergiobayona/easy_talk
lib/easy_talk/builders/union_builder.rb
Ruby
mit
96
main
1,062
# frozen_string_literal: true # typed: true require_relative 'collection_helpers' module EasyTalk module Builders # Base builder class for array-type properties. class UnionBuilder extend CollectionHelpers extend T::Sig VALID_OPTIONS = %i[title description optional as validate].freeze ...
github
sergiobayona/easy_talk
https://github.com/sergiobayona/easy_talk
lib/easy_talk/builders/object_builder.rb
Ruby
mit
96
main
12,688
# frozen_string_literal: true # typed: true require_relative 'base_builder' require_relative '../model_helper' module EasyTalk module Builders # # ObjectBuilder is responsible for turning a SchemaDefinition of an "object" type # into a validated JSON Schema hash. It: # # 1) Recursively processes...
github
sergiobayona/easy_talk
https://github.com/sergiobayona/easy_talk
lib/easy_talk/builders/registry.rb
Ruby
mit
96
main
7,359
# frozen_string_literal: true # typed: true module EasyTalk module Builders # Registry for type-to-builder mappings. # # The registry allows custom types to be registered with their corresponding # schema builder classes at runtime, without modifying the gem's source code. # # Custom registra...
github
sergiobayona/easy_talk
https://github.com/sergiobayona/easy_talk
lib/easy_talk/builders/null_builder.rb
Ruby
mit
96
main
524
# frozen_string_literal: true # typed: true require_relative 'base_builder' module EasyTalk module Builders # builder class for Null properties. class NullBuilder < BaseBuilder extend T::Sig VALID_OPTIONS = {}.freeze # Initializes a new instance of the NullBuilder class. sig { para...
github
sergiobayona/easy_talk
https://github.com/sergiobayona/easy_talk
lib/easy_talk/builders/collection_helpers.rb
Ruby
mit
96
main
283
# frozen_string_literal: true # typed: true module EasyTalk module Builders # Base builder class for array-type properties. module CollectionHelpers extend T::Sig sig { returns(T::Boolean) } def collection_type? true end end end end
github
sergiobayona/easy_talk
https://github.com/sergiobayona/easy_talk
lib/easy_talk/builders/temporal_builder.rb
Ruby
mit
96
main
1,955
# frozen_string_literal: true # typed: true require_relative 'string_builder' module EasyTalk module Builders # Builder class for temporal properties (date, datetime, time). class TemporalBuilder < StringBuilder extend T::Sig # Initializes a new instance of the TemporalBuilder class. # ...
github
sergiobayona/easy_talk
https://github.com/sergiobayona/easy_talk
lib/easy_talk/extensions/ruby_llm_compatibility.rb
Ruby
mit
96
main
1,887
# frozen_string_literal: true module EasyTalk module Extensions # Class methods for RubyLLM compatibility. # These are added to the model class via `extend`. module RubyLLMCompatibility # Returns a Hash representing the schema in a format compatible with RubyLLM. # RubyLLM expects an object t...
github
sergiobayona/easy_talk
https://github.com/sergiobayona/easy_talk
lib/easy_talk/error_formatter/rfc7807.rb
Ruby
mit
96
main
2,187
# frozen_string_literal: true module EasyTalk module ErrorFormatter # Formats validation errors according to RFC 7807 (Problem Details for HTTP APIs). # # RFC 7807 defines a standard format for describing errors in HTTP APIs. # This formatter produces a Problem Details object with validation errors ...
github
sergiobayona/easy_talk
https://github.com/sergiobayona/easy_talk
lib/easy_talk/error_formatter/base.rb
Ruby
mit
96
main
3,206
# frozen_string_literal: true module EasyTalk module ErrorFormatter # Abstract base class for error formatters. # # Provides common functionality for transforming ActiveModel::Errors # into standardized formats. Subclasses implement the `format` method # to produce specific output formats. # ...
github
sergiobayona/easy_talk
https://github.com/sergiobayona/easy_talk
lib/easy_talk/error_formatter/error_code_mapper.rb
Ruby
mit
96
main
2,526
# frozen_string_literal: true module EasyTalk module ErrorFormatter # Maps ActiveModel validation error types to semantic error codes. # # ActiveModel's `errors.details` provides the validation type (e.g., :blank, :too_short). # This class maps those types to standardized semantic codes for API respo...
github
sergiobayona/easy_talk
https://github.com/sergiobayona/easy_talk
lib/easy_talk/error_formatter/path_converter.rb
Ruby
mit
96
main
1,931
# frozen_string_literal: true module EasyTalk module ErrorFormatter # Converts attribute paths between different formats. # # EasyTalk uses dot notation for nested model errors (e.g., "email.address"). # This class converts those paths to different standard formats: # - JSON Pointer (RFC 6901): /...
github
sergiobayona/easy_talk
https://github.com/sergiobayona/easy_talk
lib/easy_talk/error_formatter/json_pointer.rb
Ruby
mit
96
main
1,142
# frozen_string_literal: true module EasyTalk module ErrorFormatter # Formats validation errors using JSON Pointer (RFC 6901) paths. # # Converts attribute paths to JSON Pointer format pointing to the # property location in the JSON Schema. # # @example Output # [ # { "pointer" ...
github
sergiobayona/easy_talk
https://github.com/sergiobayona/easy_talk
lib/easy_talk/error_formatter/jsonapi.rb
Ruby
mit
96
main
1,773
# frozen_string_literal: true module EasyTalk module ErrorFormatter # Formats validation errors according to the JSON:API specification. # # JSON:API defines a standard error format with specific fields for # status, source, title, detail, and optional code. # # @see https://jsonapi.org/forma...
github
sergiobayona/easy_talk
https://github.com/sergiobayona/easy_talk
lib/easy_talk/error_formatter/flat.rb
Ruby
mit
96
main
1,048
# frozen_string_literal: true module EasyTalk module ErrorFormatter # Formats validation errors as a simple flat array. # # This is the simplest format, providing an array of error objects # with field name, message, and optional error code. # # @example Output # [ # { "field" =...
github
sergiobayona/easy_talk
https://github.com/sergiobayona/easy_talk
lib/easy_talk/types/tuple.rb
Ruby
mit
96
main
2,460
# frozen_string_literal: true module EasyTalk module Types # Represents a tuple type for arrays with positional type validation. # # A tuple is an array where each position has a specific type. This class # stores the types for each position. # # @example Basic tuple # T::Tuple[String, ...
github
sergiobayona/easy_talk
https://github.com/sergiobayona/easy_talk
lib/easy_talk/types/composer.rb
Ruby
mit
96
main
2,416
# frozen_string_literal: true require_relative 'base_composer' module EasyTalk module Types # Base class for composition types class Composer < BaseComposer # Returns the name of the composition type. def self.name raise NotImplementedError, "#{self.class.name} must implement the name me...
github
sergiobayona/easy_talk
https://github.com/sergiobayona/easy_talk
lib/easy_talk/types/base_composer.rb
Ruby
mit
96
main
499
# frozen_string_literal: true module EasyTalk module Types # no-doc class BaseComposer < T::Types::Base extend T::Sig extend T::Generic Elem = type_member sig { returns(T::Array[Elem]) } attr_reader :items # Initializes a new instance of the BaseComposer class. # ...
github
sergiobayona/easy_talk
https://github.com/sergiobayona/easy_talk
lib/easy_talk/tools/function_builder.rb
Ruby
mit
96
main
1,307
# frozen_string_literal: true module EasyTalk module Tools # FunctionBuilder is a module that builds a hash with the function type and function details. # The return value is typically passed as argument to LLM function calling APIs. module FunctionBuilder class << self # Creates a new func...
github
sergiobayona/easy_talk
https://github.com/sergiobayona/easy_talk
lib/easy_talk/validation_adapters/active_model_adapter.rb
Ruby
mit
96
main
22,901
# frozen_string_literal: true require 'uri' require_relative 'active_model_schema_validation' require 'easy_talk/json_schema_equality' module EasyTalk module ValidationAdapters # ActiveModel validation adapter. # # This is the default adapter that converts JSON Schema constraints into # ActiveModel ...
github
sergiobayona/easy_talk
https://github.com/sergiobayona/easy_talk
lib/easy_talk/validation_adapters/registry.rb
Ruby
mit
96
main
3,206
# frozen_string_literal: true module EasyTalk module ValidationAdapters # Registry for validation adapters. # # The registry allows adapters to be registered with symbolic names and # resolved from various input types (symbols, classes, or nil for default). # # @example Registering an adapter...
github
sergiobayona/easy_talk
https://github.com/sergiobayona/easy_talk
lib/easy_talk/validation_adapters/none_adapter.rb
Ruby
mit
96
main
1,258
# frozen_string_literal: true module EasyTalk module ValidationAdapters # No-op validation adapter. # # This adapter does not apply any validations. Use it when you want # schema generation without any validation side effects. # # @example Disabling validations for a model # class ApiCo...
github
sergiobayona/easy_talk
https://github.com/sergiobayona/easy_talk
lib/easy_talk/validation_adapters/base.rb
Ruby
mit
96
main
5,118
# frozen_string_literal: true module EasyTalk module ValidationAdapters # Abstract base class for validation adapters. # # Validation adapters are responsible for converting JSON Schema constraints # into validation rules for the target validation framework (e.g., ActiveModel, # dry-validation, o...
github
sergiobayona/easy_talk
https://github.com/sergiobayona/easy_talk
lib/easy_talk/validation_adapters/active_model_schema_validation.rb
Ruby
mit
96
main
4,534
# frozen_string_literal: true module EasyTalk module ValidationAdapters # ActiveModel-specific schema-level validations for object-level constraints. # # This module provides ActiveModel validations for JSON Schema keywords that apply # to the object as a whole rather than individual properties: ...
github
s1lvax/whoami
https://github.com/s1lvax/whoami
Gemfile
Ruby
mit
96
main
2,567
source "https://rubygems.org" # Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main" gem "rails", "~> 8.0.2", ">= 8.0.2.1" # The modern asset pipeline for Rails [https://github.com/rails/propshaft] gem "propshaft" # Use sqlite3 as the database for Active Record gem "sqlite3", ">= 2.1" # Use th...
github
s1lvax/whoami
https://github.com/s1lvax/whoami
test/test_helper.rb
Ruby
mit
96
main
412
ENV["RAILS_ENV"] ||= "test" require_relative "../config/environment" require "rails/test_help" module ActiveSupport class TestCase # Run tests in parallel with specified workers parallelize(workers: :number_of_processors) # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order. ...
github
s1lvax/whoami
https://github.com/s1lvax/whoami
test/integration/registration_test.rb
Ruby
mit
96
main
474
require "test_helper" class RegistrationsTest < ActionDispatch::IntegrationTest test "signs up and redirects to confirmation_sent_path if using confirmable" do assert_difference "User.count", 1 do post user_registration_path, params: { user: { email: "newuser@example.com", passw...
github
s1lvax/whoami
https://github.com/s1lvax/whoami
test/jobs/newsletter_broadcast_job_test.rb
Ruby
mit
96
main
1,460
require "test_helper" class NewsletterBroadcastJobTest < ActiveJob::TestCase fixtures :users include ActiveJob::TestHelper include ActionMailer::TestHelper def setup @user = users(:one) @post = Post.create!( user: @user, title: "Published Post", status: "published", send_to_new...
github
s1lvax/whoami
https://github.com/s1lvax/whoami
test/controllers/onboardings_controller_test.rb
Ruby
mit
96
main
1,994
require "test_helper" class OnboardingsControllerTest < ActionDispatch::IntegrationTest include Devise::Test::IntegrationHelpers fixtures :users setup do @user = users(:two) # bob (not onboarded) sign_in @user end test "should show name step if not onboarded" do get onboarding_path(step: "name"...
github
s1lvax/whoami
https://github.com/s1lvax/whoami
test/controllers/confirmations_controller_test.rb
Ruby
mit
96
main
1,434
require "test_helper" class ConfirmationsControllerTest < ActionDispatch::IntegrationTest fixtures :users test "confirms user and redirects to onboarding if not onboarded" do user = users(:two) # not onboarded raw, enc = Devise.token_generator.generate(User, :confirmation_token) user.update!( c...
github
s1lvax/whoami
https://github.com/s1lvax/whoami
test/controllers/profiles_controller_test.rb
Ruby
mit
96
main
755
require "test_helper" class ProfilesControllerTest < ActionDispatch::IntegrationTest fixtures :users, :favorite_links, :experiences, :posts test "renders profile page for onboarded user" do user = users(:one) # makaroni get public_profile_path(user.username) assert_response :success assert_match ...
github
s1lvax/whoami
https://github.com/s1lvax/whoami
test/controllers/pages_controller_test.rb
Ruby
mit
96
main
350
require "test_helper" class PagesControllerTest < ActionDispatch::IntegrationTest test "renders index" do get root_path assert_response :success end test "renders privacy policy" do get privacy_path assert_response :success end test "renders terms of service" do get terms_path asser...
github
s1lvax/whoami
https://github.com/s1lvax/whoami
test/controllers/public_posts_controller_test.rb
Ruby
mit
96
main
1,462
require "test_helper" class PublicPostsControllerTest < ActionDispatch::IntegrationTest fixtures :users, :posts def setup @user = users(:one) @post = posts(:one) @post.update!( user: @user, status: "published", published_at: Time.current, slug: "my-first-post" ) end te...
github
s1lvax/whoami
https://github.com/s1lvax/whoami
test/controllers/public_links_controller_test.rb
Ruby
mit
96
main
987
require "test_helper" class PublicLinksControllerTest < ActionDispatch::IntegrationTest fixtures :users, :favorite_links def setup @user = users(:one) @link = favorite_links(:one) end test "redirects to valid external URL and tracks the click" do @link.update!(url: "http://example.com") # ✅ valid...
github
s1lvax/whoami
https://github.com/s1lvax/whoami
test/controllers/dashboard_controller_test.rb
Ruby
mit
96
main
2,203
require "test_helper" class DashboardControllerTest < ActionDispatch::IntegrationTest include Devise::Test::IntegrationHelpers fixtures :users, :favorite_links, :experiences, :posts setup do @user = users(:one) # makaroni, onboarded sign_in @user end test "redirects unauthenticated user" do sig...
github
s1lvax/whoami
https://github.com/s1lvax/whoami
test/controllers/subscription_controller_test.rb
Ruby
mit
96
main
2,340
require "test_helper" class SubscriptionControllerTest < ActionDispatch::IntegrationTest fixtures :users setup do @user = users(:one) end test "should create subscription and send confirmation email" do assert_enqueued_emails 1 do post new_subscription_path(username: @user.username), params: { ...
github
s1lvax/whoami
https://github.com/s1lvax/whoami
test/controllers/dashboard/experiences_controller_test.rb
Ruby
mit
96
main
4,001
require "test_helper" class Dashboard::ExperiencesControllerTest < ActionDispatch::IntegrationTest include Devise::Test::IntegrationHelpers fixtures :users, :experiences setup do @user = users(:one) sign_in @user end test "should get new via turbo_frame_request" do get new_dashboard_experience_...
github
s1lvax/whoami
https://github.com/s1lvax/whoami
test/controllers/dashboard/favorite_links_controller_test.rb
Ruby
mit
96
main
2,566
require "test_helper" class Dashboard::FavoriteLinksControllerTest < ActionDispatch::IntegrationTest include Devise::Test::IntegrationHelpers fixtures :users, :favorite_links setup do @user = users(:one) sign_in @user end test "should get new via turbo_frame_request" do get new_dashboard_favori...
github
s1lvax/whoami
https://github.com/s1lvax/whoami
test/models/favorite_link_test.rb
Ruby
mit
96
main
2,198
require "test_helper" class FavoriteLinkTest < ActiveSupport::TestCase fixtures :users def setup @user = users(:one) end def build_link(attrs = {}) defaults = { user: @user, label: "Example", url: "https://example.com" } FavoriteLink.new(defaults.merge(attrs)) end # ...
github
s1lvax/whoami
https://github.com/s1lvax/whoami
test/models/experience_test.rb
Ruby
mit
96
main
2,563
require "test_helper" class ExperienceTest < ActiveSupport::TestCase fixtures :users def setup @user = users(:one) end def build_experience(attrs = {}) Experience.new({ user: @user, company: "Acme Corp", role: "Developer", start_date: Date.new(2020, 1, 1), end_date: Date...
github
s1lvax/whoami
https://github.com/s1lvax/whoami
test/models/post_test.rb
Ruby
mit
96
main
6,941
require "test_helper" class PostTest < ActiveSupport::TestCase include ActiveJob::TestHelper fixtures :users def setup @user = users(:one) end def build_post(attrs = {}) Post.new({ user: @user, title: "Hello World", status: "draft", excerpt: "Sample excerpt" }.merge(attr...
github
s1lvax/whoami
https://github.com/s1lvax/whoami
test/models/subscription_test.rb
Ruby
mit
96
main
1,706
require "test_helper" class SubscriptionTest < ActiveSupport::TestCase fixtures :users def setup @user = users(:one) @other_user = users(:two) end test "is valid with a subscriber_email and user" do subscription = @user.subscriptions.new(subscriber_email: "test@example.com") assert subs...
github
s1lvax/whoami
https://github.com/s1lvax/whoami
test/models/user_test.rb
Ruby
mit
96
main
5,281
require "test_helper" class UserTest < ActiveSupport::TestCase fixtures :users def build_user(attrs = {}) defaults = { email: "person#{SecureRandom.hex(3)}@example.com", password: "Password!123", password_confirmation: "Password!123", username: "user#{SecureRandom.hex(2)}", name:...
github
s1lvax/whoami
https://github.com/s1lvax/whoami
test/components/hero_component_test.rb
Ruby
mit
96
main
3,421
require "test_helper" class HeroComponentTest < ViewComponent::TestCase test "renders the hero section with proper structure" do html = render_inline(HeroComponent.new).to_html # Check for main section wrapper assert_includes html, '<section class="py-24 text-center">' # Check for container div ...
github
s1lvax/whoami
https://github.com/s1lvax/whoami
test/components/footer_component_test.rb
Ruby
mit
96
main
4,559
require "test_helper" class FooterComponentTest < ViewComponent::TestCase test "renders the footer with proper structure and styling" do html = render_inline(FooterComponent.new).to_html # Check for main footer wrapper assert_includes html, '<footer class="mt-24 border-t border-[var(--border)] bg-[var(-...
github
s1lvax/whoami
https://github.com/s1lvax/whoami
test/components/features_component_test.rb
Ruby
mit
96
main
6,763
require "test_helper" require "nokogiri" require "cgi" class FeaturesComponentTest < ViewComponent::TestCase # --- helpers -------------------------------------------------------------- def render_html render_inline(FeaturesComponent.new).to_html end def doc(html) Nokogiri::HTML.fragment(html) end ...
github
s1lvax/whoami
https://github.com/s1lvax/whoami
test/components/input_component_test.rb
Ruby
mit
96
main
2,323
require "test_helper" class InputComponentTest < ViewComponent::TestCase def render_with_form(object, **kwargs) # Create a mock form builder that we can use in tests form_builder = ActionView::Helpers::FormBuilder.new( object.model_name.param_key, object, vc_test_controller.view_context, ...
github
s1lvax/whoami
https://github.com/s1lvax/whoami
test/components/button_component_test.rb
Ruby
mit
96
main
1,904
# frozen_string_literal: true require "test_helper" require "nokogiri" class ButtonComponentTest < ViewComponent::TestCase test "renders with default options" do html = render_inline(ButtonComponent.new) { "Submit" }.to_html fragment = Nokogiri::HTML.fragment(html) button = fragment.at_css("button") ...
github
s1lvax/whoami
https://github.com/s1lvax/whoami
test/components/cta_component_test.rb
Ruby
mit
96
main
1,450
# frozen_string_literal: true require "test_helper" require "nokogiri" class CtaComponentTest < ViewComponent::TestCase # Make sure path helpers (Devise) are available include Rails.application.routes.url_helpers test "renders headline, copy, and CTA link" do html = render_inline(CtaComponent.new).to_html ...
github
s1lvax/whoami
https://github.com/s1lvax/whoami
test/components/flash_component_test.rb
Ruby
mit
96
main
5,855
require "test_helper" class FlashComponentTest < ViewComponent::TestCase test "renders notice message when notice is present" do html = render_inline(FlashComponent.new(notice: "Successfully saved!", alert: nil)).to_html # Check for notice container assert_includes html, 'class="w-full fixed top-0 left-...
github
s1lvax/whoami
https://github.com/s1lvax/whoami
test/components/public_profile/latest_section_component_test.rb
Ruby
mit
96
main
4,027
# frozen_string_literal: true require "test_helper" require "nokogiri" class PublicProfile::LatestPostsSectionComponentTest < ViewComponent::TestCase UserStub = Struct.new(:username) class PostStub attr_reader :title, :excerpt, :views, :published_at, :updated_at, :user def initialize(title:, excerpt:, vi...
github
s1lvax/whoami
https://github.com/s1lvax/whoami
test/components/public_profile/newsletter_subscription_component_test.rb
Ruby
mit
96
main
1,003
require "test_helper" class PublicProfile::NewsletterSubscriptionComponentTest < ViewComponent::TestCase include Rails.application.routes.url_helpers fixtures :users def setup @user = users(:one) end test "renders subscription form for a user" do render_inline(PublicProfile::NewsletterSubscriptionC...
github
s1lvax/whoami
https://github.com/s1lvax/whoami
test/components/public_profile/experience_section_component_test.rb
Ruby
mit
96
main
5,788
# frozen_string_literal: true require "test_helper" require "nokogiri" class PublicProfile::ExperienceSectionComponentTest < ViewComponent::TestCase # Helpers ----------------------------------------------------------------- # def squish(str) str.to_s.gsub(/\s+/, " ").strip end def render_html(experien...
github
s1lvax/whoami
https://github.com/s1lvax/whoami
test/components/public_profile/more_posts_component_test.rb
Ruby
mit
96
main
3,745
# frozen_string_literal: true require "test_helper" require "nokogiri" class PublicProfile::MorePostsComponentTest < ViewComponent::TestCase UserStub = Struct.new(:username) class PostStub attr_reader :title, :excerpt, :views, :published_at, :updated_at, :user def initialize(title:, excerpt:, views:, pub...
github
s1lvax/whoami
https://github.com/s1lvax/whoami
test/components/public_profile/links_section_component_test.rb
Ruby
mit
96
main
3,365
# frozen_string_literal: true require "test_helper" require "nokogiri" class PublicProfile::LinksSectionComponentTest < ViewComponent::TestCase # Provide a minimal helper so the component's `helpers.normalized_url` call works in tests module TestNormalizedUrlHelper def normalized_url(url) = url # pass-through...
github
s1lvax/whoami
https://github.com/s1lvax/whoami
test/components/public_profile/header_component_test.rb
Ruby
mit
96
main
3,401
# frozen_string_literal: true require "test_helper" require "nokogiri" class PublicProfile::HeaderComponentTest < ViewComponent::TestCase # A user with NO #handle method (so component falls back to username/email) FakeUser = Struct.new(:full_name, :email, :username, :bio, :avatar) # A user WITH #handle method ...
github
s1lvax/whoami
https://github.com/s1lvax/whoami
test/components/onboarding/step_avatar_component_test.rb
Ruby
mit
96
main
4,110
# frozen_string_literal: true require "test_helper" require "nokogiri" class Onboarding::StepAvatarComponentTest < ViewComponent::TestCase fixtures :users # Minimal helper so onboarding_path works without real routes module TestOnboardingPathHelper def onboarding_path(step:) "/onboarding?step=#{step}...
github
s1lvax/whoami
https://github.com/s1lvax/whoami
test/components/onboarding/step_bio_component_test.rb
Ruby
mit
96
main
2,744
# frozen_string_literal: true require "test_helper" require "nokogiri" class Onboarding::StepBioComponentTest < ViewComponent::TestCase fixtures :users # Minimal helper so the template's onboarding_path works without real routes module TestOnboardingPathHelper def onboarding_path(step:) "/onboarding?...
github
s1lvax/whoami
https://github.com/s1lvax/whoami
test/components/onboarding/username_status_component_test.rb
Ruby
mit
96
main
2,040
# frozen_string_literal: true require "test_helper" require "nokogiri" class Onboarding::UsernameStatusComponentTest < ViewComponent::TestCase def frag_for(status:) html = render_inline(Onboarding::UsernameStatusComponent.new(status: status)).to_html Nokogiri::HTML.fragment(html) end test "renders defa...
github
s1lvax/whoami
https://github.com/s1lvax/whoami
test/components/onboarding/step_links_component_test.rb
Ruby
mit
96
main
4,984
# frozen_string_literal: true require "test_helper" require "nokogiri" class Onboarding::StepLinksComponentTest < ViewComponent::TestCase fixtures :users # Minimal URL helper so the template's onboarding_path works without real routes module TestOnboardingPathHelper def onboarding_path(step:) "/onboa...
github
s1lvax/whoami
https://github.com/s1lvax/whoami
test/components/onboarding/step_username_component_test.rb
Ruby
mit
96
main
3,066
# frozen_string_literal: true require "test_helper" require "nokogiri" class Onboarding::StepUsernameComponentTest < ViewComponent::TestCase fixtures :users # Provide a minimal URL helper used by the template module TestOnboardingPathHelper def onboarding_path(step:) "/onboarding?step=#{step}" en...
github
s1lvax/whoami
https://github.com/s1lvax/whoami
test/components/onboarding/step_name_component_test.rb
Ruby
mit
96
main
3,112
# frozen_string_literal: true require "test_helper" require "nokogiri" class Onboarding::StepNameComponentTest < ViewComponent::TestCase fixtures :users # Minimal helper so the template's onboarding_path works without routes module TestOnboardingPathHelper def onboarding_path(step:) "/onboarding?step...
github
s1lvax/whoami
https://github.com/s1lvax/whoami
test/components/dashboard/experience_card_component_test.rb
Ruby
mit
96
main
1,573
require "test_helper" class Dashboard::ExperienceCardComponentTest < ViewComponent::TestCase def setup @experience = Experience.new( id: 42, company: "ACME Inc.", role: "Engineer", location: "Luxembourg", start_date: Date.new(2021, 1, 1), end_date: Date.new(2023, 1, 1), ...
github
s1lvax/whoami
https://github.com/s1lvax/whoami
test/components/dashboard/link_card_component_test.rb
Ruby
mit
96
main
2,105
require "test_helper" class Dashboard::LinkCardComponentTest < ViewComponent::TestCase # Fake model with minimum for dom_id + routing class FakeLink include ActiveModel::Model include ActiveModel::Conversion extend ActiveModel::Naming attr_accessor :id, :label, :url, :clicks def persisted? = ...
github
s1lvax/whoami
https://github.com/s1lvax/whoami
test/components/dashboard/post_show_component_test.rb
Ruby
mit
96
main
3,588
# frozen_string_literal: true require "test_helper" class Dashboard::PostShowComponentTest < ViewComponent::TestCase fixtures :users def build_post(attrs = {}) user = users(:one) defaults = { user: user, title: "Test Post", status: "published", excerpt: "Excerpt here", body:...
github
s1lvax/whoami
https://github.com/s1lvax/whoami
test/components/dashboard/profile_header_component_test.rb
Ruby
mit
96
main
4,841
# frozen_string_literal: true require "test_helper" require "nokogiri" require "base64" class Dashboard::ProfileHeaderComponentTest < ViewComponent::TestCase fixtures :users # Minimal routes/helpers used by the component module TestRoutesHelper def destroy_user_session_path "/users/sign_out" end ...
github
s1lvax/whoami
https://github.com/s1lvax/whoami
test/components/dashboard/new_link_card_component_test.rb
Ruby
mit
96
main
1,513
# frozen_string_literal: true require "test_helper" require "nokogiri" class Dashboard::NewLinkCardComponentTest < ViewComponent::TestCase def render_fragment component = Dashboard::NewLinkCardComponent.new # Stub the private path helper so we don't need real routes in test component.define_singleton_m...
github
s1lvax/whoami
https://github.com/s1lvax/whoami
test/components/dashboard/activity_item_component_test.rb
Ruby
mit
96
main
600
require "test_helper" class Dashboard::ActivityItemComponentTest < ViewComponent::TestCase test "renders title and detail text" do render_inline(Dashboard::ActivityItemComponent.new( title: "User signed in", detail: "2025-09-14 14:03" )) assert_text "User signed in" assert_text "2025-09-...
github
s1lvax/whoami
https://github.com/s1lvax/whoami
test/components/dashboard/section_component_test.rb
Ruby
mit
96
main
2,187
# frozen_string_literal: true require "test_helper" require "nokogiri" class Dashboard::SectionComponentTest < ViewComponent::TestCase def fragment_for(**args, &blk) html = render_inline(Dashboard::SectionComponent.new(**args), &blk).to_html Nokogiri::HTML.fragment(html) end test "renders section with ...