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 | cqfn/pdd | https://github.com/cqfn/pdd | lib/pdd/rule/estimates.rb | Ruby | mit | 84 | master | 1,211 | # SPDX-FileCopyrightText: Copyright (c) 2014-2026 Yegor Bugayenko
# SPDX-License-Identifier: MIT
module PDD
module Rule
module Estimate
# Rule for min estimate.
class Min
# Ctor.
# +xml+:: XML with puzzles
def initialize(xml, min)
@xml = xml
@min = min.to_i... |
github | cqfn/pdd | https://github.com/cqfn/pdd | test/test_roles.rb | Ruby | mit | 84 | master | 1,102 | # SPDX-FileCopyrightText: Copyright (c) 2014-2026 Yegor Bugayenko
# SPDX-License-Identifier: MIT
require 'nokogiri'
require_relative 'test__helper'
require_relative '../lib/pdd/rule/roles'
# PDD::Rule::Role module tests.
# Author:: Yegor Bugayenko (yegor256@gmail.com)
# Copyright:: Copyright (c) 2014-2026 Yegor Bugay... |
github | cqfn/pdd | https://github.com/cqfn/pdd | test/test_estimates.rb | Ruby | mit | 84 | master | 863 | # SPDX-FileCopyrightText: Copyright (c) 2014-2026 Yegor Bugayenko
# SPDX-License-Identifier: MIT
require 'nokogiri'
require_relative 'test__helper'
require_relative '../lib/pdd/rule/estimates'
# PDD::Rule::Estimate module tests.
# Author:: Yegor Bugayenko (yegor256@gmail.com)
# Copyright:: Copyright (c) 2014-2026 Yeg... |
github | cqfn/pdd | https://github.com/cqfn/pdd | test/test_rake_task.rb | Ruby | mit | 84 | master | 519 | # SPDX-FileCopyrightText: Copyright (c) 2014-2026 Yegor Bugayenko
# SPDX-License-Identifier: MIT
require 'tmpdir'
require 'rake'
require_relative 'test__helper'
require_relative '../lib/pdd/rake_task'
# Test for RakeTask
class TestRakeTask < Minitest::Test
def test_basic
Dir.mktmpdir 'test' do |dir|
file ... |
github | cqfn/pdd | https://github.com/cqfn/pdd | test/test_text.rb | Ruby | mit | 84 | master | 665 | # SPDX-FileCopyrightText: Copyright (c) 2014-2026 Yegor Bugayenko
# SPDX-License-Identifier: MIT
require 'nokogiri'
require_relative 'test__helper'
require_relative '../lib/pdd/rule/text'
# PDD::Rule::Text module tests.
# Author:: Yegor Bugayenko (yegor256@gmail.com)
# Copyright:: Copyright (c) 2014-2026 Yegor Bugaye... |
github | cqfn/pdd | https://github.com/cqfn/pdd | test/test_duplicates.rb | Ruby | mit | 84 | master | 941 | # SPDX-FileCopyrightText: Copyright (c) 2014-2026 Yegor Bugayenko
# SPDX-License-Identifier: MIT
require 'nokogiri'
require_relative 'test__helper'
require_relative '../lib/pdd/rule/duplicates'
# PDD::Rule::MaxDuplicates class test.
# Author:: Yegor Bugayenko (yegor256@gmail.com)
# Copyright:: Copyright (c) 2014-2026... |
github | cqfn/pdd | https://github.com/cqfn/pdd | test/test_pdd.rb | Ruby | mit | 84 | master | 2,573 | # SPDX-FileCopyrightText: Copyright (c) 2014-2026 Yegor Bugayenko
# SPDX-License-Identifier: MIT
require 'nokogiri'
require 'tmpdir'
require 'slop'
require_relative 'test__helper'
require_relative '../lib/pdd'
# PDD main module test.
# Author:: Yegor Bugayenko (yegor256@gmail.com)
# Copyright:: Copyright (c) 2014-202... |
github | cqfn/pdd | https://github.com/cqfn/pdd | test/test_sources.rb | Ruby | mit | 84 | master | 3,260 | # SPDX-FileCopyrightText: Copyright (c) 2014-2026 Yegor Bugayenko
# SPDX-License-Identifier: MIT
require 'fileutils'
require 'tmpdir'
require_relative '../test/test__helper'
require_relative '../lib/pdd/sources'
# Sources test.
# Author:: Yegor Bugayenko (yegor256@gmail.com)
# Copyright:: Copyright (c) 2014-2026 Yego... |
github | cqfn/pdd | https://github.com/cqfn/pdd | test/test__helper.rb | Ruby | mit | 84 | master | 1,274 | # SPDX-FileCopyrightText: Copyright (c) 2014-2026 Yegor Bugayenko
# SPDX-License-Identifier: MIT
$stdout.sync = true
require 'simplecov'
require 'simplecov-cobertura'
unless SimpleCov.running
SimpleCov.command_name('test')
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new(
[
SimpleCov::Form... |
github | cqfn/pdd | https://github.com/cqfn/pdd | test/test_many.rb | Ruby | mit | 84 | master | 800 | # SPDX-FileCopyrightText: Copyright (c) 2014-2026 Yegor Bugayenko
# SPDX-License-Identifier: MIT
require 'tmpdir'
require_relative 'test__helper'
require_relative '../lib/pdd'
require_relative '../lib/pdd/sources'
# Test many puzzles to make sure their IDs are correct.
# Author:: Yegor Bugayenko (yegor256@gmail.com)
... |
github | cqfn/pdd | https://github.com/cqfn/pdd | test/test_source.rb | Ruby | mit | 84 | master | 11,393 | # SPDX-FileCopyrightText: Copyright (c) 2014-2026 Yegor Bugayenko
# SPDX-License-Identifier: MIT
require 'tmpdir'
require_relative '../lib/pdd'
require_relative '../lib/pdd/sources'
require_relative 'test__helper'
# Source test.
# Author:: Yegor Bugayenko (yegor256@gmail.com)
# Copyright:: Copyright (c) 2014-2026 Yeg... |
github | cqfn/pdd | https://github.com/cqfn/pdd | test/test_bin.rb | Ruby | mit | 84 | master | 1,010 | # SPDX-FileCopyrightText: Copyright (c) 2014-2026 Yegor Bugayenko
# SPDX-License-Identifier: MIT
require 'qbash'
require_relative 'test__helper'
require_relative '../lib/pdd'
# Test pdd as shell executable bin.
# Author:: Yegor Bugayenko (yegor256@gmail.com)
# Copyright:: Copyright (c) 2014-2026 Yegor Bugayenko
# Lic... |
github | cqfn/pdd | https://github.com/cqfn/pdd | test/test_source_todo.rb | Ruby | mit | 84 | master | 5,788 | # SPDX-FileCopyrightText: Copyright (c) 2014-2026 Yegor Bugayenko
# SPDX-License-Identifier: MIT
require 'tmpdir'
require_relative '../lib/pdd'
require_relative '../lib/pdd/sources'
require_relative 'test__helper'
class TestSourceTodo < Minitest::Test
def check_valid_puzzle(text, lines, body, ticket, count = 1)
... |
github | cqfn/pdd | https://github.com/cqfn/pdd | utils/glob.rb | Ruby | mit | 84 | master | 991 | # SPDX-FileCopyrightText: Copyright (c) 2014-2026 Yegor Bugayenko
# SPDX-License-Identifier: MIT
# Utility glob class
class Glob
NO_LEADING_DOT = '(?=[^\.])'.freeze
def initialize(glob_string)
@glob_string = glob_string
end
# rubocop:disable Metrics/CyclomaticComplexity
def to_regexp
chars = @glob_... |
github | gzigzigzeo/carrierwave-meta | https://github.com/gzigzigzeo/carrierwave-meta | carrierwave-meta.gemspec | Ruby | mit | 84 | master | 1,316 | # -*- encoding: utf-8 -*-
$:.push File.expand_path("../lib", __FILE__)
require "carrierwave-meta/version"
Gem::Specification.new do |s|
s.name = "carrierwave-meta"
s.version = Carrierwave::Meta::VERSION
s.authors = ["Victor Sokolov"]
s.email = ["gzigzigzi@gmail.com"]
s.homepage = "htt... |
github | gzigzigzeo/carrierwave-meta | https://github.com/gzigzigzeo/carrierwave-meta | lib/carrierwave-meta.rb | Ruby | mit | 84 | master | 274 | require 'active_support/concern'
require 'active_support/core_ext/module/attribute_accessors'
require 'mime/types'
require 'carrierwave-meta/version'
require 'carrierwave-meta/model_delegate_attribute'
require 'carrierwave-meta/meta'
require 'carrierwave-meta/active_record' |
github | gzigzigzeo/carrierwave-meta | https://github.com/gzigzigzeo/carrierwave-meta | lib/carrierwave-meta/model_delegate_attribute.rb | Ruby | mit | 84 | master | 1,646 | module CarrierWave
module ModelDelegateAttribute
extend ::ActiveSupport::Concern
module ClassMethods
def model_delegate_attribute(attribute, default = nil)
attr_accessor attribute
before :remove, :"reset_#{attribute}"
var_name = :"@#{attribute}"
define_getter(attribut... |
github | gzigzigzeo/carrierwave-meta | https://github.com/gzigzigzeo/carrierwave-meta | lib/carrierwave-meta/meta.rb | Ruby | mit | 84 | master | 3,070 | module CarrierWave
module Meta
extend ActiveSupport::Concern
mattr_accessor :ghostscript_enabled
self.ghostscript_enabled = false
included do
include CarrierWave::ModelDelegateAttribute
include CarrierWave::MimeTypes
set_content_type(true)
after :retrieve_from_cache, :set_c... |
github | gzigzigzeo/carrierwave-meta | https://github.com/gzigzigzeo/carrierwave-meta | lib/carrierwave-meta/active_record.rb | Ruby | mit | 84 | master | 651 | module CarrierWave
module Meta
module ActiveRecord
ALLOWED = %w(width height md5sum image_size file_size content_type)
def carrierwave_meta_composed(single_attribute, *args)
defined_attrs = args.map do |arg|
name, to_define = if arg.is_a?(Symbol)
[arg, ALLOWED]
... |
github | gzigzigzeo/carrierwave-meta | https://github.com/gzigzigzeo/carrierwave-meta | spec/spec_helper.rb | Ruby | mit | 84 | master | 919 | $LOAD_PATH << "." unless $LOAD_PATH.include?(".")
require 'rubygems'
require 'bundler/setup'
require 'simplecov'
require 'mime/types'
require 'carrierwave'
require 'carrierwave/orm/activerecord'
require 'support/remote'
require 'support/current_processor'
require 'active_record'
require 'support/schema'
SimpleCov.sta... |
github | gzigzigzeo/carrierwave-meta | https://github.com/gzigzigzeo/carrierwave-meta | spec/modules/meta_spec.rb | Ruby | mit | 84 | master | 4,954 | require 'spec_helper'
require 'mime/types'
describe TestUploader do
let(:obj) { TestModel.new }
IMAGE_FILE_NAME = "spec/fixtures/big.jpg"
EPS_FILE_NAME = "spec/fixtures/sample.eps"
PDF_FILE_NAME = "spec/fixtures/sample.pdf"
FORMATS = {
image: {
original_size: [600, 277],
version_size: [200,... |
github | gzigzigzeo/carrierwave-meta | https://github.com/gzigzigzeo/carrierwave-meta | spec/modules/active_record_spec.rb | Ruby | mit | 84 | master | 855 | require 'spec_helper'
describe CarrierWave::Meta::ActiveRecord do
let(:model) { TestComposedModel.new }
let(:model_with_image) do
model.tap do |m|
m.image = File.open('spec/fixtures/big.jpg')
m.save!
end
end
it "model's virtual meta attributes must exists" do
subject::ALLOWED.each do |... |
github | gzigzigzeo/carrierwave-meta | https://github.com/gzigzigzeo/carrierwave-meta | spec/modules/model_delegate_attribute_spec.rb | Ruby | mit | 84 | master | 2,109 | require 'spec_helper'
describe TestDelegateUploader do
let(:values) { subject.class::VALUES }
let(:default_values) { subject.class::DEFAULT_VALUES }
let(:file) { File.open("spec/fixtures/big.jpg") }
let(:obj) { TestModel.new }
before do
obj.destroyed = false
end
def uploader_values_are_correct(uplo... |
github | gzigzigzeo/carrierwave-meta | https://github.com/gzigzigzeo/carrierwave-meta | spec/support/current_processor.rb | Ruby | mit | 84 | master | 398 | module CurrentProcessor
extend ::ActiveSupport::Concern
included do
case PROCESSOR
when :image_sorcery
require 'carrierwave-imagesorcery'
include CarrierWave::ImageSorcery
when :vips
require 'carrierwave-vips'
include CarrierWave::Vips
when :mini_magick
include Carrier... |
github | gzigzigzeo/carrierwave-meta | https://github.com/gzigzigzeo/carrierwave-meta | spec/support/test_composed_model.rb | Ruby | mit | 84 | master | 246 | class TestComposedModel < ActiveRecord::Base
extend CarrierWave::Meta::ActiveRecord
mount_uploader :image, TestUploader
serialize :image_meta, OpenStruct
carrierwave_meta_composed :image_meta, :image, image_version: [:width, :height]
end |
github | gzigzigzeo/carrierwave-meta | https://github.com/gzigzigzeo/carrierwave-meta | spec/support/test_delegate_uploader.rb | Ruby | mit | 84 | master | 773 | class TestDelegateUploader < CarrierWave::Uploader::Base
VALUES = {
:x => 5,
:version_x => 10,
:dimensions => [1, 1],
:version_dimensions => [2, 2]
}
DEFAULT_VALUES = {
:x => 0,
:dimensions => []
}
def store_dir
"tmp/store"
end
def cache_dir
"tmp/cache"
end
include ... |
github | gzigzigzeo/carrierwave-meta | https://github.com/gzigzigzeo/carrierwave-meta | spec/support/test_model.rb | Ruby | mit | 84 | master | 615 | class TestModel
attr_accessor :image_x
attr_accessor :image_version_x
attr_accessor :image_dimensions
attr_accessor :image_version_dimensions
attr_accessor :image_width
attr_accessor :image_height
attr_accessor :image_image_size
attr_accessor :image_content_type
attr_accessor :image_file_size
attr_... |
github | gzigzigzeo/carrierwave-meta | https://github.com/gzigzigzeo/carrierwave-meta | spec/support/remote.rb | Ruby | mit | 84 | master | 782 | if ENV['STORAGE'] == 'fog'
Fog.mock!
Fog.credentials = {
:provider => 'AWS',
:aws_access_key_id => 'xxx',
:aws_secret_access_key => 'yyy',
:region => 'eu-west-1',
:host => 's3.example.com',
:endpoint => 'https://s3.example.... |
github | gzigzigzeo/carrierwave-meta | https://github.com/gzigzigzeo/carrierwave-meta | spec/support/test_uploader.rb | Ruby | mit | 84 | master | 322 | class TestUploader < CarrierWave::Uploader::Base
include CurrentProcessor
include CarrierWave::Meta
def store_dir
"tmp/store"
end
def cache_dir
"tmp/cache"
end
process :store_meta => [{md5sum: true}]
version :version do
process :resize_to_fill => [200, 200]
process :store_meta
end
e... |
github | gzigzigzeo/carrierwave-meta | https://github.com/gzigzigzeo/carrierwave-meta | spec/support/test_blank_uploader.rb | Ruby | mit | 84 | master | 213 | class TestBlankUploader < CarrierWave::Uploader::Base
include CurrentProcessor
include CarrierWave::Meta
def store_dir
"tmp/store"
end
def cache_dir
"tmp/cache"
end
process :store_meta
end |
github | gzigzigzeo/carrierwave-meta | https://github.com/gzigzigzeo/carrierwave-meta | spec/support/schema.rb | Ruby | mit | 84 | master | 250 | ActiveRecord::Base.establish_connection(:adapter => "sqlite3", :database => ":memory:")
ActiveRecord::Schema.define :version => 1 do
create_table "test_composed_models", :force => true do |t|
t.string :image
t.text :image_meta
end
end |
github | ConradIrwin/console.log | https://github.com/ConradIrwin/console.log | console.log.gemspec | Ruby | mit | 84 | master | 450 | Gem::Specification.new do |s|
s.name = "console.log"
s.version = "0.2.0"
s.platform = Gem::Platform::RUBY
s.author = "Conrad Irwin"
s.email = "conrad.irwin@gmail.com"
s.license = "MIT"
s.homepage = "http://github.com/ConradIrwin/console.log"
s.summary = "Port of console.log to ruby"
s.description = "A... |
github | ConradIrwin/console.log | https://github.com/ConradIrwin/console.log | lib/console.log/core_ext.rb | Ruby | mit | 84 | master | 316 | module ConsoleLog
module CoreExt
# This is a method_missing because `be rails c` does
# wierd stuff with console methods.
def method_missing(name)
if name.to_s == "console"
LSpace[:console] ||= Console.new
else
super
end
end
end
end
include ConsoleLog::CoreExt |
github | ConradIrwin/console.log | https://github.com/ConradIrwin/console.log | lib/console.log/middleware.rb | Ruby | mit | 84 | master | 480 | module ConsoleLog
class Middleware
def initialize(app)
@app = app
end
def call(env)
LSpace.with(:console => Console::Buffered.new) do
result = @app.call(env)
_, headers, response = result
if headers['Content-Type'] =~ %r{text/html} && response.respond_to?(:body=) && L... |
github | ConradIrwin/console.log | https://github.com/ConradIrwin/console.log | lib/console.log/console.rb | Ruby | mit | 84 | master | 1,102 | module ConsoleLog
class Console
def log(*args)
puts(*args)
end
alias warn log
alias error log
def assert(bool, msg)
puts msg unless bool
end
def dir(a)
puts a.inspect
end
class Buffered < Console
include Enumerable
def initialize
@buffer =... |
github | uniiverse/apollo-tracing-ruby | https://github.com/uniiverse/apollo-tracing-ruby | apollo-tracing.gemspec | Ruby | mit | 84 | master | 1,375 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'apollo_tracing/version'
Gem::Specification.new do |spec|
spec.name = "apollo-tracing"
spec.version = ApolloTracing::VERSION
spec.authors = ["Reginald Suh", "Evgeny Li"]... |
github | uniiverse/apollo-tracing-ruby | https://github.com/uniiverse/apollo-tracing-ruby | spec/apollo_tracing_spec.rb | Ruby | mit | 84 | master | 4,801 | require "spec_helper"
require 'fixtures/user'
require 'fixtures/post'
require 'fixtures/schema'
require 'fixtures/broken_schema'
RSpec.describe ApolloTracing do
describe '.start_proxy' do
it 'runs a proxy' do
pid = ApolloTracing.start_proxy('spec/fixtures/apollo-engine-proxy.json')
expect { Process.... |
github | uniiverse/apollo-tracing-ruby | https://github.com/uniiverse/apollo-tracing-ruby | spec/spec_helper.rb | Ruby | mit | 84 | master | 283 | require "bundler/setup"
require "pry"
require "apollo_tracing"
RSpec.configure do |config|
# Enable flags like --only-failures and --next-failure
config.example_status_persistence_file_path = ".rspec_status"
config.expect_with :rspec do |c|
c.syntax = :expect
end
end |
github | uniiverse/apollo-tracing-ruby | https://github.com/uniiverse/apollo-tracing-ruby | lib/apollo_tracing.rb | Ruby | mit | 84 | master | 3,058 | # frozen_string_literal: true
require "graphql"
require "apollo_tracing/version"
class ApolloTracing
def self.start_proxy(config_filepath_or_json = 'config/apollo-engine.json')
config_json =
if File.exist?(config_filepath_or_json)
File.read(config_filepath_or_json)
else
config_filepa... |
github | jpablobr/active_paypal_adaptive_payment | https://github.com/jpablobr/active_paypal_adaptive_payment | active_paypal_adaptive_payment.gemspec | Ruby | mit | 84 | master | 890 | # encoding: utf-8
Gem::Specification.new do |s|
s.name = "active_paypal_adaptive_payment"
s.version = '0.3.16'
s.platform = Gem::Platform::RUBY
s.authors = ["Jose Pablo Barrantes"]
s.email = ["xjpablobrx@gmail.com"]
s.homepage = "http://github.com/jpablobr/active_paypal_adaptive_p... |
github | jpablobr/active_paypal_adaptive_payment | https://github.com/jpablobr/active_paypal_adaptive_payment | lib/active_paypal_adaptive_payment.rb | Ruby | mit | 84 | master | 320 | # encoding: utf-8
require 'active_merchant'
require File.dirname(__FILE__) + '/active_merchant/billing/gateways/paypal_adaptive_payment'
require File.dirname(__FILE__) + '/active_merchant/billing/integrations/paypal_adaptive_payment'
require File.dirname(__FILE__) + '/active_merchant/billing/integrations/notification' |
github | jpablobr/active_paypal_adaptive_payment | https://github.com/jpablobr/active_paypal_adaptive_payment | lib/active_merchant/billing/gateways/paypal_adaptive_payment_common.rb | Ruby | mit | 84 | master | 995 | module ActiveMerchant
module Billing
module PaypalAdaptivePaymentCommon
def self.included(base)
base.cattr_accessor :test_redirect_url
base.cattr_accessor :live_redirect_url
base.cattr_accessor :test_redirect_pre_approval_url
base.cattr_accessor :live_redirect_pre_approval_ur... |
github | jpablobr/active_paypal_adaptive_payment | https://github.com/jpablobr/active_paypal_adaptive_payment | lib/active_merchant/billing/gateways/paypal_adaptive_payment.rb | Ruby | mit | 84 | master | 16,203 | # -*- coding: utf-8 -*-
require 'money'
require File.dirname(__FILE__) + '/paypal_adaptive_payments/ext'
require File.dirname(__FILE__) + '/paypal_adaptive_payment_common'
require File.dirname(__FILE__) + '/paypal_adaptive_payments/exceptions'
require File.dirname(__FILE__) + '/paypal_adaptive_payments/adaptive_payment... |
github | jpablobr/active_paypal_adaptive_payment | https://github.com/jpablobr/active_paypal_adaptive_payment | lib/active_merchant/billing/gateways/paypal_adaptive_payments/exceptions.rb | Ruby | mit | 84 | master | 276 | class ConfigDoesNotExist < StandardError; end;
class AttributenotFound < StandardError; end;
class PaypalAdaptivePaymentsApiError < StandardError
attr_reader :response
def initialize response
@response = response
end
def debug
@response.inspect
end
end |
github | jpablobr/active_paypal_adaptive_payment | https://github.com/jpablobr/active_paypal_adaptive_payment | lib/active_merchant/billing/gateways/paypal_adaptive_payments/adaptive_payment_response.rb | Ruby | mit | 84 | master | 1,176 | require 'multi_json'
require 'hashie'
module ActiveMerchant
module Billing
class AdaptivePaymentResponse < Response
SUCCESS = 'Success'.freeze
attr_reader :json, :request, :action, :response, :xml_request
alias :raw :json
alias :raw_request :xml_request
def initialize(json, xml_r... |
github | jpablobr/active_paypal_adaptive_payment | https://github.com/jpablobr/active_paypal_adaptive_payment | lib/active_merchant/billing/gateways/paypal_adaptive_payments/ext.rb | Ruby | mit | 84 | master | 706 | # -*- encoding: utf-8 -*-
# https://github.com/tallgreentree/rash/blob/master/lib/hashie/rash.rb
require 'hashie/mash'
module Hashie
class Rash < Mash
protected
def convert_key(key)
underscore_string(key.to_s)
end
# converts a camel_cased string to a underscore string
# subs s... |
github | jpablobr/active_paypal_adaptive_payment | https://github.com/jpablobr/active_paypal_adaptive_payment | lib/active_merchant/billing/integrations/paypal_adaptive_payment.rb | Ruby | mit | 84 | master | 1,351 | # encoding: utf-8
module ActiveMerchant
module Billing
module Integrations
module PaypalAdaptivePayment
autoload :Return, 'active_merchant/billing/integrations/paypal_adaptive_payment/return.rb'
autoload :Helper, 'active_merchant/billing/integrations/paypal_adaptive_payment/helper.rb'
... |
github | jpablobr/active_paypal_adaptive_payment | https://github.com/jpablobr/active_paypal_adaptive_payment | lib/active_merchant/billing/integrations/notification.rb | Ruby | mit | 84 | master | 463 | # encoding: utf-8
module ActiveMerchant
module Billing
module Integrations
class Notification
private
# Take the posted data and move the relevant data into a hash
def parse(post)
@raw = post.to_s
for line in @raw.split('&')
key, value = CGI.unescape... |
github | jpablobr/active_paypal_adaptive_payment | https://github.com/jpablobr/active_paypal_adaptive_payment | lib/active_merchant/billing/integrations/paypal_adaptive_payment/notification.rb | Ruby | mit | 84 | master | 4,185 | # encoding: utf-8
require 'net/http'
module ActiveMerchant
module Billing
module Integrations
module PaypalAdaptivePayment
# Parser and handler for incoming Instant payment notifications from paypal.
# The Example shows a typical handler in a rails application. Note that this
# is a... |
github | jpablobr/active_paypal_adaptive_payment | https://github.com/jpablobr/active_paypal_adaptive_payment | lib/active_merchant/billing/integrations/paypal_adaptive_payment/return.rb | Ruby | mit | 84 | master | 207 | module ActiveMerchant
module Billing
module Integrations
module PaypalAdaptivePayment
class Return < ActiveMerchant::Billing::Integrations::Return
end
end
end
end
end |
github | jpablobr/active_paypal_adaptive_payment | https://github.com/jpablobr/active_paypal_adaptive_payment | lib/active_merchant/billing/integrations/paypal_adaptive_payment/helper.rb | Ruby | mit | 84 | master | 233 | # encoding: utf-8
module ActiveMerchant
module Billing
module Integrations
module PaypalAdaptivePayment
class Helper < ActiveMerchant::Billing::Integrations::Paypal::Helper
end
end
end
end
end |
github | jpablobr/active_paypal_adaptive_payment | https://github.com/jpablobr/active_paypal_adaptive_payment | test/test_paypal_adaptive_payment.rb | Ruby | mit | 84 | master | 2,620 | require_relative 'test_helper'
class TestPaypalAdaptivePayment < MiniTest::Unit::TestCase
def setup
@gateway = ActiveMerchant::Billing::PaypalAdaptivePayment.new(fixtures(:credentials))
end
def test_successful_pay
assert response = @gateway.setup_purchase(fixtures(:pay_options))
assert_equal true, ... |
github | jpablobr/active_paypal_adaptive_payment | https://github.com/jpablobr/active_paypal_adaptive_payment | test/test_helper.rb | Ruby | mit | 84 | master | 1,379 | # encoding: utf-8
$:.unshift File.expand_path('../../lib', __FILE__)
require 'yaml'
require 'mocha'
require 'minitest/autorun'
require 'active_merchant'
require 'active_paypal_adaptive_payment'
ActiveMerchant::Billing::Base.mode = :test
module MiniTest
class Unit
class TestCase
private
def preapp... |
github | jpablobr/active_paypal_adaptive_payment | https://github.com/jpablobr/active_paypal_adaptive_payment | test/unit/integration/notifications/paypal_adaptive_payment_notification_test.rb | Ruby | mit | 84 | master | 3,986 | # encoding: utf-8
require '../../../test_helper'
class PaypalAdaptivePaymentNotificationTest < MiniTest::Unit::TestCase
include ActiveMerchant::Billing::Integrations
def setup
@paypal = PaypalAdaptivePayment::Notification.new(http_raw_data)
end
def test_accessors
assert @paypal.complete?
assert_e... |
github | phildionne/associates | https://github.com/phildionne/associates | Rakefile | Ruby | mit | 84 | master | 219 | require 'bundler'
require 'rake'
require 'bundler/gem_tasks'
require 'rspec/core/rake_task'
task default: :spec
desc 'Run all specs'
RSpec::Core::RakeTask.new(:spec) do |task|
task.pattern = 'spec/**/*_spec.rb'
end |
github | phildionne/associates | https://github.com/phildionne/associates | Gemfile | Ruby | mit | 84 | master | 259 | source 'https://rubygems.org'
gem 'bundler', '~> 1.3'
gem 'rake'
group :development do
gem 'pry'
gem 'byebug'
gem 'guard-rspec', require: false
end
group :test do
gem 'coveralls', require: false
gem 'rspec', '~> 3.0'
gem 'sqlite3'
end
gemspec |
github | phildionne/associates | https://github.com/phildionne/associates | associates.gemspec | Ruby | mit | 84 | master | 963 | # encoding: utf-8
$:.unshift File.expand_path('../lib', __FILE__)
require 'associates/version'
Gem::Specification.new do |s|
s.name = "associates"
s.version = Associates::VERSION
s.authors = ["Philippe Dionne"]
s.email = ["dionne.phil@gmail.com"]
s.homepage = "https://githu... |
github | phildionne/associates | https://github.com/phildionne/associates | spec/associates_spec.rb | Ruby | mit | 84 | master | 7,208 | require 'spec_helper'
describe Associates do
include_context "associates_setup"
let(:guest_order) { GuestOrder.new }
describe :ModuleMethods do
describe :configure do
it "yields the module" do
expect { |b| Associates.configure(&b) }.to yield_control
end
end
describe :blackli... |
github | phildionne/associates | https://github.com/phildionne/associates | spec/spec_helper.rb | Ruby | mit | 84 | master | 580 | require 'coveralls'
Coveralls.wear!
require 'bundler/setup'
require 'rspec'
require 'sqlite3'
require 'associates'
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].map(&method(:require))
Dir["#{File.dirname(__FILE__)}/factories.rb"].map(&method(:require))
RSpec.configure do |config|
config.include DatabaseMacros... |
github | phildionne/associates | https://github.com/phildionne/associates | spec/factories.rb | Ruby | mit | 84 | master | 247 | Factory.define :guest_order do |f|
f.username = 'phildionne'
f.password = '123456789'
f.product = 'surfboard'
end
Factory.define :invalid_guest_order, class: 'GuestOrder' do |f|
f.username = nil
f.password = nil
f.product = nil
end |
github | phildionne/associates | https://github.com/phildionne/associates | spec/associates/validations_spec.rb | Ruby | mit | 84 | master | 2,492 | require 'spec_helper'
describe Associates::Validations do
include_context "associates_setup"
describe :InstanceMethods do
describe :valid? do
context "with a valid associate" do
let(:guest_order) { Factory.build(:guest_order) }
it { expect(guest_order.valid?).to be_truthy }
... |
github | phildionne/associates | https://github.com/phildionne/associates | spec/associates/persitence_spec.rb | Ruby | mit | 84 | master | 2,576 | require 'spec_helper'
describe Associates::Persistence do
include_context "associates_setup"
describe :InstanceMethods do
describe :save do
context "with a valid associate" do
let(:guest_order) { Factory.build(:guest_order) }
it { expect(guest_order.save).to be_truthy }
it "... |
github | phildionne/associates | https://github.com/phildionne/associates | spec/support/factory.rb | Ruby | mit | 84 | master | 974 | class Factory
cattr_accessor :factories, instance_writer: false
self.factories = Hash.new { |hash, key| hash[key] = {} }
def self.define(name, options = {}, &block)
self.factories[name][:options] = options
self.factories[name][:definition] = block
end
def self.build(name, attributes = {})
ne... |
github | phildionne/associates | https://github.com/phildionne/associates | spec/support/database.rb | Ruby | mit | 84 | master | 565 | module Database
def self.database_file
@database_file || File.expand_path('../test.db', __FILE__)
end
def self.setup
create
# Hide migration logs
ActiveRecord::Migration.verbose = false
ActiveRecord::Base.establish_connection(adapter: 'sqlite3', database: database_file)
end
def self.c... |
github | phildionne/associates | https://github.com/phildionne/associates | spec/support/helpers.rb | Ruby | mit | 84 | master | 537 | module Helpers
# Undefine methods for a given associate or all
#
# @param name [Symbol, String]
def reset_associate!(name = nil)
if name
associate = associates.find { |assoc| assoc.name == name.to_s }
methods = associate.attribute_names
associates.reject! { |assoc| assoc.name == name.to_s... |
github | phildionne/associates | https://github.com/phildionne/associates | spec/support/macros/model_macros.rb | Ruby | mit | 84 | master | 431 | module ModelMacros
# Create a new model class
# @note taken from https://github.com/mirego/partisan/blob/master/spec/support/macros/model_macros.rb
def spawn_class(klass_name, parent_klass, &block)
Object.instance_eval { remove_const klass_name } if Object.const_defined?(klass_name)
Object.const_set(klas... |
github | phildionne/associates | https://github.com/phildionne/associates | spec/support/macros/database_macros.rb | Ruby | mit | 84 | master | 449 | module DatabaseMacros
# @note Taken from https://github.com/mirego/partisan/blob/master/spec/support/macros/database_macros.rb
def run_migration(&block)
# Create a new migration class
klass = Class.new(ActiveRecord::Migration)
# Create a new `up` that executes the argument
klass.send(:define_metho... |
github | phildionne/associates | https://github.com/phildionne/associates | spec/support/shared/associates_setup.rb | Ruby | mit | 84 | master | 1,037 | shared_context 'associates_setup' do
before do
run_migration do
create_table(:users, force: true) do |t|
t.string :username
t.string :password
end
create_table(:orders, force: true) do |t|
t.references :user
end
create_table(:payments, force: true) do |t|... |
github | phildionne/associates | https://github.com/phildionne/associates | lib/associates.rb | Ruby | mit | 84 | master | 6,941 | require 'active_support/concern'
require 'associates/version'
require 'associates/persistence'
require 'associates/validations'
module Associates
extend ActiveSupport::Concern
included do
if ActiveModel.version >= Gem::Version.new("4.0.0")
include ActiveModel::Model
else
extend ActiveModel::N... |
github | phildionne/associates | https://github.com/phildionne/associates | lib/associates/validations.rb | Ruby | mit | 84 | master | 1,088 | module Associates
module Validations
extend ActiveSupport::Concern
included do
alias_method_chain :valid?, :associates
end
module ClassMethods
end
# Runs the model validations plus the associated models validations and
# merges each messages in the errors hash
#
# @return ... |
github | phildionne/associates | https://github.com/phildionne/associates | lib/associates/persistence.rb | Ruby | mit | 84 | master | 893 | require 'active_record'
module Associates
module Persistence
extend ActiveSupport::Concern
included do
end
module ClassMethods
end
# Persists each associated model
#
# @return [Boolean] Wether or not all models are valid and persited
def save(*args)
return false unless va... |
github | basecamp/activestorage-office-previewer | https://github.com/basecamp/activestorage-office-previewer | activestorage-office-previewer.gemspec | Ruby | mit | 84 | master | 841 | Gem::Specification.new do |s|
s.name = "activestorage-office-previewer"
s.version = "0.1.2"
s.authors = "George Claghorn"
s.email = "george@basecamp.com"
s.summary = "Active Storage previewer for Microsoft Office files based on LibreOffice"
s.homepage = "https://github.com/basecamp/activestorage-o... |
github | basecamp/activestorage-office-previewer | https://github.com/basecamp/activestorage-office-previewer | lib/activestorage-office-previewer.rb | Ruby | mit | 84 | master | 258 | require "active_storage"
require "active_storage/previewer/office_previewer"
if defined?(Rails)
require "active_storage/engine"
class ActiveStorage::Engine
config.active_storage.previewers += [ ActiveStorage::Previewer::OfficePreviewer ]
end
end |
github | basecamp/activestorage-office-previewer | https://github.com/basecamp/activestorage-office-previewer | lib/active_storage/previewer/office_previewer.rb | Ruby | mit | 84 | master | 1,610 | require "active_storage/previewer"
class ActiveStorage::Previewer::OfficePreviewer < ActiveStorage::Previewer
ACCEPTABLE_CONTENT_TYPES = [
"application/msword", # .doc
"application/vnd.openxmlformats-officedocument.wordprocessingml.document", # .docx
"application/vnd.ms-powerpoint", # .ppt
"applicat... |
github | basecamp/activestorage-office-previewer | https://github.com/basecamp/activestorage-office-previewer | test/test_helper.rb | Ruby | mit | 84 | master | 569 | ENV["RAILS_ENV"] ||= "test"
require_relative "dummy/config/environment.rb"
require "active_support/testing/autorun"
require "activestorage-office-previewer"
class ActiveSupport::TestCase
self.file_fixture_path = File.expand_path("fixtures/files", __dir__)
private
def create_file_blob(key: nil, filename: "ra... |
github | basecamp/activestorage-office-previewer | https://github.com/basecamp/activestorage-office-previewer | test/office_previewer_test.rb | Ruby | mit | 84 | master | 2,096 | require "test_helper"
require "database/setup"
require "vips"
require "marcel"
class ActiveStorage::Previewer::OfficePreviewerTest < ActiveSupport::TestCase
test "previewing a Word document" do
blob = create_file_blob \
filename: "hello.docx",
content_type: "application/vnd.openxmlformats-officedocu... |
github | basecamp/activestorage-office-previewer | https://github.com/basecamp/activestorage-office-previewer | test/database/setup.rb | Ruby | mit | 84 | master | 238 | require "active_record"
ActiveRecord::Base.establish_connection \
adapter: "sqlite3", database: ":memory:"
migrations_path = File.expand_path("../dummy/db/migrate", __dir__)
ActiveRecord::MigrationContext.new(migrations_path).migrate |
github | basecamp/activestorage-office-previewer | https://github.com/basecamp/activestorage-office-previewer | test/dummy/config/environments/test.rb | Ruby | mit | 84 | master | 1,908 | # The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that
# your test database is "scratch space" for the test suite and is wiped
# and recreated between test runs. Don't rely on the data there!
Rails.application.configure do
# Settings... |
github | basecamp/activestorage-office-previewer | https://github.com/basecamp/activestorage-office-previewer | test/dummy/db/migrate/20191204133417_create_active_storage_tables.active_storage.rb | Ruby | mit | 84 | master | 1,344 | # This migration comes from active_storage (originally 20170806125915)
class CreateActiveStorageTables < ActiveRecord::Migration[7.2]
def change
create_table :active_storage_blobs do |t|
t.string :key, null: false
t.string :service_name, null: false
t.string :filename, null: f... |
github | ckdake/setler | https://github.com/ckdake/setler | Appraisals | Ruby | mit | 84 | main | 552 | appraise "rails-4" do
gem "rails", "4.2.11.1"
gem "sqlite3", "1.3.13"
end
appraise "rails-5" do
gem "rails", "5.2.3"
gem "sqlite3", "1.5.4"
gem "mimemagic", "0.3.10"
end
appraise "rails-6" do
gem "rails", "6.1.7.9"
gem "sqlite3", "1.5.4"
gem "concurrent-ruby", "1.3.4"
gem "bigdecimal", "3.3.1"
end
... |
github | ckdake/setler | https://github.com/ckdake/setler | Rakefile | Ruby | mit | 84 | main | 505 | # encoding: utf-8
require 'rubygems'
require 'bundler/setup'
require 'bundler/gem_tasks'
require 'rake'
require 'rake/testtask'
require 'appraisal'
Rake::TestTask.new(:test) do |test|
test.libs << 'lib' << 'test'
test.pattern = 'test/**/*_test.rb'
test.verbose = true
end
desc 'Default'
task :default do
if E... |
github | ckdake/setler | https://github.com/ckdake/setler | setler.gemspec | Ruby | mit | 84 | main | 1,978 | # -*- encoding: utf-8 -*-
$:.push File.expand_path("../lib", __FILE__)
require "setler/version"
Gem::Specification.new do |s|
s.name = "setler"
s.version = Setler::VERSION
s.authors = ["Chris Kelly"]
s.email = ["ckdake@ckdake.com"]
s.license = 'MIT'
s.homepage = "https://github.... |
github | ckdake/setler | https://github.com/ckdake/setler | test/test_helper.rb | Ruby | mit | 84 | main | 1,577 | require 'rubygems'
require 'simplecov'
SimpleCov.start 'rails'
require 'bundler'
begin
Bundler.setup(:default, :development)
rescue Bundler::BundlerError => e
$stderr.puts e.message
$stderr.puts "Run `bundle install` to install missing gems"
exit e.status_code
end
require 'rails'
require 'active_record'
requ... |
github | ckdake/setler | https://github.com/ckdake/setler | test/settings_test.rb | Ruby | mit | 84 | main | 5,219 | require 'test_helper'
class ::SettingsTest < Minitest::Test
setup_db
def setup
::Settings.create(:var => 'test', :value => 'foo')
::Settings.create(:var => 'test2', :value => 'bar')
end
def teardown
::Settings.delete_all
::Settings.defaults = {}.with_indifferent_access
::Preferences.del... |
github | ckdake/setler | https://github.com/ckdake/setler | lib/setler.rb | Ruby | mit | 84 | main | 263 | require 'active_record'
require_relative 'setler/version'
require_relative 'setler/exceptions'
require_relative 'setler/settings'
require_relative 'setler/scoped_settings'
require_relative 'setler/active_record'
::ActiveRecord::Base.extend Setler::ActiveRecord |
github | ckdake/setler | https://github.com/ckdake/setler | lib/setler/scoped_settings.rb | Ruby | mit | 84 | main | 570 | module Setler
class ScopedSettings < Settings
def self.for_thing(object, scopename)
self.table_name = scopename
self.defaults = settings_constantize(scopename).defaults
@object = object
self
end
def self.thing_scoped
self.base_class.where(thing_type: @object.class.base_class... |
github | ckdake/setler | https://github.com/ckdake/setler | lib/setler/settings.rb | Ruby | mit | 84 | main | 2,422 | require 'rails/version'
module Setler
class Settings < ActiveRecord::Base
serialize :value
self.abstract_class = true
def self.defaults
@defaults ||= {}.with_indifferent_access
end
def self.defaults=(defaults)
@defaults = defaults.with_indifferent_access
end
if Rails::VERSI... |
github | ckdake/setler | https://github.com/ckdake/setler | lib/setler/active_record.rb | Ruby | mit | 84 | main | 200 | module Setler
module ActiveRecord
def has_setler(scopename = 'settings')
define_method scopename do
Setler::ScopedSettings.for_thing(self, scopename)
end
end
end
end |
github | ckdake/setler | https://github.com/ckdake/setler | lib/generators/setler/setler_generator.rb | Ruby | mit | 84 | main | 807 | require 'rails/generators/migration'
class SetlerGenerator < Rails::Generators::NamedBase
include Rails::Generators::Migration
argument :name, type: :string, default: "settings"
source_root File.expand_path('../templates', __FILE__)
@@migrations = false
def self.next_migration_number(dirname)
if Acti... |
github | ckdake/setler | https://github.com/ckdake/setler | lib/generators/setler/templates/migration.rb | Ruby | mit | 84 | main | 566 | class SetlerCreate<%= table_name.camelize %> < ActiveRecord::Migration
def self.up
create_table(:<%= table_name %>) do |t|
t.string :var, null: false
t.text :value, null: true
t.integer :thing_id, null: true
t.string :thing_type, limit: 30, null: true
t.timestamps
end
a... |
github | thoughtbot/art_vandelay | https://github.com/thoughtbot/art_vandelay | art_vandelay.gemspec | Ruby | mit | 84 | main | 925 | require_relative "lib/art_vandelay/version"
Gem::Specification.new do |spec|
spec.name = "art_vandelay"
spec.version = ArtVandelay::VERSION
spec.required_ruby_version = ArtVandelay::MINIMUM_RUBY_VERSION
spec.authors = ["Steve Polito"]
spec.email = ["stevepolito@hey.com"]
spec.homepage = "https://github.com... |
github | thoughtbot/art_vandelay | https://github.com/thoughtbot/art_vandelay | Gemfile | Ruby | mit | 84 | main | 663 | source "https://rubygems.org"
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
# Specify your gem's dependencies in art_vandelay.gemspec.
gemspec
# Start debugger with binding.b [https://github.com/ruby/debug]
# gem "debug", ">= 1.0.0"
#
rails_version = ENV.fetch("RAILS_VERSION", "7.0")
rails_constrai... |
github | thoughtbot/art_vandelay | https://github.com/thoughtbot/art_vandelay | test/art_vandelay_test.rb | Ruby | mit | 84 | main | 26,586 | require "test_helper"
require "csv"
class ArtVandelayTest < ActiveSupport::TestCase
class VERSION < ArtVandelayTest
test "it has a version number" do
assert ArtVandelay::VERSION
end
test "it has a supported Rails version" do
assert_equal ">= 7.0", ArtVandelay::RAILS_VERSION
end
test... |
github | thoughtbot/art_vandelay | https://github.com/thoughtbot/art_vandelay | test/dummy/config/application.rb | Ruby | mit | 84 | main | 790 | require_relative "boot"
require "rails/all"
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)
require "art_vandelay"
module Dummy
class Application < Rails::Application
config.load_defaults Rails::VERSION::STRING.to_... |
github | thoughtbot/art_vandelay | https://github.com/thoughtbot/art_vandelay | test/dummy/db/schema.rb | Ruby | mit | 84 | main | 1,047 | # 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.
#
# This file is the source Rails uses to define your schema when running `bin/rai... |
github | thoughtbot/art_vandelay | https://github.com/thoughtbot/art_vandelay | test/dummy/db/migrate/20221008115344_create_users.rb | Ruby | mit | 84 | main | 296 | class CreateUsers < ActiveRecord::Migration["#{Rails::VERSION::MAJOR}.#{Rails::VERSION::MINOR}"]
def change
create_table :users do |t|
t.string :email, null: false
t.string :password, null: false
t.timestamps
end
add_index :users, :email, unique: true
end
end |
github | thoughtbot/art_vandelay | https://github.com/thoughtbot/art_vandelay | lib/art_vandelay.rb | Ruby | mit | 84 | main | 7,296 | require "art_vandelay/version"
require "art_vandelay/engine"
require "csv"
module ArtVandelay
mattr_accessor :filtered_attributes, :from_address, :in_batches_of
@@filtered_attributes = [:passw, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn]
@@in_batches_of = 10000
def self.setup
yield se... |
github | rom-rb/rom-factory | https://github.com/rom-rb/rom-factory | Gemfile | Ruby | mit | 84 | main | 946 | # frozen_string_literal: true
source "https://rubygems.org"
gemspec
eval_gemfile "Gemfile.devtools"
gem "faker", "~> 3.0"
gem "rspec", "~> 3.0"
gem "dotenv"
git "https://github.com/rom-rb/rom.git", branch: "release-5.4" do
gem "rom"
gem "rom-changeset"
gem "rom-core"
gem "rom-repository"
end
group :test... |
github | rom-rb/rom-factory | https://github.com/rom-rb/rom-factory | rom-factory.gemspec | Ruby | mit | 84 | main | 1,502 | # frozen_string_literal: true
lib = File.expand_path("lib", __dir__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require "rom/factory/version"
Gem::Specification.new do |spec|
spec.name = "rom-factory"
spec.version = ROM::Factory::VERSION
spec.authors = ["Janis Miezitis", "Piotr... |
github | rom-rb/rom-factory | https://github.com/rom-rb/rom-factory | spec/spec_helper.rb | Ruby | mit | 84 | main | 1,560 | # frozen_string_literal: true
require_relative "support/coverage"
require "dotenv"
Dotenv.load(".postgres.env", ".env")
require "pathname"
SPEC_ROOT = root = Pathname(__FILE__).dirname
require "rom-factory"
%w[debug byebug pry].each do |debugger|
require debugger
rescue LoadError
# ignore
else
break
end
requ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.