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
NullVoxPopuli/skinny_controllers
https://github.com/NullVoxPopuli/skinny_controllers
spec/support/rails_app/config/environment.rb
Ruby
mit
86
master
210
# frozen_string_literal: true # Load the Rails application. require File.expand_path('../application', __FILE__) require 'skinny_controllers' # Initialize the Rails application. Rails.application.initialize!
github
NullVoxPopuli/skinny_controllers
https://github.com/NullVoxPopuli/skinny_controllers
spec/support/rails_app/config/application.rb
Ruby
mit
86
master
1,009
# frozen_string_literal: true require File.expand_path('../boot', __FILE__) require 'rails/all' # Require the gems listed in Gemfile, including any gems # you've limited to :test, :development, or :production. Bundler.require(*Rails.groups) module RailsApp class Application < Rails::Application # Settings in c...
github
NullVoxPopuli/skinny_controllers
https://github.com/NullVoxPopuli/skinny_controllers
spec/support/rails_app/config/routes.rb
Ruby
mit
86
master
2,120
# frozen_string_literal: true Rails.application.routes.draw do resources :users namespace :api do namespace :v2 do resources :posts end end resources :no_operations resources :strong_parameters resources :discounts do member do get :refund_payment end end resources :event_s...
github
NullVoxPopuli/skinny_controllers
https://github.com/NullVoxPopuli/skinny_controllers
spec/support/rails_app/config/environments/test.rb
Ruby
mit
86
master
1,785
# frozen_string_literal: true Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. # 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 "sc...
github
NullVoxPopuli/skinny_controllers
https://github.com/NullVoxPopuli/skinny_controllers
spec/support/rails_app/db/schema.rb
Ruby
mit
86
master
1,531
# encoding: UTF-8 # 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 sou...
github
NullVoxPopuli/skinny_controllers
https://github.com/NullVoxPopuli/skinny_controllers
spec/support/rails_app/app/models/user.rb
Ruby
mit
86
master
213
# frozen_string_literal: true class User < ActiveRecord::Base has_many :events # realistically, you'd only want users to be able to access themselves def is_accessible_to?(user) id == user.id end end
github
NullVoxPopuli/skinny_controllers
https://github.com/NullVoxPopuli/skinny_controllers
spec/support/rails_app/app/models/super_item.rb
Ruby
mit
86
master
212
# frozen_string_literal: true class SuperItem < ActiveRecord::Base self.inheritance_column = 'item_type' has_many :other_items, class_name: SuperItem::OtherItem.name, foreign_key: 'reference_id' end
github
NullVoxPopuli/skinny_controllers
https://github.com/NullVoxPopuli/skinny_controllers
spec/support/rails_app/app/controllers/event_summaries_controller.rb
Ruby
mit
86
master
212
# frozen_string_literal: true class EventSummariesController < ApplicationController include SkinnyControllers::Diet skinny_controllers_config model_class: Event def show render json: model end end
github
NullVoxPopuli/skinny_controllers
https://github.com/NullVoxPopuli/skinny_controllers
spec/support/rails_app/app/controllers/items_controller.rb
Ruby
mit
86
master
446
# frozen_string_literal: true class ItemsController < ApplicationController include SkinnyControllers::Diet skinny_controllers_config model_class: SuperItem::Item, model_params_key: 'item' # GET /users/1 def show render json: model end # DELETE /users/1 def destroy r...
github
NullVoxPopuli/skinny_controllers
https://github.com/NullVoxPopuli/skinny_controllers
spec/support/rails_app/app/controllers/no_operations_controller.rb
Ruby
mit
86
master
205
# frozen_string_literal: true class NoOperationsController < ApplicationController include SkinnyControllers::Diet def show render json: model end def create render json: model end end
github
NullVoxPopuli/skinny_controllers
https://github.com/NullVoxPopuli/skinny_controllers
spec/support/rails_app/app/controllers/other_items_controller.rb
Ruby
mit
86
master
670
# frozen_string_literal: true class OtherItemsController < ApplicationController include SkinnyControllers::Diet skinny_controllers_config model_class: SuperItem::OtherItem, model_params_key: 'other_item' def index # TODO: make this implicit model = operation_class.new(curren...
github
NullVoxPopuli/skinny_controllers
https://github.com/NullVoxPopuli/skinny_controllers
spec/support/rails_app/app/controllers/users_controller.rb
Ruby
mit
86
master
236
# frozen_string_literal: true class UsersController < ApplicationController include SkinnyControllers::Diet # GET /users/1 def show render json: model end # DELETE /users/1 def destroy render json: model end end
github
NullVoxPopuli/skinny_controllers
https://github.com/NullVoxPopuli/skinny_controllers
spec/support/rails_app/app/controllers/strong_parameters_controller.rb
Ruby
mit
86
master
384
# frozen_string_literal: true class StrongParametersController < ApplicationController include SkinnyControllers::Diet skinny_controllers_config model_class: Event def create render json: model end def update render json: model end def update_event_params params[:event].permit(:name) end...
github
NullVoxPopuli/skinny_controllers
https://github.com/NullVoxPopuli/skinny_controllers
spec/support/rails_app/app/controllers/requires_parent_controller.rb
Ruby
mit
86
master
735
# frozen_string_literal: true class RequiresParentController < ApplicationController include SkinnyControllers::Diet skinny_controllers_config model_class: Discount, parent_class: Event, association_name: :discounts def index model = create_operation(...
github
NullVoxPopuli/skinny_controllers
https://github.com/NullVoxPopuli/skinny_controllers
spec/support/rails_app/app/controllers/application_controller.rb
Ruby
mit
86
master
319
# frozen_string_literal: true class ApplicationController < ActionController::Base # Prevent CSRF attacks by raising an exception. # For APIs, you may want to use :null_session instead. protect_from_forgery with: :exception # some fake helpers here attr_writer :current_user attr_reader :current_user end
github
NullVoxPopuli/skinny_controllers
https://github.com/NullVoxPopuli/skinny_controllers
spec/support/rails_app/app/controllers/events_controller.rb
Ruby
mit
86
master
691
# frozen_string_literal: true class EventsController < ApplicationController include SkinnyControllers::Diet # respond_to :json def index render json: model end def show render json: model end def create render json: model end def update render json: model end def destroy ...
github
NullVoxPopuli/skinny_controllers
https://github.com/NullVoxPopuli/skinny_controllers
spec/support/rails_app/app/controllers/json_api_events_controller.rb
Ruby
mit
86
master
551
# frozen_string_literal: true class JsonApiEventsController < ApplicationController include SkinnyControllers::Diet skinny_controllers_config model_class: Event def index render json: model end def show render json: model end def create render json: model end def update render jso...
github
NullVoxPopuli/skinny_controllers
https://github.com/NullVoxPopuli/skinny_controllers
spec/support/rails_app/app/controllers/discounts_controller.rb
Ruby
mit
86
master
347
# frozen_string_literal: true class DiscountsController < ApplicationController include SkinnyControllers::Diet # GET /events # # renders an array of Events def index render json: model end # GET /events/1 # # renders one event def show render json: model end def refund_payment re...
github
NullVoxPopuli/skinny_controllers
https://github.com/NullVoxPopuli/skinny_controllers
spec/support/rails_app/app/operations/discount_operations.rb
Ruby
mit
86
master
246
# frozen_string_literal: true module DiscountOperations class Read < SkinnyControllers::Operation::Base def run model end end class RefundPayment < SkinnyControllers::Operation::Base def run model end end end
github
NullVoxPopuli/skinny_controllers
https://github.com/NullVoxPopuli/skinny_controllers
spec/support/rails_app/app/operations/user_operations.rb
Ruby
mit
86
master
371
# frozen_string_literal: true module UserOperations class Read < SkinnyControllers::Operation::Base def run model if allowed? end end class ReadAll < SkinnyControllers::Operation::Base def run model if allowed? end end class Delete < SkinnyControllers::Operation::Base def run...
github
NullVoxPopuli/skinny_controllers
https://github.com/NullVoxPopuli/skinny_controllers
spec/support/rails_app/app/policies/event_policy.rb
Ruby
mit
86
master
407
# frozen_string_literal: true class EventPolicy < SkinnyControllers::Policy::Base def read?(_o = object) # for testing, in real life, this is implicit, and # the method does not even need to be defined true end def throw_away? # for testing action => verb translation # # default is true, ...
github
NullVoxPopuli/skinny_controllers
https://github.com/NullVoxPopuli/skinny_controllers
spec/support/rails_app/app/policies/user_policy.rb
Ruby
mit
86
master
263
# frozen_string_literal: true class UserPolicy < SkinnyControllers::Policy::DenyAll # exceptions to the DenyAll rule may be defined here # allow if we are deleting ourselves / cancelling our account def delete? object.is_accessible_to?(user) end end
github
NullVoxPopuli/skinny_controllers
https://github.com/NullVoxPopuli/skinny_controllers
spec/support/operations/example_operations.rb
Ruby
mit
86
master
309
# frozen_string_literal: true module ExampleOperations class ReadAll < SkinnyControllers::Operation::Base def run model end end class Read < SkinnyControllers::Operation::Base def run model if allowed? end end class Update < SkinnyControllers::Operation::Base end end
github
kenn/standby
https://github.com/kenn/standby
standby.gemspec
Ruby
mit
86
master
992
# -*- encoding: utf-8 -*- lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'standby/version' Gem::Specification.new do |gem| gem.name = 'standby' gem.version = Standby::VERSION gem.authors = ['Kenn Ejima'] gem.email = ['kenn...
github
kenn/standby
https://github.com/kenn/standby
spec/configuration_spec.rb
Ruby
mit
86
master
2,783
require 'spec_helper' describe 'configuration' do before do # Backup connection and configs @backup_conn = (Standby.instance_variable_get(:@standby_connections) || {}).dup # Rails 6.1+ wraps configurations in ActiveRecord::DatabaseConfigurations. if ActiveRecord::Base.configurations.respond_to?(:conf...
github
kenn/standby
https://github.com/kenn/standby
spec/standby_spec.rb
Ruby
mit
86
master
3,129
require 'spec_helper' describe Standby do def standby_value Thread.current[:_standby] end def on_standby? standby_value == :standby end it 'sets thread local' do Standby.on_primary { expect(standby_value).to be :primary } Standby.on_standby { expect(standby_value).to be :standby } Stand...
github
kenn/standby
https://github.com/kenn/standby
spec/spec_helper.rb
Ruby
mit
86
master
1,572
require 'rubygems' require 'bundler/setup' ENV['RACK_ENV'] = 'test' require 'standby' ActiveRecord::Base.configurations = { 'test' => { 'adapter' => 'sqlite3', 'database' => 'spec/db/test_db' }, 'test_standby' => { 'adapter' => 'sqlite3', 'database' => 'spec/db/test_standby_one' }, 'test_stan...
github
kenn/standby
https://github.com/kenn/standby
spec/active_record/log_subscriber_spec.rb
Ruby
mit
86
master
839
require 'spec_helper' require 'logger' describe ActiveRecord::LogSubscriber do describe 'logging' do let(:log) { StringIO.new } let(:logger) { Logger.new(log) } before do ActiveRecord::Base.logger = logger @backup_disabled = Standby.disabled end after do Standby.disabled = @...
github
kenn/standby
https://github.com/kenn/standby
lib/standby.rb
Ruby
mit
86
master
880
require 'logger' require 'active_record' require 'standby/version' require 'standby/base' require 'standby/error' require 'standby/connection_holder' require 'standby/transaction' require 'standby/active_record/base' require 'standby/active_record/connection_handling' require 'standby/active_record/relation' require 's...
github
kenn/standby
https://github.com/kenn/standby
lib/standby/transaction.rb
Ruby
mit
86
master
693
module Standby class Transaction # The methods on ActiveSupport::TestCase which can potentially be used # to determine if transactional fixtures are enabled TEST_CONFIG_METHODS = [ :use_transactional_tests, :use_transactional_fixtures ] class << self def base_depth @base...
github
kenn/standby
https://github.com/kenn/standby
lib/standby/connection_holder.rb
Ruby
mit
86
master
1,238
module Standby class ConnectionHolder < ActiveRecord::Base self.abstract_class = true class << self # for delayed activation def activate(target) env_name = "#{ActiveRecord::ConnectionHandling::RAILS_ENV.call}_#{target}" # Rails 6.1+ exposes DatabaseConfigurations helpers; older v...
github
kenn/standby
https://github.com/kenn/standby
lib/standby/base.rb
Ruby
mit
86
master
1,018
module Standby class Base def initialize(target) @target = decide_with(target) end def run(&block) run_on @target, &block end private def decide_with(target) if Standby.disabled || target == :primary :primary elsif inside_transaction? raise Standby::Err...
github
kenn/standby
https://github.com/kenn/standby
lib/standby/active_record/relation.rb
Ruby
mit
86
master
665
module ExecQueriesWithStandbyTarget # Supports queries like User.on_standby.to_a def exec_queries if standby_target Standby.on_standby(standby_target) { super } else super end end end module ActiveRecord class Relation attr_accessor :standby_target # Supports queries like User....
github
kenn/standby
https://github.com/kenn/standby
lib/standby/active_record/base.rb
Ruby
mit
86
master
1,081
module ActiveRecord class Base class << self alias_method :connection_pool_without_standby, :connection_pool alias_method :connection_without_standby, :connection def connection_pool case Thread.current[:_standby] when :primary, NilClass connection_pool_without_standby...
github
kenn/standby
https://github.com/kenn/standby
lib/standby/active_record/log_subscriber.rb
Ruby
mit
86
master
540
require 'standby/version' module ActiveRecord class LogSubscriber alias_method :debug_without_standby, :debug def debug(msg) db = Standby.disabled ? '' : log_header debug_without_standby(db + msg) end def log_header if Standby.version_gte?('7.1') color("[#{Thread.current[...
github
benbalter/markdown_to_word
https://github.com/benbalter/markdown_to_word
markdown_to_word.gemspec
Ruby
mit
86
master
1,187
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'markdown_to_word/version' Gem::Specification.new do |spec| spec.name = "markdown_to_word" spec.version = MarkdownToWord::VERSION spec.authors = ["Ben Balter"] spec.em...
github
benbalter/markdown_to_word
https://github.com/benbalter/markdown_to_word
spec/markdown_to_word_conversion_spec.rb
Ruby
mit
86
master
433
require "spec_helper" describe "MarkdownToWord Conversion" do it "converts unumbered lists" do md = fixture("ul") as_docx(md) do |docx| as_markdown(docx) do |ouput| expect(ouput).to eql(md.strip) end end end it "converts numbered lists" do md = fixture("ol") as_docx(md) ...
github
benbalter/markdown_to_word
https://github.com/benbalter/markdown_to_word
spec/markdown_to_word_bin_spec.rb
Ruby
mit
86
master
567
require "spec_helper" describe "MarkdownToWord binary" do it "returns the help" do output, status = Open3.capture2e "bundle", "exec", "m2w" expect(output).to eql("Usage: bundle exec m2w [markdown]\n") end it "returns the version" do output, status = Open3.capture2e "bundle", "exec", "m2w", "--versio...
github
benbalter/markdown_to_word
https://github.com/benbalter/markdown_to_word
spec/spec_helper.rb
Ruby
mit
86
master
549
require "bundler/setup" require 'word-to-markdown' require 'open3' require_relative "../lib/markdown_to_word" def fixture_path(fixture) File.expand_path "./fixtures/#{fixture}.md", File.dirname(__FILE__) end def fixture(fixture) path = fixture_path(fixture) File.open(path).read end def as_markdown(contents, &b...
github
benbalter/markdown_to_word
https://github.com/benbalter/markdown_to_word
spec/markdown_to_word_spec.rb
Ruby
mit
86
master
513
require "spec_helper" describe MarkdownToWord do it "converts the file" do content = subject.convert("# Test").contents as_markdown(content) { |md| expect(md).to eql("# Test") } end it "returns the default template" do template_dir = MarkdownToWord.default_templates_path expect(template_dir).to ...
github
benbalter/markdown_to_word
https://github.com/benbalter/markdown_to_word
spec/markdown_to_word_document_spec.rb
Ruby
mit
86
master
800
require "spec_helper" describe MarkdownToWord::Document do subject do MarkdownToWord::Document.new("# Test") end it "stores the markdown" do expect(subject.markdown).to eql("# Test") end it "converts the html" do expect(subject.send(:raw_html)).to eql("<h1>Test</h1>") end it "makes it a v...
github
benbalter/markdown_to_word
https://github.com/benbalter/markdown_to_word
lib/markdown_to_word.rb
Ruby
mit
86
master
430
require 'html/pipeline' require 'htmltoword' require 'digest' require_relative "markdown_to_word/version" require_relative "markdown_to_word/document" module MarkdownToWord def self.convert(markdown) Document.new(markdown) end def self.default_templates_path File.expand_path "./markdown_to_word", File....
github
benbalter/markdown_to_word
https://github.com/benbalter/markdown_to_word
lib/markdown_to_word/document.rb
Ruby
mit
86
master
735
module MarkdownToWord class Document attr_accessor :template, :html # https://github.com/jekyll/jekyll/blob/master/lib/jekyll/document.rb#L9 YAML_FRONT_MATTER_REGEXP = /\A(---\s*\n.*?\n?)^((---|\.\.\.)\s*$\n?)/m def initialize(markdown="") @raw_markdown = markdown end def markdown ...
github
takahashim/md2review
https://github.com/takahashim/md2review
md2review.gemspec
Ruby
mit
86
master
951
# -*- encoding: utf-8 -*- lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'md2review/version' Gem::Specification.new do |gem| gem.name = "md2review" gem.version = MD2ReVIEW::VERSION gem.authors = ["takahashim"] gem.email = ...
github
takahashim/md2review
https://github.com/takahashim/md2review
Rakefile
Ruby
mit
86
master
250
require "bundler/gem_tasks" require 'rake/testtask' require 'rubocop/rake_task' Rake::TestTask.new('test:unit') do |t| t.test_files = FileList['test/*_test.rb'] end RuboCop::RakeTask.new task default: [:test, :rubocop] task test: ['test:unit']
github
takahashim/md2review
https://github.com/takahashim/md2review
test/review_test.rb
Ruby
mit
86
master
11,197
# coding: utf-8 rootdir = File.dirname(File.dirname(__FILE__)) $LOAD_PATH.unshift "#{rootdir}/lib" require 'coveralls' Coveralls.wear! if defined? Encoding Encoding.default_internal = 'UTF-8' end require 'test/unit' require 'md2review' require 'md2review/markdown' class ReVIEWTest < Test::Unit::TestCase def se...
github
takahashim/md2review
https://github.com/takahashim/md2review
lib/redcarpet/render/review.rb
Ruby
mit
86
master
8,542
require 'digest/md5' require 'uri' module Redcarpet module Render class ReVIEW < Base def initialize(render_extensions={}) super() @table_num = 0 @table_id_prefix = "tbl" @header_offset = 0 @link_in_footnote = render_extensions[:link_in_footnote] @image_capt...
github
takahashim/md2review
https://github.com/takahashim/md2review
lib/md2review/markdown.rb
Ruby
mit
86
master
368
require 'redcarpet' require 'redcarpet/render/review' module MD2ReVIEW class Markdown def initialize(render_options, parser_options) ## Redcarpet only render = Redcarpet::Render::ReVIEW.new(render_options) @markdown = Redcarpet::Markdown.new(render, parser_options) end def render(text)...
github
amatsuda/interactive_rspec
https://github.com/amatsuda/interactive_rspec
interactive_rspec.gemspec
Ruby
mit
86
master
794
# -*- encoding: utf-8 -*- $:.push File.expand_path('../lib', __FILE__) require 'interactive_rspec/version' Gem::Specification.new do |s| s.name = 'interactive_rspec' s.version = InteractiveRspec::VERSION s.authors = ['Akira Matsuda'] s.email = ['ronnie@dio.jp'] s.homepage = 'https://g...
github
amatsuda/interactive_rspec
https://github.com/amatsuda/interactive_rspec
lib/interactive_rspec.rb
Ruby
mit
86
master
3,534
require 'interactive_rspec/version' require 'rspec' require 'irb' require 'irb/completion' module InteractiveRspec class << self attr_accessor :rspec_mode end end require 'interactive_rspec/monkey/irb' require 'interactive_rspec/monkey/rspec' module InteractiveRspec def self.start(options = {}) configu...
github
amatsuda/interactive_rspec
https://github.com/amatsuda/interactive_rspec
lib/interactive_rspec/monkey/rspec.rb
Ruby
mit
86
master
1,521
module RSpec module Matchers class OperatorMatcher def eval_match_with_reporting(actual, operator, expected) return eval_match_without_reporting(actual, operator, expected) unless InteractiveRspec.rspec_mode InteractiveRspec.report begin eval_match_without_reporting(actual, operat...
github
amatsuda/interactive_rspec
https://github.com/amatsuda/interactive_rspec
lib/interactive_rspec/monkey/irb.rb
Ruby
mit
86
master
1,034
module IRB def IRB.start_with_context(context = nil) IRB.setup nil if @CONF[:SCRIPT] irb = Irb.new(nil, @CONF[:SCRIPT]) else irb = Irb.new WorkSpace.new(TOPLEVEL_BINDING, context) end @CONF[:IRB_RC].call(irb.context) if @CONF[:IRB_RC] @CONF[:MAIN_CONTEXT] = irb.context trap(...
github
Envek/sidekiq-fair_tenant
https://github.com/Envek/sidekiq-fair_tenant
Gemfile
Ruby
mit
86
master
933
# frozen_string_literal: true source "https://rubygems.org" gemspec # rubocop:disable Bundler/DuplicatedGem sidekiq_version = ENV.fetch("SIDEKIQ_VERSION", "~> 7.2") case sidekiq_version when "HEAD" gem "sidekiq", git: "https://github.com/sidekiq/sidekiq.git" else sidekiq_version = "~> #{sidekiq_version}.0" if si...
github
Envek/sidekiq-fair_tenant
https://github.com/Envek/sidekiq-fair_tenant
sidekiq-fair_tenant.gemspec
Ruby
mit
86
master
1,486
# frozen_string_literal: true require_relative "lib/sidekiq/fair_tenant/version" Gem::Specification.new do |spec| spec.name = "sidekiq-fair_tenant" spec.version = Sidekiq::FairTenant::VERSION spec.authors = ["Andrey Novikov"] spec.email = ["envek@envek.name"] spec.summary = "Throttle Sidekiq jobs of greedy...
github
Envek/sidekiq-fair_tenant
https://github.com/Envek/sidekiq-fair_tenant
spec/spec_helper.rb
Ruby
mit
86
master
1,237
# frozen_string_literal: true require "bundler/setup" require "active_job" require "active_job/queue_adapters/sidekiq_adapter" require "active_support/core_ext/numeric/time" require "active_support/testing/time_helpers" require "sidekiq/testing" require "rspec-sidekiq" require "sidekiq/fair_tenant" require_relative ...
github
Envek/sidekiq-fair_tenant
https://github.com/Envek/sidekiq-fair_tenant
spec/support/jobs.rb
Ruby
mit
86
master
938
# frozen_string_literal: true class SamplePlainJob include Sidekiq::Worker def perform(*_args) "My job is simple" end end class SampleThrottledJob include Sidekiq::Worker sidekiq_options queue: :whatever, fair_tenant_queues: [ { queue: :whatever_semislow, threshol...
github
Envek/sidekiq-fair_tenant
https://github.com/Envek/sidekiq-fair_tenant
spec/sidekiq/fair_tenant_spec.rb
Ruby
mit
86
master
3,739
# frozen_string_literal: true RSpec.describe Sidekiq::FairTenant do context "when throttling is not set up" do it "enqueues job to default job" do expect { SamplePlainJob.perform_async }.to enqueue_sidekiq_job.on("default") end end context "when throttling is set up" do subject(:enqueuer) { ->...
github
Envek/sidekiq-fair_tenant
https://github.com/Envek/sidekiq-fair_tenant
lib/sidekiq/fair_tenant.rb
Ruby
mit
86
master
807
# frozen_string_literal: true require "sidekiq" require_relative "fair_tenant/version" require_relative "fair_tenant/config" require_relative "fair_tenant/client_middleware" module Sidekiq # Client middleware and job DSL for throttling jobs of overly active tenants module FairTenant class Error < ::StandardE...
github
Envek/sidekiq-fair_tenant
https://github.com/Envek/sidekiq-fair_tenant
lib/sidekiq/fair_tenant/config.rb
Ruby
mit
86
master
662
# frozen_string_literal: true require "anyway" module Sidekiq module FairTenant # Runtime configuration for the sidekiq-fair_tenant gem class Config < ::Anyway::Config config_name :sidekiq_fair_tenant # Maximum amount of time to store information about tenant enqueues attr_config max_thro...
github
Envek/sidekiq-fair_tenant
https://github.com/Envek/sidekiq-fair_tenant
lib/sidekiq/fair_tenant/client_middleware.rb
Ruby
mit
86
master
3,700
# frozen_string_literal: true module Sidekiq module FairTenant # Client middleware re-routing jobs of overly active tenants to slower queues based on thresholds class ClientMiddleware # Re-routes job to the most appropriate queue, based on tenant's throttling rules # rubocop:disable Metrics/Metho...
github
olegantonyan/typerb
https://github.com/olegantonyan/typerb
typerb.gemspec
Ruby
mit
86
master
1,432
# frozen_string_literal: true lib = File.expand_path('lib', __dir__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'typerb/version' Gem::Specification.new do |spec| spec.name = 'typerb' spec.version = Typerb::VERSION spec.authors = ['Oleg Antonyan'] spec.email = ...
github
olegantonyan/typerb
https://github.com/olegantonyan/typerb
Guardfile
Ruby
mit
86
master
1,174
# A sample Guardfile # More info at https://github.com/guard/guard#readme ## Uncomment and set this to only include directories you want to watch # directories %w(app lib config test spec features) \ # .select{|d| Dir.exists?(d) ? d : UI.warning("Directory #{d} does not exist")} ## Note: if you are using the `direct...
github
olegantonyan/typerb
https://github.com/olegantonyan/typerb
lib/typerb.rb
Ruby
mit
86
master
3,263
# frozen_string_literal: true require 'typerb/version' require 'typerb/variable_name' require 'typerb/exceptional' module Typerb refine BasicObject do def type!(*klasses) raise ArgumentError, 'provide at least one class' if klasses.empty? return self if klasses.any? { |kls| is_a?(kls) } klass...
github
olegantonyan/typerb
https://github.com/olegantonyan/typerb
lib/typerb/variable_name.rb
Ruby
mit
86
master
856
# frozen_string_literal: true module Typerb class VariableName attr_reader :file, :line def initialize(caller_loc) @file = caller_loc[0].path @line = caller_loc[0].lineno end def get return unless defined?(RubyVM::AbstractSyntaxTree) return unless File.exist?(file) ca...
github
olegantonyan/typerb
https://github.com/olegantonyan/typerb
lib/typerb/exceptional.rb
Ruby
mit
86
master
674
# frozen_string_literal: true module Typerb class Exceptional # NOTE: don't want to collide with 'Exception' class name class << self def klasses_text(klasses) klasses.size > 1 ? klasses.map(&:name).join(' or ') : klasses.first.name end def methods_text(methods) methods.join(',...
github
olegantonyan/typerb
https://github.com/olegantonyan/typerb
spec/spec_helper.rb
Ruby
mit
86
master
423
# frozen_string_literal: true require 'bundler/setup' require 'typerb' require 'super_awesome_print' RSpec.configure do |config| # Enable flags like --only-failures and --next-failure config.example_status_persistence_file_path = '.rspec_status' # Disable RSpec exposing methods globally on `Module` and `main` ...
github
olegantonyan/typerb
https://github.com/olegantonyan/typerb
spec/typerb_spec.rb
Ruby
mit
86
master
8,395
# frozen_string_literal: true RSpec.describe Typerb do # rubocop: disable Metrics/BlockLength it 'has a version number' do expect(Typerb::VERSION).not_to be nil end it 'does not work without refinement' do kls = Class.new do def initialize(arg) arg.type!(Integer) @arg = arg e...
github
francois2metz/em-eventsource
https://github.com/francois2metz/em-eventsource
em-eventsource.gemspec
Ruby
mit
86
master
1,149
# encoding: utf-8 Gem::Specification.new do |s| s.name = "em-eventsource" s.version = "0.3.2" s.licenses = ["MIT"] s.date = Time.now.utc.strftime("%Y-%m-%d") s.homepage = "https://github.com/francois2metz/em-eventsource" s.authors = "François de Met...
github
francois2metz/em-eventsource
https://github.com/francois2metz/em-eventsource
examples/flowdock.rb
Ruby
mit
86
master
483
# https://flowdock.com/ token = "" # token = your Flowdock access token organization = "" # organization = Flowdock subdomain flow = "" # flow = name of flow in URL $: << 'lib' << '../lib' require 'em-eventsource' EM.run do source = EM::EventSource.new("https://#{token}:@stream.flowdock.com/flows/#{organization}...
github
francois2metz/em-eventsource
https://github.com/francois2metz/em-eventsource
examples/simple.rb
Ruby
mit
86
master
292
$: << 'lib' << '../lib' require 'em-eventsource' EM.run do source = EM::EventSource.new("http://googlecodesamples.com/html5/sse/sse.php") source.message do |message| puts "new message #{message}" end source.error do |error| puts "error #{error}" end source.start end
github
francois2metz/em-eventsource
https://github.com/francois2metz/em-eventsource
spec/spec_helper.rb
Ruby
mit
86
master
1,328
require "em-eventsource" module EventMachine class MockHttpRequest attr_reader :url, :get_args, :middlewares, :opts, :response_header, :closed def initialize(url, opts={}) @url = url @streams = [] @errors = [] @callbacks = [] @headers = [] @middlewares = [] @opts = ...
github
francois2metz/em-eventsource
https://github.com/francois2metz/em-eventsource
spec/em-eventsource_spec.rb
Ruby
mit
86
master
11,130
#!/usr/bin/env ruby # encoding: utf-8 require File.expand_path(File.dirname(__FILE__) + '/spec_helper') require "minitest/autorun" require "minitest-spec-context" describe EventMachine::EventSource do def start_source(url="http://example.com/streaming", query={}, headers={}) EM.run do source = EventMachi...
github
francois2metz/em-eventsource
https://github.com/francois2metz/em-eventsource
lib/em-eventsource.rb
Ruby
mit
86
master
5,346
# encoding: utf-8 require "eventmachine" require "em-http-request" module EventMachine # EventSource # dev.w3.org/html5/eventsource/ class EventSource # Get API url attr_reader :url # Get ready state attr_reader :ready_state # Get current retry value (in seconds) attr_reader :retry #...
github
CarolHsu/rumors-api-client
https://github.com/CarolHsu/rumors-api-client
rumors-api-client.gemspec
Ruby
mit
86
master
1,270
lib = File.expand_path("../lib", __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require "rumors/api/client/version" Gem::Specification.new do |spec| spec.name = "rumors-api-client" spec.version = Rumors::Api::Client::VERSION spec.authors = ["Carol H"] spec.email ...
github
CarolHsu/rumors-api-client
https://github.com/CarolHsu/rumors-api-client
spec/spec_helper.rb
Ruby
mit
86
master
540
require "bundler/setup" require "vcr" require "webmock" require "pry" require "rumors/api/client" RSpec.configure do |config| # Enable flags like --only-failures and --next-failure config.example_status_persistence_file_path = ".rspec_status" # Disable RSpec exposing methods globally on `Module` and `main` co...
github
CarolHsu/rumors-api-client
https://github.com/CarolHsu/rumors-api-client
spec/rumors/api/client_spec.rb
Ruby
mit
86
master
2,208
RSpec.describe Rumors::Api::Client do let(:rumor) do <<-RUMOR (jk)我是JK郭,約三年前看到(全天一直喝40度C以上,不超過50 度C熱開水)即能不患癌的文章後,從此堅持下去,因為我相信。 (red arrow right)這兩三年來發覺自己更健康了,因此這二年多來也不斷對周邊的長輩、親友、學生傳達這個理念和訊息。 (red arrow right)今天又收到一位宗兄傳來完全相同的訊息,決定將此人類無價之寶(健康寶典)寄給我所有的長輩、親友、師長、學生們⋯⋯,請大家一定要看完,多看幾次,也一定要效法做到,堅持從此不再飲食恆...
github
CarolHsu/rumors-api-client
https://github.com/CarolHsu/rumors-api-client
spec/rumors/api/client/base_spec.rb
Ruby
mit
86
master
4,742
RSpec.describe Rumors::Api::Client::Base do let(:text) { "2018" } subject { Rumors::Api::Client::Base.new(text) } describe '#search' do let(:rumor) do <<-RUMOR (jk)我是JK郭,約三年前看到(全天一直喝40度C以上,不超過50 度C熱開水)即能不患癌的文章後,從此堅持下去,因為我相信。 (red arrow right)這兩三年來發覺自己更健康了,因此這二年多來也不斷對周邊的長輩、親友、學生傳達這個理念和訊息。 ...
github
CarolHsu/rumors-api-client
https://github.com/CarolHsu/rumors-api-client
spec/rumors/api/client/utils/list_articles_spec.rb
Ruby
mit
86
master
688
RSpec.describe Rumors::Api::Client::Utils::ListArticles do let(:text) { "2018" } subject { Rumors::Api::Client::Utils::ListArticles.new(text) } describe '.gql_query' do it 'should build expected query string' do gql_query_string = subject.purify_gql_query expect(gql_query_string).to match(/ListAr...
github
CarolHsu/rumors-api-client
https://github.com/CarolHsu/rumors-api-client
lib/rumors/api/client.rb
Ruby
mit
86
master
379
# frozen_string_literal: true require "matrix" require "tf-idf-similarity" require "httparty" require "json" require "rumors/api/client/version" require "rumors/api/client/base" require "rumors/api/client/utils/list_articles" module Rumors module Api module Client def self.search(text) Rumors::Api:...
github
CarolHsu/rumors-api-client
https://github.com/CarolHsu/rumors-api-client
lib/rumors/api/client/base.rb
Ruby
mit
86
master
4,384
module Rumors module Api module Client class Base DATA_HOST = "https://cofacts-api.g0v.tw/graphql?" SIMILARITY = 0.8 def initialize(text) @text = text.strip @urls = URI.extract(@text).map { |url| URI.parse(URI.escape(url)) } end def search ...
github
CarolHsu/rumors-api-client
https://github.com/CarolHsu/rumors-api-client
lib/rumors/api/client/utils/list_articles.rb
Ruby
mit
86
master
1,126
module Rumors module Api module Client module Utils class ListArticles def initialize(text) @text = text end def purify_gql_query gql_query.strip end def variables { text: @text.to_s } end pr...
github
citizensadvice/capybara_accessible_selectors
https://github.com/citizensadvice/capybara_accessible_selectors
capybara_accessible_selectors.gemspec
Ruby
isc
86
main
528
# frozen_string_literal: true $LOAD_PATH << File.expand_path("lib", __dir__) require "capybara_accessible_selectors/version" Gem::Specification.new do |s| s.name = "capybara_accessible_selectors" s.summary = "Additional selectors for capybara" s.version = CapybaraAccessibleSelectors::VERSION s.files = Dir["li...
github
citizensadvice/capybara_accessible_selectors
https://github.com/citizensadvice/capybara_accessible_selectors
Gemfile
Ruby
isc
86
main
336
# frozen_string_literal: true source "https://rubygems.org" group :test, :development do gem "citizens-advice-style", git: "https://github.com/citizensadvice/citizens-advice-style-ruby", tag: "v12.1.0" gem "debug" gem "puma" gem "rack-test" gem "rackup" gem "rspec" gem "selenium-webdriver" gem "sinatr...
github
citizensadvice/capybara_accessible_selectors
https://github.com/citizensadvice/capybara_accessible_selectors
spec/spec_helper.rb
Ruby
isc
86
main
4,075
# frozen_string_literal: true ENV["APP_ENV"] = "test" Warning[:deprecated] = true Warning[:performance] = true if RUBY_VERSION >= "3.3.0" require "debug" require "capybara/rspec" require "selenium-webdriver" require "capybara_accessible_selectors" require "sinatra" # Suppress gecko driver warnings # https://github....
github
citizensadvice/capybara_accessible_selectors
https://github.com/citizensadvice/capybara_accessible_selectors
spec/selectors/columnheader_spec.rb
Ruby
isc
86
main
1,468
# frozen_string_literal: true describe "columnheader" do before do visit "/grid.html" end describe "locator" do it "finds columnheaders without a locator" do expect(page).to have_selector :columnheader, count: 6 end context "when the [role=grid] is a table" do it "finds a columnhead...
github
citizensadvice/capybara_accessible_selectors
https://github.com/citizensadvice/capybara_accessible_selectors
spec/selectors/item_type_spec.rb
Ruby
isc
86
main
536
# frozen_string_literal: true describe "item_type" do before { visit "/microdata.html" } it "selects a type" do expect(page).to have_selector :item_type, "building", text: "Forth bridge" end it "does not select a missing type" do expect do expect(page).to have_selector :item_type, "build", text...
github
citizensadvice/capybara_accessible_selectors
https://github.com/citizensadvice/capybara_accessible_selectors
spec/selectors/image_spec.rb
Ruby
isc
86
main
2,637
# frozen_string_literal: true describe "image selector" do it "finds an img" do render <<~HTML <img alt="alt" src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==" width="10" height="10" data-test-id="test"> HTML expect(find(:image)).to eq find(:test_id, "test") end ...
github
citizensadvice/capybara_accessible_selectors
https://github.com/citizensadvice/capybara_accessible_selectors
spec/selectors/contentinfo_spec.rb
Ruby
isc
86
main
7,179
# frozen_string_literal: true describe "contentinfo selector" do describe "locator" do context "when <footer> element" do it "finds the first element" do render <<~HTML <footer data-test-id="test">Content</footer> <div>Content</div> HTML expect(page.find(:conten...
github
citizensadvice/capybara_accessible_selectors
https://github.com/citizensadvice/capybara_accessible_selectors
spec/selectors/grid_spec.rb
Ruby
isc
86
main
532
# frozen_string_literal: true describe "grid" do before do visit "/grid.html" end describe "locator" do it "finds grids without a locator" do expect(page).to have_selector :grid, count: 3 end it "finds a div based grid by name" do grid = find(id: "grid-div") expect(find(:grid...
github
citizensadvice/capybara_accessible_selectors
https://github.com/citizensadvice/capybara_accessible_selectors
spec/selectors/menu_spec.rb
Ruby
isc
86
main
2,640
# frozen_string_literal: true describe "menu selector", skip_driver: :safari do # Safari has a weird bug with the menu role resolution being intermittent before do visit "/menu.html" end describe "locator" do it "finds menus without a locator" do expect(page).to have_selector :menu, count: 4 ...
github
citizensadvice/capybara_accessible_selectors
https://github.com/citizensadvice/capybara_accessible_selectors
spec/selectors/heading_spec.rb
Ruby
isc
86
main
3,573
# frozen_string_literal: true describe "heading selector" do it "finds an aria heading with no locator" do render <<~HTML <div role="heading">Heading</div> HTML expect(page).to have_heading end it "does not find an absence of an aria heading with no locator" do render <<~HTML <div r...
github
citizensadvice/capybara_accessible_selectors
https://github.com/citizensadvice/capybara_accessible_selectors
spec/selectors/modal_spec.rb
Ruby
isc
86
main
1,825
# frozen_string_literal: true describe "modal selector", skip_driver: :rack_test do before do visit "/dialog.html" end it "does not find a non-native dialog without aria-modal" do expect(page).to have_no_selector :modal, "Missing aria modal" end it "finds a non-native dialog with aria-modal" do ...
github
citizensadvice/capybara_accessible_selectors
https://github.com/citizensadvice/capybara_accessible_selectors
spec/selectors/rich_text_spec.rb
Ruby
isc
86
main
8,542
# frozen_string_literal: true describe "rich text", skip_driver: :rack_test do before { visit "/rich_text.html" } context "when inline" do context "with aria-label" do it "finds a rich text area" do rich_text = page.find_by_id("rt-aria-label") expect(page.find(:rich_text, "with label"))....
github
citizensadvice/capybara_accessible_selectors
https://github.com/citizensadvice/capybara_accessible_selectors
spec/selectors/dialog_spec.rb
Ruby
isc
86
main
6,127
# frozen_string_literal: true describe "dialog selector", skip_driver: :rack_test do before do visit "/dialog.html" end it "matches a dialog" do modal = find(:element, :div, text: "Dialog content") expect(modal).to match_selector :dialog end it "finds based on part accessible name" do modal...
github
citizensadvice/capybara_accessible_selectors
https://github.com/citizensadvice/capybara_accessible_selectors
spec/selectors/tab_spec.rb
Ruby
isc
86
main
3,910
# frozen_string_literal: true describe "tab selector", skip_driver: :rack_test do before do visit "/tab.html" end describe "tabpanel selector" do it "finds an open tabpanel" do tabpanel = find(:element, :div, text: "Panel one") expect(find(:tab_panel, "One")).to eq tabpanel end it "...
github
citizensadvice/capybara_accessible_selectors
https://github.com/citizensadvice/capybara_accessible_selectors
spec/selectors/navigation_spec.rb
Ruby
isc
86
main
2,706
# frozen_string_literal: true describe "navigation selector" do describe "locator" do context "when <nav> element" do it "finds the first element" do render <<~HTML <nav>Content</nav> HTML expect(page).to have_selector :navigation, count: 1 end it "finds base...
github
citizensadvice/capybara_accessible_selectors
https://github.com/citizensadvice/capybara_accessible_selectors
spec/selectors/row_spec.rb
Ruby
isc
86
main
1,348
# frozen_string_literal: true describe "row" do before do visit "/grid.html" end describe "locator" do it "finds rows without a locator" do expect(page).to have_selector :row, count: 6 end context "when the [role=grid] is a table" do it "finds a row by exact text" do expect(...
github
citizensadvice/capybara_accessible_selectors
https://github.com/citizensadvice/capybara_accessible_selectors
spec/selectors/main_spec.rb
Ruby
isc
86
main
2,535
# frozen_string_literal: true describe "main selector" do describe "locator" do context "when <main> element" do it "finds the first element" do render <<~HTML <main>Content</main> HTML expect(page).to have_selector :main, count: 1 end it "finds based on [ari...
github
citizensadvice/capybara_accessible_selectors
https://github.com/citizensadvice/capybara_accessible_selectors
spec/selectors/disclosure_spec.rb
Ruby
isc
86
main
21,894
# frozen_string_literal: true describe "Disclosure", skip_driver: :rack_test do before { visit "/disclosure.html" } context "with Details/Summary" do it "selects a details" do details = page.find(:element, :details, text: "Summary button") expect(page.find(:disclosure, "Summary button")).to eq det...
github
citizensadvice/capybara_accessible_selectors
https://github.com/citizensadvice/capybara_accessible_selectors
spec/selectors/section_spec.rb
Ruby
isc
86
main
4,117
# frozen_string_literal: true describe "section selector" do before do visit "/section.html" end it "finds a section by heading" do render <<~HTML <section> <h1>Heading</h1> </section> HTML section = find :element, :section expect(find(:section, "Heading")).to eq section ...