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
lfender6445/theme_bandit
https://github.com/lfender6445/theme_bandit
lib/theme_bandit/util/configure.rb
Ruby
mit
96
master
765
module ThemeBandit class << self attr_accessor :configuration end def self.configure self.configuration ||= Config.new yield configuration configuration end class Config attr_accessor :data def initialize(data = {}) @data = {} update!(data) end def update!(data)...
github
lfender6445/theme_bandit
https://github.com/lfender6445/theme_bandit
lib/theme_bandit/util/log.rb
Ruby
mit
96
master
789
require 'logger' module ThemeBandit class Log < Logger class << self attr_accessor :message def colorize(text, color_code) $stdout.write "\e[#{color_code}m#{text}\e[0m\n" end def red(text) @message = text colorize(text, 31) logger.error text end ...
github
voxpupuli/puppet-ghostbuster
https://github.com/voxpupuli/puppet-ghostbuster
Rakefile
Ruby
apache-2.0
96
master
1,148
# frozen_string_literal: true require 'rspec/core/rake_task' RSpec::Core::RakeTask.new(:spec) task default: :spec begin require 'rubygems' require 'github_changelog_generator/task' rescue LoadError # github-changelog-generator is an optional group else GitHubChangelogGenerator::RakeTask.new :changelog do |c...
github
voxpupuli/puppet-ghostbuster
https://github.com/voxpupuli/puppet-ghostbuster
puppet-ghostbuster.gemspec
Ruby
apache-2.0
96
master
1,336
# frozen_string_literal: true $LOAD_PATH.unshift File.expand_path('lib', __dir__) require 'puppet-ghostbuster/version' Gem::Specification.new do |s| s.name = 'puppet-ghostbuster' s.version = PuppetGhostbuster::VERSION s.authors = ['Camptocamp', 'Vox Pupuli'] s.homepage = 'http://github.com/v...
github
voxpupuli/puppet-ghostbuster
https://github.com/voxpupuli/puppet-ghostbuster
Gemfile
Ruby
apache-2.0
96
master
374
# frozen_string_literal: true source ENV['GEM_SOURCE'] || 'https://rubygems.org' gemspec group :release, optional: true do gem 'faraday-retry', '~> 2.1', require: false gem 'github_changelog_generator', '~> 1.18', require: false end group :coverage, optional: ENV['COVERAGE'] != 'yes' do gem 'codecov', require...
github
voxpupuli/puppet-ghostbuster
https://github.com/voxpupuli/puppet-ghostbuster
spec/spec_helper.rb
Ruby
apache-2.0
96
master
1,658
require 'puppet-lint' require 'jgrep' PuppetLint::Plugins.load_spec_helper class PuppetDB::Client def puppetdb_to_jgrep(query) if %i[and or].include?(query[0]) "(#{puppetdb_to_jgrep(query[1])} #{query[0]} #{puppetdb_to_jgrep(query[2])})" else "#{[query[1]].flatten.join('.')}#{query[0]}#{query[2]...
github
voxpupuli/puppet-ghostbuster
https://github.com/voxpupuli/puppet-ghostbuster
spec/puppet-lint/plugins/ghostbuster_functions_spec.rb
Ruby
apache-2.0
96
master
1,287
# frozen_string_literal: true require 'spec_helper' describe 'ghostbuster_functions' do let(:code) { '' } context 'with fix disabled' do context 'when function is not used' do let(:path) { './spec/fixtures/modules/foo/lib/puppet/parser/functions/foo.rb' } it 'detects one problem' do expe...
github
voxpupuli/puppet-ghostbuster
https://github.com/voxpupuli/puppet-ghostbuster
spec/puppet-lint/plugins/ghostbuster_classes_spec.rb
Ruby
apache-2.0
96
master
637
# frozen_string_literal: true require 'spec_helper' describe 'ghostbuster_classes' do let(:path) { './modules/foo/manifests/init.pp' } context 'with fix disabled' do context 'when class is used' do let(:code) { 'class foo {}' } it 'does not detect any problem' do expect(problems.size).to...
github
voxpupuli/puppet-ghostbuster
https://github.com/voxpupuli/puppet-ghostbuster
spec/puppet-lint/plugins/ghostbuster_files_spec.rb
Ruby
apache-2.0
96
master
1,640
# frozen_string_literal: true require 'spec_helper' describe 'ghostbuster_files' do let(:code) { '' } context 'with fix disabled' do context 'when file usage is found in puppetdb' do let(:path) { './modules/foo/files/bar' } it 'does not detect any problem' do expect(problems.size).to eq(...
github
voxpupuli/puppet-ghostbuster
https://github.com/voxpupuli/puppet-ghostbuster
spec/puppet-lint/plugins/ghostbuster_defines_spec.rb
Ruby
apache-2.0
96
master
713
# frozen_string_literal: true require 'spec_helper' describe 'ghostbuster_defines' do context 'with fix disabled' do context 'when define is not used' do let(:code) { 'define foo::foo {}' } let(:path) { './modules/foo/manifests/foo.pp' } it 'detects one problem' do expect(problems.siz...
github
voxpupuli/puppet-ghostbuster
https://github.com/voxpupuli/puppet-ghostbuster
spec/puppet-lint/plugins/ghostbuster_templates_spec.rb
Ruby
apache-2.0
96
master
1,154
# frozen_string_literal: true require 'spec_helper' describe 'ghostbuster_templates' do let(:code) { '' } context 'with fix disabled' do context 'when using full module name syntax' do let(:path) { './modules/foo/templates/used_with_template' } it 'does not detect any problem' do expect(...
github
voxpupuli/puppet-ghostbuster
https://github.com/voxpupuli/puppet-ghostbuster
spec/puppet-lint/plugins/ghostbuster_hiera_files_spec.rb
Ruby
apache-2.0
96
master
3,174
# frozen_string_literal: true require 'spec_helper' ENV['HIERA_YAML_PATH'] = './spec/fixtures/hiera.yaml' describe 'ghostbuster_hiera_files' do let(:code) { '' } context 'with fix disabled' do context 'when a certname file is NOT used' do let(:path) { './data/nodes/foo.example.com.yaml' } it 'd...
github
voxpupuli/puppet-ghostbuster
https://github.com/voxpupuli/puppet-ghostbuster
spec/puppet-lint/plugins/ghostbuster_facts_spec.rb
Ruby
apache-2.0
96
master
1,812
# frozen_string_literal: true require 'spec_helper' describe 'ghostbuster_facts' do let(:code) { "Facter.add('foo')" } context 'with fix disabled' do context 'when fact is not used' do let(:path) { './spec/fixtures/modules/foo/lib/facter/multi.rb' } it 'detects one problem' do expect(pro...
github
voxpupuli/puppet-ghostbuster
https://github.com/voxpupuli/puppet-ghostbuster
spec/puppet-lint/plugins/ghostbuster_types_spec.rb
Ruby
apache-2.0
96
master
691
# frozen_string_literal: true require 'spec_helper' describe 'ghostbuster_types' do let(:code) { '' } context 'with fix disabled' do context 'when type is not used' do let(:path) { './spec/fixtures/modules/foo/lib/puppet/type/foo.rb' } it 'detects one problem' do expect(problems.size).to...
github
voxpupuli/puppet-ghostbuster
https://github.com/voxpupuli/puppet-ghostbuster
lib/puppet-lint/plugins/check_ghostbuster_types.rb
Ruby
apache-2.0
96
master
889
require 'puppet-ghostbuster/puppetdb' class PuppetLint::Checks def load_data(path, content) lexer = PuppetLint::Lexer.new PuppetLint::Data.path = path begin PuppetLint::Data.manifest_lines = content.split("\n", -1) PuppetLint::Data.tokens = lexer.tokenise(content) PuppetLint::Data.parse...
github
voxpupuli/puppet-ghostbuster
https://github.com/voxpupuli/puppet-ghostbuster
lib/puppet-lint/plugins/check_ghostbuster_defines.rb
Ruby
apache-2.0
96
master
971
require 'puppet-ghostbuster/puppetdb' class PuppetLint::Checks def load_data(path, content) lexer = PuppetLint::Lexer.new PuppetLint::Data.path = path begin PuppetLint::Data.manifest_lines = content.split("\n", -1) PuppetLint::Data.tokens = lexer.tokenise(content) PuppetLint::Data.parse...
github
voxpupuli/puppet-ghostbuster
https://github.com/voxpupuli/puppet-ghostbuster
lib/puppet-lint/plugins/check_ghostbuster_functions.rb
Ruby
apache-2.0
96
master
1,184
require 'puppet-ghostbuster/util' class PuppetLint::Checks def load_data(path, content) lexer = PuppetLint::Lexer.new PuppetLint::Data.path = path begin PuppetLint::Data.manifest_lines = content.split("\n", -1) PuppetLint::Data.tokens = lexer.tokenise(content) PuppetLint::Data.parse_con...
github
voxpupuli/puppet-ghostbuster
https://github.com/voxpupuli/puppet-ghostbuster
lib/puppet-lint/plugins/check_ghostbuster_files.rb
Ruby
apache-2.0
96
master
1,882
require 'puppet-ghostbuster/puppetdb' require 'puppet-ghostbuster/util' class PuppetLint::Checks def load_data(path, content) lexer = PuppetLint::Lexer.new PuppetLint::Data.path = path begin PuppetLint::Data.manifest_lines = content.split("\n", -1) PuppetLint::Data.tokens = lexer.tokenise(con...
github
voxpupuli/puppet-ghostbuster
https://github.com/voxpupuli/puppet-ghostbuster
lib/puppet-lint/plugins/check_ghostbuster_facts.rb
Ruby
apache-2.0
96
master
1,406
require 'puppet-ghostbuster/util' class PuppetLint::Checks def load_data(path, content) lexer = PuppetLint::Lexer.new PuppetLint::Data.path = path begin PuppetLint::Data.manifest_lines = content.split("\n", -1) PuppetLint::Data.tokens = lexer.tokenise(content) PuppetLint::Data.parse_con...
github
voxpupuli/puppet-ghostbuster
https://github.com/voxpupuli/puppet-ghostbuster
lib/puppet-lint/plugins/check_ghostbuster_classes.rb
Ruby
apache-2.0
96
master
962
require 'puppet-ghostbuster/puppetdb' class PuppetLint::Checks def load_data(path, content) lexer = PuppetLint::Lexer.new PuppetLint::Data.path = path begin PuppetLint::Data.manifest_lines = content.split("\n", -1) PuppetLint::Data.tokens = lexer.tokenise(content) PuppetLint::Data.parse...
github
voxpupuli/puppet-ghostbuster
https://github.com/voxpupuli/puppet-ghostbuster
lib/puppet-lint/plugins/check_ghostbuster_templates.rb
Ruby
apache-2.0
96
master
1,437
require 'puppet-ghostbuster/util' class PuppetLint::Checks def load_data(path, content) lexer = PuppetLint::Lexer.new PuppetLint::Data.path = path begin PuppetLint::Data.manifest_lines = content.split("\n", -1) PuppetLint::Data.tokens = lexer.tokenise(content) PuppetLint::Data.parse_con...
github
voxpupuli/puppet-ghostbuster
https://github.com/voxpupuli/puppet-ghostbuster
lib/puppet-lint/plugins/check_ghostbuster_hiera_files.rb
Ruby
apache-2.0
96
master
2,806
class PuppetLint::Checks def load_data(path, content) lexer = PuppetLint::Lexer.new PuppetLint::Data.path = path begin PuppetLint::Data.manifest_lines = content.split("\n", -1) PuppetLint::Data.tokens = lexer.tokenise(content) PuppetLint::Data.parse_control_comments rescue StandardEr...
github
voxpupuli/puppet-ghostbuster
https://github.com/voxpupuli/puppet-ghostbuster
lib/puppet-ghostbuster/puppetdb.rb
Ruby
apache-2.0
96
master
1,627
require 'puppetdb' require 'puppet' class PuppetGhostbuster class PuppetDB Puppet.initialize_settings begin require 'puppet/util/puppetdb' @@puppetdb = Puppet::Util::Puppetdb.config.server_urls[0] rescue LoadError @@puppetdb = "https://#{Puppet[:server]}:8081" end def self.cli...
github
voxpupuli/puppet-ghostbuster
https://github.com/voxpupuli/puppet-ghostbuster
lib/puppet-ghostbuster/util.rb
Ruby
apache-2.0
96
master
436
class PuppetGhostbuster class Util class << self def search_file(name, search) return search_file_regexp(name, search) if search.is_a?(Regexp) File.foreach(name) do |line| return true if line.include?(search) end end def search_file_regexp(name, search) ...
github
sergiobayona/easy_talk
https://github.com/sergiobayona/easy_talk
Rakefile
Ruby
mit
96
main
800
# frozen_string_literal: true require 'bundler/gem_tasks' require 'rspec/core/rake_task' require 'rubocop/rake_task' require 'yard' RSpec::Core::RakeTask.new(:spec) RuboCop::RakeTask.new YARD::Rake::YardocTask.new(:yard) do |t| t.files = ['lib/**/*.rb'] t.options = ['--readme', 'README.md', '--output-dir', 'doc...
github
sergiobayona/easy_talk
https://github.com/sergiobayona/easy_talk
Gemfile
Ruby
mit
96
main
373
# frozen_string_literal: true source 'https://rubygems.org' gemspec gem 'json_schemer', '>= 2.0' gem 'pry-byebug' gem 'rake', '>= 13.1' gem 'rspec', '>= 3.0' gem 'rspec-json_expectations', '>= 2.0' gem 'rspec-mocks', '>= 3.13' gem 'rubocop', '~> 1.82.1' gem 'simplecov', '>= 0.22', require: false gem 'simplecov-cober...
github
sergiobayona/easy_talk
https://github.com/sergiobayona/easy_talk
easy_talk.gemspec
Ruby
mit
96
main
1,803
# frozen_string_literal: true require_relative 'lib/easy_talk/version' Gem::Specification.new do |spec| spec.name = 'easy_talk' spec.version = EasyTalk::VERSION spec.authors = ['Sergio Bayona'] spec.email = ['bayona.sergio@gmail.com'] spec.summary = 'JSON Schema generation and validation for Ruby classes, ...
github
sergiobayona/easy_talk
https://github.com/sergiobayona/easy_talk
spec/spec_helper.rb
Ruby
mit
96
main
925
# frozen_string_literal: true require 'simplecov' require 'simplecov-cobertura' require 'pry-byebug' SimpleCov.start do add_filter '/spec/' add_filter '/vendor/' add_group 'Builders', 'lib/easy_talk/builders' add_group 'Core', 'lib/easy_talk' enable_coverage :branch if ENV['CI'] formatter SimpleCov...
github
sergiobayona/easy_talk
https://github.com/sergiobayona/easy_talk
spec/integration/json_schema_compliance_spec.rb
Ruby
mit
96
main
4,528
# frozen_string_literal: true require 'spec_helper' require 'json' require_relative '../support/json_schema_converter' RSpec.describe 'JSON Schema Compliance', :json_schema_compliance do TEST_SUITE_PATH = File.expand_path('../fixtures/json_schema_test_suite/tests/draft7', __dir__) # Define known failures to mana...
github
sergiobayona/easy_talk
https://github.com/sergiobayona/easy_talk
spec/support/json_schema_converter.rb
Ruby
mit
96
main
10,540
# frozen_string_literal: true require 'easy_talk' class JsonSchemaConverter TYPE_MAPPING = { 'string' => String, 'integer' => Integer, 'number' => Float, 'boolean' => T::Boolean, 'array' => Array # Untyped array - item type determined by determine_array_type }.freeze CONSTRAINT_KEYS = { ...
github
sergiobayona/easy_talk
https://github.com/sergiobayona/easy_talk
spec/support/schema_validation_matcher.rb
Ruby
mit
96
main
9,587
# frozen_string_literal: true require 'json_schemer' module EasyTalk module RSpec # Custom RSpec matcher that validates data against an EasyTalk model's JSON Schema # using json_schemer, then compares with ActiveModel validation results. # # @example Basic usage - validate data matches schema # ...
github
sergiobayona/easy_talk
https://github.com/sergiobayona/easy_talk
spec/support/json_schema_converter_spec.rb
Ruby
mit
96
main
5,659
# frozen_string_literal: true require 'spec_helper' require_relative 'json_schema_converter' RSpec.describe JsonSchemaConverter do let(:converter) { described_class.new({}) } describe '#extract_type_and_constraints' do context 'with boolean schemas' do it 'returns String with optional for true' do ...
github
sergiobayona/easy_talk
https://github.com/sergiobayona/easy_talk
spec/easy_talk/null_attribute_types_spec.rb
Ruby
mit
96
main
1,356
# frozen_string_literal: true require 'spec_helper' RSpec.describe 'null vs optional' do context 'for PORO' do let(:address) do Class.new do include EasyTalk::Model def self.name 'User' end define_schema do property :name, String property :ag...
github
sergiobayona/easy_talk
https://github.com/sergiobayona/easy_talk
spec/easy_talk/array_wrapping_spec.rb
Ruby
mit
96
main
3,658
# frozen_string_literal: true require 'spec_helper' RSpec.describe 'Array wrapping' do let(:address) do Class.new do include EasyTalk::Model def self.name 'Address' end define_schema do property :street, String property :city, String property :state, Str...
github
sergiobayona/easy_talk
https://github.com/sergiobayona/easy_talk
spec/easy_talk/attribute_accessors_spec.rb
Ruby
mit
96
main
1,933
# frozen_string_literal: true require 'spec_helper' RSpec.describe 'attribute accessors' do before do # Define Email class for use in testing class Email include EasyTalk::Model define_schema do property :address, String property :verified, T::Boolean end end end ...
github
sergiobayona/easy_talk
https://github.com/sergiobayona/easy_talk
spec/easy_talk/error_formatter_spec.rb
Ruby
mit
96
main
6,292
# frozen_string_literal: true require 'spec_helper' RSpec.describe EasyTalk::ErrorFormatter do let(:address_class) do Class.new do include EasyTalk::Model def self.name = 'Address' define_schema do property :street, String, min_length: 5 property :city, String, min_length: 3 ...
github
sergiobayona/easy_talk
https://github.com/sergiobayona/easy_talk
spec/easy_talk/json_schema_equality_spec.rb
Ruby
mit
96
main
8,048
# frozen_string_literal: true require 'spec_helper' RSpec.describe EasyTalk::JsonSchemaEquality do describe '.duplicates?' do context 'with primitive types' do it 'detects duplicate integers' do expect(described_class.duplicates?([1, 2, 1])).to be(true) end it 'accepts unique integers...
github
sergiobayona/easy_talk
https://github.com/sergiobayona/easy_talk
spec/easy_talk/schema_definition_spec.rb
Ruby
mit
96
main
7,633
# frozen_string_literal: true require 'spec_helper' require 'easy_talk/model' require 'stringio' RSpec.describe EasyTalk::SchemaDefinition do let(:model) do Class.new do include EasyTalk::Model def self.name 'Model' end define_schema do title 'Model' property :n...
github
sergiobayona/easy_talk
https://github.com/sergiobayona/easy_talk
spec/easy_talk/schema_validation_spec.rb
Ruby
mit
96
main
8,410
# frozen_string_literal: true require 'spec_helper' RSpec.describe 'validating json' do before do # Define Email class for use in testing class Email include EasyTalk::Model define_schema do property :address, String property :verified, String end end end after do...
github
sergiobayona/easy_talk
https://github.com/sergiobayona/easy_talk
spec/easy_talk/errors_helper_spec.rb
Ruby
mit
96
main
12,446
# frozen_string_literal: true require 'spec_helper' RSpec.describe EasyTalk::ErrorHelper do describe '.raise_constraint_error' do it 'raises a ConstraintError with formatted message' do expect do described_class.raise_constraint_error( property_name: :age, constraint_name: :min...
github
sergiobayona/easy_talk
https://github.com/sergiobayona/easy_talk
spec/easy_talk/schema_id_spec.rb
Ruby
mit
96
main
7,013
# frozen_string_literal: true require 'spec_helper' RSpec.describe 'Schema ID ($id keyword)' do after do # Reset configuration after each test EasyTalk.configuration.schema_id = nil EasyTalk.configuration.schema_version = :none end describe 'Configuration' do it 'defaults schema_id to nil' do ...
github
sergiobayona/easy_talk
https://github.com/sergiobayona/easy_talk
spec/easy_talk/nilable_optional_spec.rb
Ruby
mit
96
main
2,453
# frozen_string_literal: true require 'spec_helper' RSpec.describe 'nilable and optional properties' do context 'with default configuration' do before do EasyTalk.configure { |config| config.nilable_is_optional = false } end let(:user_class) do Class.new do include EasyTalk::Model ...
github
sergiobayona/easy_talk
https://github.com/sergiobayona/easy_talk
spec/easy_talk/ref_support_spec.rb
Ruby
mit
96
main
10,842
# frozen_string_literal: true require 'spec_helper' RSpec.describe 'JSON Schema $ref support' do let(:address) do Class.new do include EasyTalk::Model def self.name 'Address' end end end let(:phone) do Class.new do include EasyTalk::Model def self.name ...
github
sergiobayona/easy_talk
https://github.com/sergiobayona/easy_talk
spec/easy_talk/naming_strategies_spec.rb
Ruby
mit
96
main
3,835
# frozen_string_literal: true require 'spec_helper' RSpec.describe EasyTalk::NamingStrategies do describe 'identity' do it 'returns the same property name' do property_name = SecureRandom.uuid.to_sym expect(EasyTalk::NamingStrategies::IDENTITY.call(property_name)).to eq(property_name) end end ...
github
sergiobayona/easy_talk
https://github.com/sergiobayona/easy_talk
spec/easy_talk/validations_spec.rb
Ruby
mit
96
main
22,135
# frozen_string_literal: true require 'spec_helper' RSpec.describe 'Auto Validations' do let(:user_class) do Class.new do include EasyTalk::Model def self.name 'User' end define_schema do property :name, String, min_length: 2, max_length: 50 property :email, Str...
github
sergiobayona/easy_talk
https://github.com/sergiobayona/easy_talk
spec/easy_talk/additional_properties_spec.rb
Ruby
mit
96
main
6,254
# frozen_string_literal: true require 'spec_helper' RSpec.describe 'additional properties' do context 'when additional_properties true' do let(:company) do Class.new do include EasyTalk::Model def self.name 'Company' end define_schema do property :name...
github
sergiobayona/easy_talk
https://github.com/sergiobayona/easy_talk
spec/easy_talk/configuration_spec.rb
Ruby
mit
96
main
7,452
# frozen_string_literal: true require 'spec_helper' RSpec.describe EasyTalk::Configuration do describe 'default values' do subject(:config) { described_class.new } it 'defaults default_additional_properties to false' do expect(config.default_additional_properties).to be false end it 'default...
github
sergiobayona/easy_talk
https://github.com/sergiobayona/easy_talk
spec/easy_talk/type_introspection_spec.rb
Ruby
mit
96
main
58,739
# frozen_string_literal: true require 'spec_helper' RSpec.describe EasyTalk::TypeIntrospection do describe '.boolean_type?' do context 'with boolean types' do it 'returns true for TrueClass' do expect(described_class.boolean_type?(TrueClass)).to be true end it 'returns true for FalseC...
github
sergiobayona/easy_talk
https://github.com/sergiobayona/easy_talk
spec/easy_talk/activemodel_integration_spec.rb
Ruby
mit
96
main
4,377
# frozen_string_literal: true require 'spec_helper' RSpec.describe 'validing json' do before do # Define Email class for use in testing class Email include EasyTalk::Model define_schema do property :address, String property :verified, T::Boolean end def [](key) ...
github
sergiobayona/easy_talk
https://github.com/sergiobayona/easy_talk
spec/easy_talk/optional_properties_spec.rb
Ruby
mit
96
main
3,351
# frozen_string_literal: true require 'spec_helper' require 'easy_talk/model' RSpec.describe 'optional properties' do before do EasyTalk.configure do |config| config.nilable_is_optional = false end # Define the Email class for use in the tests class Email include EasyTalk::Model ...
github
sergiobayona/easy_talk
https://github.com/sergiobayona/easy_talk
spec/easy_talk/per_model_validation_spec.rb
Ruby
mit
96
main
5,867
# frozen_string_literal: true require 'spec_helper' RSpec.describe 'Per-model validation configuration' do describe 'define_schema(validations: false)' do let(:test_class) do Class.new do include EasyTalk::Model def self.name = 'NoValidationModel' define_schema(validations: false...
github
sergiobayona/easy_talk
https://github.com/sergiobayona/easy_talk
spec/easy_talk/schema_validation_matcher_spec.rb
Ruby
mit
96
main
9,416
# frozen_string_literal: true require 'spec_helper' RSpec.describe 'Schema Validation Matcher' do let(:address_class) do Class.new do include EasyTalk::Model def self.name 'Address' end define_schema do property :street, String property :city, String pro...
github
sergiobayona/easy_talk
https://github.com/sergiobayona/easy_talk
spec/easy_talk/additional_properties_schema_spec.rb
Ruby
mit
96
main
13,331
# frozen_string_literal: true require 'spec_helper' RSpec.describe 'additionalProperties with schema objects' do describe 'schema generation' do context 'with String type' do let(:test_class) do Class.new do include EasyTalk::Model def self.name = 'Config' define_sc...
github
sergiobayona/easy_talk
https://github.com/sergiobayona/easy_talk
spec/easy_talk/model_spec.rb
Ruby
mit
96
main
12,818
# frozen_string_literal: true require 'spec_helper' RSpec.describe EasyTalk::Model do before do # Define Email class for use in testing class Email include EasyTalk::Model define_schema do property :address, String property :verified, String end end end after do ...
github
sergiobayona/easy_talk
https://github.com/sergiobayona/easy_talk
spec/easy_talk/optional_array_nil_spec.rb
Ruby
mit
96
main
1,509
# frozen_string_literal: true require 'spec_helper' RSpec.describe 'Optional array properties and nil acceptance' do context 'when array property is optional' do let(:klass) do Class.new do include EasyTalk::Model def self.name = 'OptionalArrayModel' define_schema do pr...
github
sergiobayona/easy_talk
https://github.com/sergiobayona/easy_talk
spec/easy_talk/schema_version_spec.rb
Ruby
mit
96
main
6,492
# frozen_string_literal: true require 'spec_helper' RSpec.describe 'Schema version ($schema keyword)' do after do # Reset configuration after each test EasyTalk.configuration.schema_version = :none end describe 'Configuration' do it 'defaults schema_version to :none' do expect(EasyTalk.config...
github
sergiobayona/easy_talk
https://github.com/sergiobayona/easy_talk
spec/easy_talk/per_property_validation_spec.rb
Ruby
mit
96
main
5,563
# frozen_string_literal: true require 'spec_helper' RSpec.describe 'Per-property validation control' do describe 'property with validate: false' do let(:test_class) do Class.new do include EasyTalk::Model def self.name = 'PerPropertyValidationModel' define_schema do pro...
github
sergiobayona/easy_talk
https://github.com/sergiobayona/easy_talk
spec/easy_talk/default_spec.rb
Ruby
mit
96
main
1,578
# frozen_string_literal: true require 'spec_helper' RSpec.describe 'default values' do let(:default_class) do Class.new do include(EasyTalk::Model) def self.name 'DefaultClass' end define_schema do property :default_enum, String, enum: %w[one two three], default: 'two' ...
github
sergiobayona/easy_talk
https://github.com/sergiobayona/easy_talk
spec/easy_talk/external_ref_spec.rb
Ruby
mit
96
main
18,764
# frozen_string_literal: true require 'spec_helper' RSpec.describe 'External $ref Support via $id' do before do # Reset configuration before each test EasyTalk.configuration.base_schema_uri = nil EasyTalk.configuration.auto_generate_ids = false EasyTalk.configuration.prefer_external_refs = false ...
github
sergiobayona/easy_talk
https://github.com/sergiobayona/easy_talk
spec/easy_talk/property_spec.rb
Ruby
mit
96
main
10,843
# frozen_string_literal: true require 'spec_helper' RSpec.describe EasyTalk::Property do it 'returns a string schema' do prop = described_class.new(:name, String).build expect(prop).to eq(type: 'string') end it 'returns an integer schema' do prop = described_class.new(:name, Integer).build expe...
github
sergiobayona/easy_talk
https://github.com/sergiobayona/easy_talk
spec/easy_talk/one_of_spec.rb
Ruby
mit
96
main
5,015
# frozen_string_literal: true require 'spec_helper' RSpec.describe EasyTalk::Types::Composer::OneOf do let(:phone_number) do Class.new do include EasyTalk::Model def self.name 'PhoneNumber' end define_schema do property :phone_number, String, format: 'phone' end ...
github
sergiobayona/easy_talk
https://github.com/sergiobayona/easy_talk
spec/easy_talk/ref_helper_spec.rb
Ruby
mit
96
main
4,558
# frozen_string_literal: true require 'spec_helper' RSpec.describe EasyTalk::RefHelper do let(:model_class) do Class.new do include EasyTalk::Model def self.name 'TestModel' end define_schema do property :name, String end end end let(:non_model_class) do ...
github
sergiobayona/easy_talk
https://github.com/sergiobayona/easy_talk
spec/easy_talk/schema_spec.rb
Ruby
mit
96
main
15,015
# frozen_string_literal: true require 'spec_helper' RSpec.describe EasyTalk::Schema do describe 'basic functionality' do let(:schema_class) do Class.new do include EasyTalk::Schema def self.name = 'ApiContract' define_schema do title 'API Contract' description...
github
sergiobayona/easy_talk
https://github.com/sergiobayona/easy_talk
spec/easy_talk/builders/object_builder_spec.rb
Ruby
mit
96
main
14,801
# frozen_string_literal: true require 'spec_helper' RSpec.describe EasyTalk::Builders::ObjectBuilder do describe '#build' do context 'with basic schema generation' do let(:simple_model) do Class.new do include EasyTalk::Model def self.name 'SimpleModel' e...
github
sergiobayona/easy_talk
https://github.com/sergiobayona/easy_talk
spec/easy_talk/builders/collection_helpers_spec.rb
Ruby
mit
96
main
2,700
# frozen_string_literal: true require 'spec_helper' RSpec.describe EasyTalk::Builders::CollectionHelpers do describe '#collection_type?' do context 'when module is included' do let(:including_class) do Class.new do include EasyTalk::Builders::CollectionHelpers end end ...
github
sergiobayona/easy_talk
https://github.com/sergiobayona/easy_talk
spec/easy_talk/builders/integer_builder_spec.rb
Ruby
mit
96
main
3,321
# frozen_string_literal: true require 'spec_helper' RSpec.describe EasyTalk::Builders::IntegerBuilder do context 'with valid options' do it 'returns a bare json object' do prop = described_class.new(:name).build expect(prop).to eq({ type: 'integer' }) end it 'includes a title' do prop...
github
sergiobayona/easy_talk
https://github.com/sergiobayona/easy_talk
spec/easy_talk/builders/temporal_builder_spec.rb
Ruby
mit
96
main
9,013
# frozen_string_literal: true require 'spec_helper' RSpec.describe EasyTalk::Builders::TemporalBuilder do describe '#build' do context 'with basic configuration' do it 'returns type string with no format when format is nil' do builder = described_class.new(:timestamp) expect(builder.build)...
github
sergiobayona/easy_talk
https://github.com/sergiobayona/easy_talk
spec/easy_talk/builders/registry_spec.rb
Ruby
mit
96
main
6,937
# frozen_string_literal: true require 'spec_helper' RSpec.describe EasyTalk::Builders::Registry do # Create a mock builder class for testing let(:mock_builder_class) do Class.new do def self.name = 'MockBuilder' def initialize(*args) @args = args end def build { type:...
github
sergiobayona/easy_talk
https://github.com/sergiobayona/easy_talk
spec/easy_talk/builders/composition_builder_spec.rb
Ruby
mit
96
main
13,377
# frozen_string_literal: true require 'spec_helper' RSpec.describe EasyTalk::Builders::CompositionBuilder do let(:person_model) do Class.new do include EasyTalk::Model def self.name 'Person' end define_schema do property :name, String property :age, Integer ...
github
sergiobayona/easy_talk
https://github.com/sergiobayona/easy_talk
spec/easy_talk/builders/number_builder_spec.rb
Ruby
mit
96
main
7,089
# frozen_string_literal: true require 'spec_helper' require 'easy_talk/builders/number_builder' RSpec.describe EasyTalk::Builders::NumberBuilder do describe '#initialize' do let(:builder) { described_class.new(:age, minimum: 18, maximum: 100) } it 'sets the name' do expect(builder.property_name).to e...
github
sergiobayona/easy_talk
https://github.com/sergiobayona/easy_talk
spec/easy_talk/builders/custom_type_integration_spec.rb
Ruby
mit
96
main
6,918
# frozen_string_literal: true require 'spec_helper' RSpec.describe 'Custom Type Registration Integration' do # Define a custom Money class let(:money_class) do Class.new do def self.name = 'Money' attr_reader :amount, :currency def initialize(amount, currency = 'USD') @amount = amo...
github
sergiobayona/easy_talk
https://github.com/sergiobayona/easy_talk
spec/easy_talk/builders/string_builder_spec.rb
Ruby
mit
96
main
7,372
# frozen_string_literal: true require 'spec_helper' RSpec.describe EasyTalk::Builders::StringBuilder do describe '#build' do context 'with basic configuration' do it 'returns type string with no options' do builder = described_class.new(:name) expect(builder.build).to eq({ type: 'string' }...
github
sergiobayona/easy_talk
https://github.com/sergiobayona/easy_talk
spec/easy_talk/builders/boolean_builder_spec.rb
Ruby
mit
96
main
4,816
# frozen_string_literal: true require 'spec_helper' RSpec.describe EasyTalk::Builders::BooleanBuilder do describe '#build' do context 'with basic configuration' do it 'returns type boolean with no options' do builder = described_class.new(:active) expect(builder.build).to eq({ type: 'boole...
github
sergiobayona/easy_talk
https://github.com/sergiobayona/easy_talk
spec/easy_talk/builders/base_builder_spec.rb
Ruby
mit
96
main
5,131
# frozen_string_literal: true require 'spec_helper' require 'easy_talk/builders/base_builder' require 'active_support/core_ext/hash/keys' require 'sorbet-runtime' # Define a dummy type as a subclass of String. This allows us to use T.let # and have our custom type check work. It also defines a class method # `recursi...
github
sergiobayona/easy_talk
https://github.com/sergiobayona/easy_talk
spec/easy_talk/builders/typed_array_builder_spec.rb
Ruby
mit
96
main
5,469
# frozen_string_literal: true require 'spec_helper' RSpec.describe EasyTalk::Builders::TypedArrayBuilder do context 'with valid options' do context 'with a string inner type' do it 'returns a basic json object' do prop = described_class.new(:name, T::Array[String]).build expect(prop).to eq...
github
sergiobayona/easy_talk
https://github.com/sergiobayona/easy_talk
spec/easy_talk/builders/null_builder_spec.rb
Ruby
mit
96
main
2,265
# frozen_string_literal: true require 'spec_helper' RSpec.describe EasyTalk::Builders::NullBuilder do describe '#build' do context 'with basic configuration' do it 'returns type null with no options' do builder = described_class.new(:value) expect(builder.build).to eq({ type: 'null' }) ...
github
sergiobayona/easy_talk
https://github.com/sergiobayona/easy_talk
spec/easy_talk/builders/union_builder_spec.rb
Ruby
mit
96
main
7,221
# frozen_string_literal: true require 'spec_helper' RSpec.describe EasyTalk::Builders::UnionBuilder do describe '#build' do context 'with union of primitive types' do it 'generates anyOf schema for String and Integer union' do union_type = T.any(String, Integer) builder = described_class.n...
github
sergiobayona/easy_talk
https://github.com/sergiobayona/easy_talk
spec/easy_talk/validation_adapters/base_spec.rb
Ruby
mit
96
main
3,165
# frozen_string_literal: true require 'spec_helper' RSpec.describe EasyTalk::ValidationAdapters::Base do let(:test_class) do Class.new do include EasyTalk::Model def self.name = 'TestModel' end end describe '.build_validations' do it 'creates an instance and calls apply_validations' do...
github
sergiobayona/easy_talk
https://github.com/sergiobayona/easy_talk
spec/easy_talk/validation_adapters/active_model_adapter_spec.rb
Ruby
mit
96
main
22,041
# frozen_string_literal: true require 'spec_helper' RSpec.describe EasyTalk::ValidationAdapters::ActiveModelAdapter do describe '.build_validations' do context 'with string constraints' do let(:test_class) do Class.new do include EasyTalk::Model def self.name = 'StringTest' ...
github
sergiobayona/easy_talk
https://github.com/sergiobayona/easy_talk
spec/easy_talk/validation_adapters/registry_spec.rb
Ruby
mit
96
main
4,412
# frozen_string_literal: true require 'spec_helper' RSpec.describe EasyTalk::ValidationAdapters::Registry do # Store original adapters and restore after each test let(:original_adapters) { described_class.adapters.dup } after do # reset! now repopulates default adapters automatically described_class.re...
github
sergiobayona/easy_talk
https://github.com/sergiobayona/easy_talk
spec/easy_talk/validation_adapters/none_adapter_spec.rb
Ruby
mit
96
main
2,823
# frozen_string_literal: true require 'spec_helper' RSpec.describe EasyTalk::ValidationAdapters::NoneAdapter do let(:test_class) do Class.new do include EasyTalk::Model def self.name = 'NoneAdapterTest' end end describe '.build_validations' do it 'does not add any validations' do ...
github
sergiobayona/easy_talk
https://github.com/sergiobayona/easy_talk
spec/easy_talk/examples/tuple_validation_spec.rb
Ruby
mit
96
main
9,955
# frozen_string_literal: true require 'spec_helper' RSpec.describe 'Tuple Validation with T::Tuple' do describe 'schema generation' do context 'basic T::Tuple usage' do let(:model_class) do Class.new do include EasyTalk::Model def self.name = 'TupleTypeModel' define...
github
sergiobayona/easy_talk
https://github.com/sergiobayona/easy_talk
spec/easy_talk/examples/company_owner_spec.rb
Ruby
mit
96
main
1,551
# frozen_string_literal: true require 'spec_helper' RSpec.describe 'json for user model' do let(:company) do Class.new do include EasyTalk::Model def self.name 'Company' end end end let(:owner) do Class.new do include EasyTalk::Model def self.name 'Ow...
github
sergiobayona/easy_talk
https://github.com/sergiobayona/easy_talk
spec/easy_talk/examples/library_book_collection_spec.rb
Ruby
mit
96
main
2,434
# frozen_string_literal: true require 'spec_helper' RSpec.describe 'Library Book Collection' do let(:book) do Class.new do include EasyTalk::Model def self.name 'Book' end define_schema do title 'Book' property :title, String, description: 'The title of the book...
github
sergiobayona/easy_talk
https://github.com/sergiobayona/easy_talk
spec/easy_talk/examples/user_model_spec.rb
Ruby
mit
96
main
2,924
# frozen_string_literal: true require 'spec_helper' RSpec.describe 'json for user model' do let(:user) do Class.new do include EasyTalk::Model def self.name 'User' end end end let(:phone) do Class.new do include EasyTalk::Model def self.name 'Phone' ...
github
sergiobayona/easy_talk
https://github.com/sergiobayona/easy_talk
spec/easy_talk/examples/contact_data_spec.rb
Ruby
mit
96
main
2,064
# frozen_string_literal: true require 'spec_helper' RSpec.describe 'Contact info. Example using compositional keyword: oneOf' do let(:phone_contact) do Class.new do include EasyTalk::Model def self.name 'PhoneContact' end define_schema do property :phone_number, String,...
github
sergiobayona/easy_talk
https://github.com/sergiobayona/easy_talk
spec/easy_talk/examples/vehicle_registration_spec.rb
Ruby
mit
96
main
4,353
# frozen_string_literal: true require 'spec_helper' RSpec.describe 'Vehicle Registration System example' do let(:vehicle_identification) do Class.new do include EasyTalk::Model def self.name 'VehicleIdentification' end define_schema do title 'Vehicle Identification' ...
github
sergiobayona/easy_talk
https://github.com/sergiobayona/easy_talk
spec/easy_talk/examples/payment_spec.rb
Ruby
mit
96
main
4,738
# frozen_string_literal: true require 'spec_helper' RSpec.describe 'Payment object example' do let(:credit_card) do Class.new do include EasyTalk::Model def self.name 'CreditCard' end define_schema do property :CardNumber, String property :CardType, String, enum...
github
sergiobayona/easy_talk
https://github.com/sergiobayona/easy_talk
spec/easy_talk/examples/product_catalog_spec.rb
Ruby
mit
96
main
2,397
# frozen_string_literal: true require 'spec_helper' RSpec.describe 'Product catalog example' do let(:base_product) do Class.new do include EasyTalk::Model def self.name 'BaseProduct' end define_schema do property :productId, String, format: 'uuid' property :name...
github
sergiobayona/easy_talk
https://github.com/sergiobayona/easy_talk
spec/easy_talk/examples/user_routing_table_spec.rb
Ruby
mit
96
main
7,244
# frozen_string_literal: true require 'spec_helper' RSpec.describe 'User routing table' do before do # Define classes for use in testing class RouteParameter include EasyTalk::Model define_schema do property :id, String, description: 'The user id' end end class EmailParam...
github
sergiobayona/easy_talk
https://github.com/sergiobayona/easy_talk
spec/easy_talk/examples/nilable_nested_model_spec.rb
Ruby
mit
96
main
2,111
# frozen_string_literal: true require 'spec_helper' RSpec.describe 'combining nested models with nilable' do let(:address) do Class.new do include EasyTalk::Model def self.name 'Address' end end end let(:expected_json_schema) do { "title" => "Company", "type" =...
github
sergiobayona/easy_talk
https://github.com/sergiobayona/easy_talk
spec/easy_talk/examples/company_employees_spec.rb
Ruby
mit
96
main
3,854
# frozen_string_literal: true require 'spec_helper' RSpec.describe 'json for user model' do let(:company) do Class.new do include EasyTalk::Model def self.name 'Company' end end end let(:address) do Class.new do include EasyTalk::Model def self.name '...
github
sergiobayona/easy_talk
https://github.com/sergiobayona/easy_talk
spec/easy_talk/examples/ticketing_spec.rb
Ruby
mit
96
main
4,518
# frozen_string_literal: true require 'spec_helper' RSpec.describe 'Ticketing system' do let(:subtask) do Class.new do include EasyTalk::Model def self.name 'Subtask' end define_schema do property :id, Integer, description: 'Unique identifier for the subtask' pr...
github
sergiobayona/easy_talk
https://github.com/sergiobayona/easy_talk
spec/easy_talk/error_formatter/base_spec.rb
Ruby
mit
96
main
2,034
# frozen_string_literal: true require 'spec_helper' RSpec.describe EasyTalk::ErrorFormatter::Base do let(:test_class) do Class.new do include EasyTalk::Model def self.name = 'BaseFormatterTest' define_schema do property :name, String end end end describe '#format' do ...
github
sergiobayona/easy_talk
https://github.com/sergiobayona/easy_talk
spec/easy_talk/error_formatter/path_converter_spec.rb
Ruby
mit
96
main
1,656
# frozen_string_literal: true require 'spec_helper' RSpec.describe EasyTalk::ErrorFormatter::PathConverter do describe '.to_json_pointer' do it 'converts simple attribute to JSON Pointer' do expect(described_class.to_json_pointer(:name)).to eq('/properties/name') end it 'converts nested attribute...
github
sergiobayona/easy_talk
https://github.com/sergiobayona/easy_talk
spec/easy_talk/error_formatter/flat_spec.rb
Ruby
mit
96
main
1,928
# frozen_string_literal: true require 'spec_helper' RSpec.describe EasyTalk::ErrorFormatter::Flat do let(:test_class) do Class.new do include EasyTalk::Model def self.name = 'FlatFormatterTest' define_schema do property :name, String, min_length: 2 property :email, String, fo...
github
sergiobayona/easy_talk
https://github.com/sergiobayona/easy_talk
spec/easy_talk/error_formatter/rfc7807_spec.rb
Ruby
mit
96
main
3,383
# frozen_string_literal: true require 'spec_helper' RSpec.describe EasyTalk::ErrorFormatter::Rfc7807 do let(:test_class) do Class.new do include EasyTalk::Model def self.name = 'Rfc7807FormatterTest' define_schema do property :name, String, min_length: 2 property :age, Intege...
github
sergiobayona/easy_talk
https://github.com/sergiobayona/easy_talk
spec/easy_talk/error_formatter/error_code_mapper_spec.rb
Ruby
mit
96
main
1,738
# frozen_string_literal: true require 'spec_helper' RSpec.describe EasyTalk::ErrorFormatter::ErrorCodeMapper do describe '.map' do it 'maps :blank to "blank"' do expect(described_class.map(:blank)).to eq('blank') end it 'maps :invalid to "invalid_format"' do expect(described_class.map(:inva...
github
sergiobayona/easy_talk
https://github.com/sergiobayona/easy_talk
spec/easy_talk/error_formatter/json_pointer_spec.rb
Ruby
mit
96
main
1,449
# frozen_string_literal: true require 'spec_helper' RSpec.describe EasyTalk::ErrorFormatter::JsonPointer do let(:test_class) do Class.new do include EasyTalk::Model def self.name = 'JsonPointerFormatterTest' define_schema do property :name, String, min_length: 2 property :age...
github
sergiobayona/easy_talk
https://github.com/sergiobayona/easy_talk
spec/easy_talk/error_formatter/jsonapi_spec.rb
Ruby
mit
96
main
2,968
# frozen_string_literal: true require 'spec_helper' RSpec.describe EasyTalk::ErrorFormatter::Jsonapi do let(:test_class) do Class.new do include EasyTalk::Model def self.name = 'JsonapiFormatterTest' define_schema do property :name, String, min_length: 2 property :age, Intege...