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
bfoz/geometry
https://github.com/bfoz/geometry
test/geometry/annulus.rb
Ruby
bsd-2-clause
47
main
2,000
require 'minitest/autorun' require 'geometry/annulus' describe Geometry::Annulus do it 'must complain when constructed with only a center' do -> { Geometry::Annulus.new center:Point[1,2] }.must_raise ArgumentError end it 'must also be known as a Ring' do Geometry::Ring.new(Point[1,2], inner_radius:5, ra...
github
bfoz/geometry
https://github.com/bfoz/geometry
test/geometry/square.rb
Ruby
bsd-2-clause
47
main
5,548
require 'minitest/autorun' require 'geometry/square' describe Geometry::Square do Square = Geometry::Square describe "when constructed" do it "must create a Square from two Points" do square = Square.new from:[1,2], to:[3,4] square.must_be_kind_of Geometry::Square end it "must reorder swapped po...
github
bfoz/geometry
https://github.com/bfoz/geometry
test/geometry/obround.rb
Ruby
bsd-2-clause
47
main
747
require 'minitest/autorun' require 'geometry/obround' describe Geometry::Obround do Obround = Geometry::Obround describe "when constructed" do it "must accept two Points" do obround = Geometry::Obround.new [1,2], [3,4] obround.must_be_kind_of Geometry::Obround end it "must accept a width and hei...
github
bfoz/geometry
https://github.com/bfoz/geometry
test/geometry/size_one.rb
Ruby
bsd-2-clause
47
main
3,611
require 'minitest/autorun' require 'geometry/size_one' describe Geometry::SizeOne do Size = Geometry::Size let(:one) { Geometry::SizeOne.new } describe 'arithmetic' do let(:left) { Size[1,2] } let(:right) { Size[3,4] } it 'must have +@' do (+one).must_be :eql?, 1 (+one).must_be_instance_of(...
github
bfoz/geometry
https://github.com/bfoz/geometry
test/geometry/point_iso.rb
Ruby
bsd-2-clause
47
main
6,747
require 'minitest/autorun' require 'geometry/point_iso' describe Geometry::PointIso do let(:iso_value) { 5 } subject { Geometry::PointIso.new(5) } it 'must pop' do subject.pop.must_equal Point[5] subject.pop(2).must_equal Point[5, 5] end it 'must shift' do subject.shift.must_equal Point[5] su...
github
bfoz/geometry
https://github.com/bfoz/geometry
test/geometry/edge.rb
Ruby
bsd-2-clause
47
main
4,772
require 'minitest/autorun' require 'geometry/edge' def Edge(*args) Geometry::Edge.new(*args) end describe Geometry::Edge do Edge = Geometry::Edge subject { Geometry::Edge.new [0,0], [1,1] } it "must create an Edge object" do edge = Edge.new([0,0], [1,0]) assert_kind_of(Geometry::Edge, edge) assert...
github
bfoz/geometry
https://github.com/bfoz/geometry
test/geometry/polygon.rb
Ruby
bsd-2-clause
47
main
8,346
require 'minitest/autorun' require 'geometry/polygon' describe Geometry::Polygon do Polygon = Geometry::Polygon let(:cw_unit_square) { Polygon.new [0,0], [0,1], [1,1], [1,0] } let(:unit_square) { Polygon.new [0,0], [1,0], [1,1], [0,1] } let(:simple_concave) { Polygon.new [0,0], [4,0], [4,2], [3,2], [3...
github
bfoz/geometry
https://github.com/bfoz/geometry
test/geometry/transformation/composition.rb
Ruby
bsd-2-clause
47
main
1,453
require 'minitest/autorun' require 'geometry/transformation/composition' describe Geometry::Transformation::Composition do Composition = Geometry::Transformation::Composition Transformation = Geometry::Transformation subject { Composition.new } describe "when constructed" do it "must accept multiple...
github
scalefactory/tfctl
https://github.com/scalefactory/tfctl
Guardfile
Ruby
mit
47
master
223
# frozen_string_literal: true guard :rspec, cmd: 'bundle exec rspec' do watch(%r{^spec/.+_spec\.rb$}) watch(%r{^lib/tfctl/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" } watch('spec/spec_helper.rb') { 'spec' } end
github
scalefactory/tfctl
https://github.com/scalefactory/tfctl
tfctl.gemspec
Ruby
mit
47
master
1,511
# frozen_string_literal: true $LOAD_PATH << File.expand_path('lib', __dir__) require 'tfctl/version' Gem::Specification.new do |spec| spec.name = 'tfctl' spec.version = Tfctl::VERSION spec.authors = [ 'Andrew Wasilczuk', ] spec.email = [ 'akw@scalefacto...
github
scalefactory/tfctl
https://github.com/scalefactory/tfctl
lib/hash.rb
Ruby
mit
47
master
962
# frozen_string_literal: true # Add a deep_merge method to a Hash. # It unions arrays (for terraform profiles behaviour) class Hash def deep_merge(second) merger = proc { |_key, v1, v2| if v1.is_a?(Hash) && v2.is_a?(Hash) v1.merge(v2, &merger) elsif v1.is_a?(Array) &...
github
scalefactory/tfctl
https://github.com/scalefactory/tfctl
lib/tfctl.rb
Ruby
mit
47
master
293
# frozen_string_literal: true require_relative 'tfctl/aws_org' require_relative 'tfctl/config' require_relative 'tfctl/error' require_relative 'tfctl/executor' require_relative 'tfctl/generator' require_relative 'tfctl/logger' require_relative 'tfctl/schema' require_relative 'tfctl/version'
github
scalefactory/tfctl
https://github.com/scalefactory/tfctl
lib/tfctl/executor.rb
Ruby
mit
47
master
3,728
# frozen_string_literal: true require 'open3' require 'fileutils' require 'shellwords' require_relative 'error' module Tfctl module Executor module_function # Execute terraform command def run(account_name:, config_name:, log:, cmd: nil, argv: [], unbuffered: true) # Use bin/...
github
scalefactory/tfctl
https://github.com/scalefactory/tfctl
lib/tfctl/aws_org.rb
Ruby
mit
47
master
3,885
# frozen_string_literal: true require_relative 'error' require 'aws-sdk-organizations' module Tfctl class AwsOrg def initialize(role_arn) @aws_org_client = Aws::Organizations::Client.new( region: 'us-east-1', # Assume role in primary account to read AWS or...
github
scalefactory/tfctl
https://github.com/scalefactory/tfctl
lib/tfctl/error.rb
Ruby
mit
47
master
281
# frozen_string_literal: true module Tfctl class Error < StandardError end class ValidationError < StandardError attr_reader :issues def initialize(message, issues = []) super(message) @issues = issues end end end
github
scalefactory/tfctl
https://github.com/scalefactory/tfctl
lib/tfctl/logger.rb
Ruby
mit
47
master
964
# frozen_string_literal: true require 'logger' module Tfctl class Logger def initialize(log_level) @outlog = ::Logger.new($stdout) self.level = log_level @outlog.formatter = proc do |severity, _datetime, _progname, msg| # "#{datetime.iso8601} #{sever...
github
scalefactory/tfctl
https://github.com/scalefactory/tfctl
lib/tfctl/config.rb
Ruby
mit
47
master
6,078
# frozen_string_literal: true require_relative '../hash' require_relative 'error' require 'yaml' require 'json' module Tfctl class Config include Enumerable attr_reader :config def initialize(config_name:, yaml_config:, aws_org_config:, use_cache: false) cache_file = "#{PROJE...
github
scalefactory/tfctl
https://github.com/scalefactory/tfctl
lib/tfctl/generator.rb
Ruby
mit
47
master
3,656
# frozen_string_literal: true require 'fileutils' # Generates top level Terraform configuration for an account. module Tfctl module Generator module_function def write_json_block(path, block) File.write(path, "#{JSON.pretty_generate(block)}\n") end def make(account:,...
github
scalefactory/tfctl
https://github.com/scalefactory/tfctl
lib/tfctl/schema.rb
Ruby
mit
47
master
3,168
# frozen_string_literal: true require 'json_schemer' require_relative 'error' # Config validator using JSON schema module Tfctl module Schema class << self def validate(data) schemer = JSONSchemer.schema(main_schema) issues = [] schemer.validat...
github
scalefactory/tfctl
https://github.com/scalefactory/tfctl
spec/schema_spec.rb
Ruby
mit
47
master
1,152
# frozen_string_literal: true require 'yaml' require_relative '../lib/hash' require_relative '../lib/tfctl/schema' RSpec.describe Tfctl::Schema do let(:yaml_config) do YAML.safe_load(File.read("#{PROJECT_ROOT}/spec/data/config.yaml"), aliases: true) end subject do Tfctl::Schema.validate(y...
github
scalefactory/tfctl
https://github.com/scalefactory/tfctl
spec/spec_helper.rb
Ruby
mit
47
master
5,457
# frozen_string_literal: true PROJECT_ROOT = File.expand_path("#{__dir__}/../") # This file was generated by the `rspec --init` command. Conventionally, all # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`. # The generated `.rspec` file contains `--require spec_helper` which will cause # t...
github
scalefactory/tfctl
https://github.com/scalefactory/tfctl
spec/config_spec.rb
Ruby
mit
47
master
5,443
# frozen_string_literal: true require_relative '../lib/tfctl/config' RSpec.describe Tfctl::Config do # test data def yaml_config YAML.safe_load(File.read("#{PROJECT_ROOT}/spec/data/config.yaml"), aliases: true).symbolize_names! end def aws_org_config # rubocop:disable Security/YAMLLo...
github
scalefactory/tfctl
https://github.com/scalefactory/tfctl
spec/generator_spec.rb
Ruby
mit
47
master
3,209
# frozen_string_literal: true require_relative '../lib/tfctl/config' require_relative '../lib/tfctl/generator' RSpec.describe Tfctl::Generator do # test data def yaml_config YAML.safe_load(File.read("#{PROJECT_ROOT}/spec/data/config.yaml"), aliases: true).symbolize_names! end def aws_org_conf...
github
andrewgr/missing_validators
https://github.com/andrewgr/missing_validators
missing_validators.gemspec
Ruby
mit
47
master
1,253
require File.expand_path('../lib/missing_validators/version', __FILE__) Gem::Specification.new do |gem| gem.authors = ['Andrei Gridnev'] gem.email = ['andrew.gridnev@gmail.com'] gem.summary = 'Adds some handy validators.' gem.description = 'Validates email addresses, URLs, IMEI, MAC addre...
github
andrewgr/missing_validators
https://github.com/andrewgr/missing_validators
Rakefile
Ruby
mit
47
master
288
#!/usr/bin/env rake require 'bundler/gem_tasks' require 'cane/rake_task' require 'rspec/core/rake_task' RSpec::Core::RakeTask.new('spec') task default: :spec desc 'Run cane to check quality metrics' Cane::RakeTask.new(:quality) do |cane| cane.abc_max = 10 cane.no_style = true end
github
andrewgr/missing_validators
https://github.com/andrewgr/missing_validators
lib/missing_validators.rb
Ruby
mit
47
master
1,507
require 'active_model' require 'addressable/uri' require 'missing_validators/version' require 'missing_validators/validators/base_validator' require 'missing_validators/validators/equality_validator' require 'missing_validators/validators/inequality_validator' require 'missing_validators/validators/email_validator' req...
github
andrewgr/missing_validators
https://github.com/andrewgr/missing_validators
lib/missing_validators/matchers/ensure_valid_mac_address_format_of.rb
Ruby
mit
47
master
608
RSpec::Matchers.define :ensure_valid_mac_address_format_of do |attribute| root = 'missing_validators.matchers.ensure_valid_mac_address_format_of' match do |model| model.send("#{attribute}=", 'invalid.mac.address') model.valid? if model.errors.to_hash.key?(attribute) model.errors[attribute].inclu...
github
andrewgr/missing_validators
https://github.com/andrewgr/missing_validators
lib/missing_validators/matchers/ensure_valid_latitude_format_of.rb
Ruby
mit
47
master
583
RSpec::Matchers.define :ensure_valid_latitude_format_of do |attribute| root = 'missing_validators.matchers.ensure_valid_latitude_format_of' match do |model| model.send("#{attribute}=", 90.01) model.valid? if model.errors.to_hash.key?(attribute) model.errors[attribute].include?(I18n.t('errors.mes...
github
andrewgr/missing_validators
https://github.com/andrewgr/missing_validators
lib/missing_validators/matchers/ensure_valid_ip_address_format_of.rb
Ruby
mit
47
master
604
RSpec::Matchers.define :ensure_valid_ip_address_format_of do |attribute| root = 'missing_validators.matchers.ensure_valid_ip_address_format_of' match do |model| model.send("#{attribute}=", 'invalid.ip.address') model.valid? if model.errors.to_hash.key?(attribute) model.errors[attribute].include?...
github
andrewgr/missing_validators
https://github.com/andrewgr/missing_validators
lib/missing_validators/matchers/ensure_valid_email_format_of.rb
Ruby
mit
47
master
592
RSpec::Matchers.define :ensure_valid_email_format_of do |attribute| root = 'missing_validators.matchers.ensure_valid_email_format_of' match do |model| model.send("#{attribute}=", 'invalid@email_address') model.valid? if model.errors.to_hash.key?(attribute) model.errors[attribute].include?(I18n.t...
github
andrewgr/missing_validators
https://github.com/andrewgr/missing_validators
lib/missing_validators/matchers/ensure_valid_longitude_format_of.rb
Ruby
mit
47
master
587
RSpec::Matchers.define :ensure_valid_longitude_format_of do |attribute| root = 'missing_validators.matchers.ensure_valid_longitude_format_of' match do |model| model.send("#{attribute}=", 180.01) model.valid? if model.errors.to_hash.key?(attribute) model.errors[attribute].include?(I18n.t('errors....
github
andrewgr/missing_validators
https://github.com/andrewgr/missing_validators
lib/missing_validators/matchers/ensure_valid_imei_format_of.rb
Ruby
mit
47
master
580
RSpec::Matchers.define :ensure_valid_imei_format_of do |attribute| root = 'missing_validators.matchers.ensure_valid_imei_format_of' match do |model| model.send("#{attribute}=", 'invalid.imei') model.valid? if model.errors.to_hash.key?(attribute) model.errors[attribute].include?(I18n.t('errors.me...
github
andrewgr/missing_validators
https://github.com/andrewgr/missing_validators
lib/missing_validators/matchers/ensure_valid_url_format_of.rb
Ruby
mit
47
master
568
RSpec::Matchers.define :ensure_valid_url_format_of do |attribute| root = 'missing_validators.matchers.ensure_valid_url_format_of' match do |model| model.send("#{attribute}=", ' - ') model.valid? if model.errors.to_hash.key?(attribute) model.errors[attribute].include?(I18n.t('errors.messages.url'...
github
andrewgr/missing_validators
https://github.com/andrewgr/missing_validators
lib/missing_validators/validators/latitude_validator.rb
Ruby
mit
47
master
381
# Checks if the value of an attribute is a valid longitude value. # # @example Validate that the device latitude is valid. # class Device << ActiveRecord::Base # attr_accessor :latitude # validates :latitude, latitude: true # end class LatitudeValidator < BaseValidator private def valid?(latitude, _) ...
github
andrewgr/missing_validators
https://github.com/andrewgr/missing_validators
lib/missing_validators/validators/email_validator.rb
Ruby
mit
47
master
848
# Checks if the value of an attribute is a valid email address. # # @example Validate that the user email is a valid email address. # class User << ActiveRecord::Base # attr_accessor :email, :name # validates :email, email: true # end class EmailValidator < BaseValidator private EMAIL_FORMAT = /\A([^@\...
github
andrewgr/missing_validators
https://github.com/andrewgr/missing_validators
lib/missing_validators/validators/base_validator.rb
Ruby
mit
47
master
789
# Base class for most validators in the gem. # class BaseValidator < ActiveModel::EachValidator # Checks if an attribute value is valid. # # @param [Object] record object to validate # @param [String] attribute name of the object attribute to validate # @param [Object] value attribute value def validate_eac...
github
andrewgr/missing_validators
https://github.com/andrewgr/missing_validators
lib/missing_validators/validators/inequality_validator.rb
Ruby
mit
47
master
278
# Checks if the value of an attribute is equal to a value or proc result. # class InequalityValidator < EqualityValidator private def compare_value(value, reference_value) value != reference_value end def translation_key 'errors.messages.inequality' end end
github
andrewgr/missing_validators
https://github.com/andrewgr/missing_validators
lib/missing_validators/validators/ein_validator.rb
Ruby
mit
47
master
258
class EinValidator < ActiveModel::EachValidator def validate_each(record, attribute, value) record.errors.add(attribute, :invalid) unless valid_ein?(value) end private def valid_ein?(value) (value =~ /(\A\d{2}-\d{7}\Z)/).present? end end
github
andrewgr/missing_validators
https://github.com/andrewgr/missing_validators
lib/missing_validators/validators/mac_address_validator.rb
Ruby
mit
47
master
802
# Checks if the value of an attribute is a valid MAC address. # # @example Validate that the device MAC address is valid. # class Device << ActiveRecord::Base # attr_accessor :mac # validates :mac, mac_address: true # end class MacAddressValidator < BaseValidator private MAC_ADDRESS_FORMATS = [ /^(...
github
andrewgr/missing_validators
https://github.com/andrewgr/missing_validators
lib/missing_validators/validators/ip_address_validator.rb
Ruby
mit
47
master
550
# Checks if the value of an attribute is a valid IP address. # # @example Validate that the device IP address is valid. # class Host << ActiveRecord::Base # attr_accessor :ip # validates :ip, ip_address: true # end class IpAddressValidator < BaseValidator private IP_ADDRESS_FORMATS = [ /^(([0-9]|[0...
github
andrewgr/missing_validators
https://github.com/andrewgr/missing_validators
lib/missing_validators/validators/color_validator.rb
Ruby
mit
47
master
420
# Checks if the value of an attribute is a valid hex color. # # @example Validate that the product color is a valid hex color. # class Product << ActiveRecord::Base # attr_accessor :color # validates :color, color: true # end class ColorValidator < BaseValidator private HEX_COLOR_FORMAT = /^#(?:[0-9a-f...
github
andrewgr/missing_validators
https://github.com/andrewgr/missing_validators
lib/missing_validators/validators/imei_validator.rb
Ruby
mit
47
master
821
# Checks if the value of an attribute is a valid IMEI number. # # @example Validate that a device IMEI number is valid. # class Device << ActiveRecord::Base # attr_accessor :imei # validates :imei, imei: true # end class ImeiValidator < BaseValidator private # 356843052637512 or 35-6843052-637512 or 35...
github
andrewgr/missing_validators
https://github.com/andrewgr/missing_validators
lib/missing_validators/validators/longitude_validator.rb
Ruby
mit
47
master
385
# Checks if the value of an attribute is a valid longitude. # # @example Validate that the device longitude is valid. # class Device << ActiveRecord::Base # attr_accessor :longitude # validates :longitude, longitude: true # end class LongitudeValidator < BaseValidator private def valid?(longitude, _) ...
github
andrewgr/missing_validators
https://github.com/andrewgr/missing_validators
lib/missing_validators/validators/equality_validator.rb
Ruby
mit
47
master
843
# Checks if the value of an attribute is equal to a value or proc result. # class EqualityValidator < ActiveModel::EachValidator # Checks if an attribute value is equal to a value or proc result. # # @param [Object] record object to validate # @param [String] attribute name of the object attribute to validate ...
github
andrewgr/missing_validators
https://github.com/andrewgr/missing_validators
lib/missing_validators/validators/ssn_validator.rb
Ruby
mit
47
master
256
class SsnValidator < ActiveModel::EachValidator def validate_each(record, attribute, value) record.errors.add(attribute, :invalid) if valid_ssn?(value) end private def valid_ssn?(value) (value =~ /(\A\d{3}-\d{2}-\d{4}\Z)/).nil? end end
github
andrewgr/missing_validators
https://github.com/andrewgr/missing_validators
lib/missing_validators/validators/url_validator.rb
Ruby
mit
47
master
1,807
require 'uri' # Checks if the value of an attribute is a valid URL. # # @example Validate that the user's blog URL is valid. # class User << ActiveRecord::Base # attr_accessor :blog, :name # validates :blog, url: true # end class UrlValidator < ActiveModel::EachValidator # Checks if an attribute value is ...
github
andrewgr/missing_validators
https://github.com/andrewgr/missing_validators
lib/missing_validators/validators/zip_code_validator.rb
Ruby
mit
47
master
290
class ZipCodeValidator < ActiveModel::EachValidator def validate_each(record, attribute, value) record.errors.add(attribute, :invalid) unless valid_zip_code?(value) end private def valid_zip_code?(zip_code) (zip_code =~ /(\A\d{5}\Z)|(\A\d{5}-\d{4}\Z)/).present? end end
github
andrewgr/missing_validators
https://github.com/andrewgr/missing_validators
spec/validators/equality_validator_spec.rb
Ruby
mit
47
master
1,394
require 'spec_helper' describe EqualityValidator do subject(:model) { klass.new } describe do let(:klass) do Class.new do include ActiveModel::Validations attr_accessor :origin, :destination, :airline validates :origin, equality: { to: 'MOW' } end end it { is_expec...
github
andrewgr/missing_validators
https://github.com/andrewgr/missing_validators
spec/validators/email_validator_spec.rb
Ruby
mit
47
master
2,284
require 'spec_helper' describe EmailValidator do subject { klass.new } context 'email must be in the valid format' do let(:klass) do Class.new do include ActiveModel::Validations attr_accessor :email, :name validates :email, email: true end end it { is_expected.to ...
github
andrewgr/missing_validators
https://github.com/andrewgr/missing_validators
spec/validators/longitude_validator_spec.rb
Ruby
mit
47
master
803
require 'spec_helper' describe LongitudeValidator do let(:klass) do Class.new do include ActiveModel::Validations attr_accessor :lon, :name validates :lon, longitude: true end end subject { klass.new } it { is_expected.to allow_value(-180).for(:lon) } it { is_expected.to allow_val...
github
andrewgr/missing_validators
https://github.com/andrewgr/missing_validators
spec/validators/latitude_validator_spec.rb
Ruby
mit
47
master
795
require 'spec_helper' describe LatitudeValidator do let(:klass) do Class.new do include ActiveModel::Validations attr_accessor :lat, :name validates :lat, latitude: true end end subject { klass.new } it { is_expected.to allow_value(-90).for(:lat) } it { is_expected.to allow_value(...
github
andrewgr/missing_validators
https://github.com/andrewgr/missing_validators
spec/validators/imei_spec.rb
Ruby
mit
47
master
1,146
require 'spec_helper' describe ImeiValidator do let(:klass) do Class.new do include ActiveModel::Validations attr_accessor :imei, :name validates :imei, imei: true end end subject { klass.new } it { is_expected.to ensure_valid_imei_format_of(:imei) } it { is_expected.not_to ensure...
github
andrewgr/missing_validators
https://github.com/andrewgr/missing_validators
spec/validators/ip_address_validator_spec.rb
Ruby
mit
47
master
642
require 'spec_helper' describe IpAddressValidator do subject { klass.new } context 'ip_address must be in the valid format' do let(:klass) do Class.new do include ActiveModel::Validations attr_accessor :ip, :name validates :ip, ip_address: true end end it { is_expe...
github
andrewgr/missing_validators
https://github.com/andrewgr/missing_validators
spec/validators/mac_address_spec.rb
Ruby
mit
47
master
2,101
require 'spec_helper' describe MacAddressValidator do let(:klass) do Class.new do include ActiveModel::Validations attr_accessor :mac, :name validates :mac, mac_address: true end end subject { klass.new } it { is_expected.to ensure_valid_mac_address_format_of(:mac) } it { is_expec...
github
andrewgr/missing_validators
https://github.com/andrewgr/missing_validators
spec/validators/inequality_validator_spec.rb
Ruby
mit
47
master
1,394
require 'spec_helper' describe InequalityValidator do subject(:model) { klass.new } describe do let(:klass) do Class.new do include ActiveModel::Validations attr_accessor :attr validates :attr, inequality: { to: 'invalid value' } end end it { is_expected.to allow_v...
github
andrewgr/missing_validators
https://github.com/andrewgr/missing_validators
spec/validators/color_validator_spec.rb
Ruby
mit
47
master
465
require 'spec_helper' describe ColorValidator do let(:klass) do Class.new do include ActiveModel::Validations attr_accessor :color validates :color, color: true end end subject { klass.new } it { is_expected.to allow_value('#000000').for(:color) } it { is_expected.to allow_value('...
github
andrewgr/missing_validators
https://github.com/andrewgr/missing_validators
spec/validators/url_validator_spec.rb
Ruby
mit
47
master
4,142
require 'spec_helper' describe UrlValidator do context 'url has valid format' do let(:klass) do Class.new do include ActiveModel::Validations attr_accessor :url, :name validates :url, url: true end end subject { klass.new } it { is_expected.to ensure_valid_url_fo...
github
luciuschoi/bootstrap-tagsinput-rails
https://github.com/luciuschoi/bootstrap-tagsinput-rails
bootstrap-tagsinput-rails.gemspec
Ruby
mit
47
master
1,075
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'bootstrap/tagsinput/rails/version' Gem::Specification.new do |spec| spec.name = "bootstrap-tagsinput-rails" spec.version = Bootstrap::Tagsinput::Rails::VERSION spec.authors ...
github
lsylvester/active_storage-postgresql
https://github.com/lsylvester/active_storage-postgresql
active_storage-postgresql.gemspec
Ruby
mit
47
main
1,112
$:.push File.expand_path("lib", __dir__) # Maintain your gem's version: require "active_storage/postgresql/version" # Describe your gem and declare its dependencies: Gem::Specification.new do |s| s.name = "active_storage-postgresql" s.version = ActiveStorage::PostgreSQL::VERSION s.authors = ["Lac...
github
lsylvester/active_storage-postgresql
https://github.com/lsylvester/active_storage-postgresql
Appraisals
Ruby
mit
47
main
230
appraise "rails-6.0" do gem "rails", "~> 6.0.0" gem 'net-smtp', require: false end appraise "rails-6.1" do gem "rails", "~> 6.1.0" gem 'net-smtp', require: false end appraise "rails-7.0" do gem "rails", "~> 7.0.0" end
github
lsylvester/active_storage-postgresql
https://github.com/lsylvester/active_storage-postgresql
Rakefile
Ruby
mit
47
main
562
begin require 'bundler/setup' rescue LoadError puts 'You must `gem install bundler` and `bundle install` to run rake tasks' end require 'rdoc/task' RDoc::Task.new(:rdoc) do |rdoc| rdoc.rdoc_dir = 'rdoc' rdoc.title = 'Activestorage::PostgreSQL' rdoc.options << '--line-numbers' rdoc.rdoc_files.include('R...
github
lsylvester/active_storage-postgresql
https://github.com/lsylvester/active_storage-postgresql
Gemfile
Ruby
mit
47
main
722
source 'https://rubygems.org' git_source(:github) { |repo| "https://github.com/#{repo}.git" } # Declare your gem's dependencies in activestorage-postgresql.gemspec. # Bundler will treat runtime dependencies like base dependencies, and # development dependencies will be added by default to the :development group. gemsp...
github
lsylvester/active_storage-postgresql
https://github.com/lsylvester/active_storage-postgresql
test/test_helper.rb
Ruby
mit
47
main
2,739
# Configure Rails Environment ENV["RAILS_ENV"] = "test" require_relative "../test/dummy/config/environment" ActiveRecord::Migrator.migrations_paths = [File.expand_path("../test/dummy/db/migrate", __dir__)] require "rails/test_help" require 'database_cleaner' DatabaseCleaner.strategy = :truncation # Filter out Minitest...
github
lsylvester/active_storage-postgresql
https://github.com/lsylvester/active_storage-postgresql
test/active_storage/shared_service_tests.rb
Ruby
mit
47
main
3,327
# frozen_string_literal: true # Copied from ActiveStorage require "test_helper" require "active_support/core_ext/securerandom" module ActiveStorage::Service::SharedServiceTests extend ActiveSupport::Concern FIXTURE_KEY = SecureRandom.base58(24) FIXTURE_DATA = "\211PNG\r\n\032\n\000\000\000\rIHDR\000\000\000\...
github
lsylvester/active_storage-postgresql
https://github.com/lsylvester/active_storage-postgresql
test/active_storage/postgresql_test.rb
Ruby
mit
47
main
2,359
# frozen_string_literal: true require "active_storage/shared_service_tests" class ActiveStorage::Service::PostgreSQLServiceTest < ActiveSupport::TestCase self.use_transactional_tests = false SERVICE = ActiveStorage::Service.configure(:postgresql, {postgresql: {service: "PostgreSQL"}}) setup do if ActiveSto...
github
lsylvester/active_storage-postgresql
https://github.com/lsylvester/active_storage-postgresql
test/active_storage/public_postgresql_test.rb
Ruby
mit
47
main
659
# frozen_string_literal: true require "active_storage/shared_service_tests" require "net/http" class ActiveStorage::Service::PostgreSQLPublicServiceTest < ActiveSupport::TestCase tmp_config = { tmp_public: { service: "PostgreSQL", public: true } } SERVICE = ActiveStorage::Service.configure(:tmp_public, tmp_...
github
lsylvester/active_storage-postgresql
https://github.com/lsylvester/active_storage-postgresql
test/controllers/postgresql_controller_test.rb
Ruby
mit
47
main
5,382
# frozen_string_literal: true require "test_helper" class ActiveStorage::PostgresqlControllerTest < ActionDispatch::IntegrationTest test "showing blob inline" do blob = create_blob(filename: "hello.jpg", content_type: "image/jpeg") get blob.send(url_method) assert_response :ok assert_equal "inline...
github
lsylvester/active_storage-postgresql
https://github.com/lsylvester/active_storage-postgresql
test/dummy/db/schema.rb
Ruby
mit
47
main
1,976
# This file is auto-generated from the current state of the database. Instead # of editing this file, please use the migrations feature of Active Record to # incrementally modify your database, and then regenerate this schema definition. # # Note that this schema.rb definition is the authoritative source for your # dat...
github
lsylvester/active_storage-postgresql
https://github.com/lsylvester/active_storage-postgresql
test/dummy/config/application.rb
Ruby
mit
47
main
578
require_relative 'boot' require 'rails/all' Bundler.require(*Rails.groups) require "active_storage/postgresql" module Dummy class Application < Rails::Application # Initialize configuration defaults for originally generated Rails version. config.load_defaults 5.2 # Settings in config/environments/* ta...
github
lsylvester/active_storage-postgresql
https://github.com/lsylvester/active_storage-postgresql
test/dummy/config/environments/production.rb
Ruby
mit
47
main
3,607
Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. # Code is not reloaded between requests. config.cache_classes = true # Eager load code on boot. This eager loads most of Rails and # your application in memory, allowing both threaded web serve...
github
lsylvester/active_storage-postgresql
https://github.com/lsylvester/active_storage-postgresql
app/controllers/active_storage/postgresql_controller.rb
Ruby
mit
47
main
2,335
# frozen_string_literal: true # Serves files stored with the disk service in the same way that the cloud services do. # This means using expiring, signed URLs that are meant for immediate access, not permanent linking. # Always go through the BlobsController, or your own authenticated controller, rather than directly ...
github
lsylvester/active_storage-postgresql
https://github.com/lsylvester/active_storage-postgresql
db/migrate/20180530020601_create_active_storage_postgresql_tables.rb
Ruby
mit
47
main
232
class CreateActiveStoragePostgresqlTables < ActiveRecord::Migration[5.2] def change create_table :active_storage_postgresql_files do |t| t.oid :oid t.string :key t.index :key, unique: true end end end
github
lsylvester/active_storage-postgresql
https://github.com/lsylvester/active_storage-postgresql
config/routes.rb
Ruby
mit
47
main
333
# frozen_string_literal: true Rails.application.routes.draw do get "/rails/active_storage/postgresql/:encoded_key/*filename" => "active_storage/postgresql#show", as: :rails_postgresql_service put "/rails/active_storage/postgresql/:encoded_token" => "active_storage/postgresql#update", as: :update_rails_postgresql...
github
lsylvester/active_storage-postgresql
https://github.com/lsylvester/active_storage-postgresql
lib/tasks/active_storage/postgresql_tasks.rake
Ruby
mit
47
main
455
# frozen_string_literal: true namespace :active_storage do namespace :postgresql do desc "Copy over the migration needed to the application" task install: :environment do if Rake::Task.task_defined?("active_storage_postgresql:install:migrations") Rake::Task["active_storage_postgresql:install:mi...
github
lsylvester/active_storage-postgresql
https://github.com/lsylvester/active_storage-postgresql
lib/active_storage/service/postgresql_service.rb
Ruby
mit
47
main
4,307
# frozen_string_literal: true module ActiveStorage # Wraps a PostgreSQL database as an Active Storage service. See ActiveStorage::Service for the generic API # documentation that applies to all services. class Service::PostgreSQLService < Service def initialize(public: false, **options) @public = publi...
github
lsylvester/active_storage-postgresql
https://github.com/lsylvester/active_storage-postgresql
lib/active_storage/postgresql/file.rb
Ruby
mit
47
main
1,744
class ActiveStorage::PostgreSQL::File < ActiveRecord::Base self.table_name = "active_storage_postgresql_files" attribute :oid, :integer, default: ->{ connection.raw_connection.lo_creat } attr_accessor :checksum, :io attr_writer :digest def digest @digest ||= Digest::MD5.new end before_create :write...
github
headmandev/passive_columns
https://github.com/headmandev/passive_columns
passive_columns.gemspec
Ruby
mit
47
main
970
$:.push File.expand_path("lib", __dir__) require "passive_columns/version" Gem::Specification.new do |spec| spec.name = 'passive_columns' spec.version = PassiveColumns::VERSION spec.summary = 'A gem that extends Active Record to retrieve columns from a db on demand' spec.description = 'A ge...
github
headmandev/passive_columns
https://github.com/headmandev/passive_columns
Gemfile
Ruby
mit
47
main
219
source "https://rubygems.org" git_source(:github) { |repo| "https://github.com/#{repo}.git" } gemspec gem "sqlite3", "~> 2.1.1" gem "activerecord", "~> 8.1.1" gem "activesupport", "~> 8.1.1" gem "railties", "~> 8.1.1"
github
headmandev/passive_columns
https://github.com/headmandev/passive_columns
lib/passive_columns.rb
Ruby
mit
47
main
5,610
# frozen_string_literal: true require 'passive_columns/railtie' if defined?(Rails::Railtie) require 'passive_columns/loader' # PassiveColumns module is the module # that allows you to skip retrieving the column values from the database by default. # The columns are retrieved only when they are called. # This module i...
github
headmandev/passive_columns
https://github.com/headmandev/passive_columns
lib/passive_columns/railtie.rb
Ruby
mit
47
main
342
# frozen_string_literal: true require 'passive_columns/active_record_relation_extension' module PassiveColumns # :nodoc: class Railtie < Rails::Railtie # :nodoc: config.to_prepare do |_app| ActiveSupport.on_load(:active_record) do ActiveRecord::Relation.prepend ActiveRecordRelationExtension ...
github
headmandev/passive_columns
https://github.com/headmandev/passive_columns
lib/passive_columns/active_record_relation_extension.rb
Ruby
mit
47
main
790
# frozen_string_literal: true module PassiveColumns # ActiveRecordRelationExtension is a module that extends ActiveRecord::Relation # to automatically select all columns except passive columns if no columns are selected. module ActiveRecordRelationExtension if ActiveRecord::VERSION::MAJOR >= 7 def exec...
github
headmandev/passive_columns
https://github.com/headmandev/passive_columns
lib/passive_columns/loader.rb
Ruby
mit
47
main
1,399
# frozen_string_literal: true module PassiveColumns # Loader is a class helper that loads a column value from the database if it is not loaded yet. class Loader attr_reader :passive_columns, :model # @param [ActiveRecord::Base] model # @param [Array<Symbol>] passive_columns def initialize(model, p...
github
headmandev/passive_columns
https://github.com/headmandev/passive_columns
spec/spec_helper.rb
Ruby
mit
47
main
571
# frozen_string_literal: true require_relative 'dummy/config/environment' require 'active_support' require 'active_record' require 'passive_columns' ENV['RAILS_ENV'] = 'test' RSpec.configure do |config| config.order = :random config.formatter = :documentation config.color = true config.around(:each) do |ex...
github
headmandev/passive_columns
https://github.com/headmandev/passive_columns
spec/passive_columns/default_spec.rb
Ruby
mit
47
main
11,276
# frozen_string_literal: true require_relative '../spec_helper' RSpec.describe 'PassiveColumns' do ActiveRecord::Base.logger = Logger.new($stdout) if defined?(ActiveRecord::Base) let(:user) { User.create!(email: 'jello@jello.com', default_project_id: nil) } context 'active record relation' do it 'retrieve...
github
headmandev/passive_columns
https://github.com/headmandev/passive_columns
spec/dummy/config/application.rb
Ruby
mit
47
main
444
# frozen_string_literal: true require_relative 'boot' require 'logger' require 'rails' require 'action_controller/railtie' require 'active_record/railtie' # Require the gems listed in Gemfile, including any gems # you've limited to :test, :development, or :production. Bundler.require(*Rails.groups) module Dummy c...
github
headmandev/passive_columns
https://github.com/headmandev/passive_columns
spec/dummy/db/schema.rb
Ruby
mit
47
main
1,112
# frozen_string_literal: true ActiveRecord::Schema.define(version: 2024_05_06_152000) do create_table :users do |t| t.string 'email', default: '', null: false t.bigint 'default_project_id' end create_table :projects do |t| t.bigint 'user_id', null: false t.string 'name', null: false t.text '...
github
headmandev/passive_columns
https://github.com/headmandev/passive_columns
spec/dummy/app/models/user.rb
Ruby
mit
47
main
311
# frozen_string_literal: true class User < ActiveRecord::Base has_many :projects has_many :projects_with_passive_description, class_name: 'ProjectWithPassiveDescription' belongs_to :default_project, class_name: 'Project', optional: true, inverse_of: :user accepts_nested_attributes_for :projects end
github
headmandev/passive_columns
https://github.com/headmandev/passive_columns
spec/dummy/app/models/email.rb
Ruby
mit
47
main
244
# frozen_string_literal: true class Email < ActiveRecord::Base include PassiveColumns passive_columns :mail has_many :email_items, dependent: :destroy accepts_nested_attributes_for :email_items validates :from, presence: true end
github
headmandev/passive_columns
https://github.com/headmandev/passive_columns
spec/dummy/app/models/email_item.rb
Ruby
mit
47
main
221
# frozen_string_literal: true class EmailItem < ActiveRecord::Base # belongs_to :item, polymorphic: true, optional: false belongs_to :item, polymorphic: true, optional: false belongs_to :email, optional: false end
github
headmandev/passive_columns
https://github.com/headmandev/passive_columns
spec/dummy/app/models/project.rb
Ruby
mit
47
main
806
# frozen_string_literal: true ActiveRecord::Type.register(:project_settings_type, ProjectSettingsType) class Project < ActiveRecord::Base include PassiveColumns passive_columns :guidelines, :description, :settings belongs_to :user has_many :project_items, dependent: :destroy accepts_nested_attributes_for...
github
headmandev/passive_columns
https://github.com/headmandev/passive_columns
spec/dummy/app/types/project_settings_type.rb
Ruby
mit
47
main
1,040
# frozen_string_literal: true class ProjectSettingsType < ActiveRecord::Type::Value class Settings include ActiveModel::Model include ActiveModel::Dirty attr_accessor :color define_attribute_methods :color def initialize(val) if val.is_a?(Settings) super(val.attributes) els...
github
Shadowfiend/awesome_fields
https://github.com/Shadowfiend/awesome_fields
Rakefile
Ruby
mit
47
master
562
require 'rake' require 'rake/testtask' require 'rake/rdoctask' desc 'Default: run shiny unit tests.' task :default => :test desc 'Test the magic_fields plugin.' Rake::TestTask.new(:test) do |t| t.libs << 'lib' t.pattern = 'test/**/*_test.rb' t.verbose = true end desc 'Generate documentation for the magic_field...
github
Shadowfiend/awesome_fields
https://github.com/Shadowfiend/awesome_fields
lib/awesome_fields/awesome_field_helpers.rb
Ruby
mit
47
master
10,282
module AwesomeFields # Contains the helpers used for the awesome_fields plugin. The most relevant # method is the +field+ method, which provides the meat of the functionality # in awesome_fields. Other helpers are present to aid the field method. module AwesomeFieldHelpers # Generates a field for the specif...
github
Shadowfiend/awesome_fields
https://github.com/Shadowfiend/awesome_fields
lib/awesome_fields/lined_builder.rb
Ruby
mit
47
master
7,678
module AwesomeFields # This class presents a builder that provides a per-field block-level element. # The class also takes care of labeling fields, as well as adding errors to # the fields when needed. # # == Label # # Each field method that has been redefined in this builder uses the field # name as a ...
github
Shadowfiend/awesome_fields
https://github.com/Shadowfiend/awesome_fields
lib/awesome_fields/lined_builder_helpers.rb
Ruby
mit
47
master
833
module AwesomeFields # Helpers for the +LinedBuilder+ class for inclusing directly in # +ApplicationHelper+. Allows magic like +lined_form_for+ and # +lined_fields_for+. module LinedBuilderHelpers # Behaves exactly the same as +form_for+, but ensures that the resulting # builder object will be a +LinedB...
github
Shadowfiend/awesome_fields
https://github.com/Shadowfiend/awesome_fields
test/builder_testing.rb
Ruby
mit
47
master
1,758
# Contains methods for testing +FormBuilder+ objects. module BuilderTesting # Renders some code as if it were running in a view within a +form_for+ block # with a `builder' FormBuilder. Returns the resulting output. The FormBuilder is # instantiated for the given model object. No methods are called on this object...
github
Shadowfiend/awesome_fields
https://github.com/Shadowfiend/awesome_fields
test/awesome_field_helpers_test.rb
Ruby
mit
47
master
12,650
require File.join(File.dirname(__FILE__), 'test_helper.rb') require File.join(File.dirname(__FILE__), 'builder_testing') require File.join(File.dirname(__FILE__), 'ar_mocking') require 'test_help' require 'mocha' # A controller used for testing; contains only one action, dubbed +test_action+, # which may be rewritten ...
github
Shadowfiend/awesome_fields
https://github.com/Shadowfiend/awesome_fields
test/test_helper.rb
Ruby
mit
47
master
1,288
RAILS_ENV = 'test' require File.expand_path(File.join(File.dirname(__FILE__), '../../../../config/environment.rb')) require 'test/spec' module Test::Spec; module Rails; end; end # +ShouldSelect+ and +ShouldNotSelect+ are borrowed from the TechnoWeenie # test/spec On Rails plugin # (http://svn.techno-weenie.net/projec...
github
Shadowfiend/awesome_fields
https://github.com/Shadowfiend/awesome_fields
test/ar_mocking.rb
Ruby
mit
47
master
492
# A mock ActiveRecord class whose instances will appear to be AR objects but # never interact with the database. module ARMocking # Instantiates a mock ActiveRecord object with the specified list of # attributes returning the specified values. def mock_ar_with(attributes = {}) obj = stub obj.stubs(:is_a?)...
github
zethussuen/epic-editor-rails
https://github.com/zethussuen/epic-editor-rails
epic-editor-rails-4.gemspec
Ruby
mit
47
master
716
# -*- encoding: utf-8 -*- require File.expand_path('../lib/epic-editor-rails/version', __FILE__) Gem::Specification.new do |gem| gem.authors = ["zethus"] gem.email = ["zethus.suen@gmail.com"] gem.description = "Rails 3.2/4.x asset gem for EpicEditor" gem.summary = "Rails 3.2/4.x asset gem...