I hereby claim:
- I am palkan on github.
- I am palkan (https://keybase.io/palkan) on keybase.
- I have a public key ASD9_7Qr5xvMYx75u8VApLRsuCjYGR87WquHVLTtuUahwAo
To claim this, I am signing this object:
module ActiveRecord | |
# Share connection between threads to make it possible to wrap system tests in a transaction. | |
# Also synchonize queries to avoid concurrent writes/reads. | |
# | |
# For PostgreSQL adapter. | |
module OneLove | |
class << self | |
attr_reader :connection | |
def connection=(conn) |
module RSpec | |
class EventProfiler # :nodoc: | |
# Add #duration method to floats | |
module FloatDuration | |
refine Float do | |
def duration | |
t = self | |
format("%02d:%02d.%03d", t / 60, t % 60, t.modulo(1) * 1000) | |
end | |
end |
module FactoryDefault | |
module CreateDefaultMethod | |
def create_default(name, *args, &block) | |
res = create(name, *args, &block) | |
FactoryDefault.register(name, res) | |
res | |
end | |
end | |
module RunnerExt |
module RSpecHell | |
def run_examples(reporter) | |
return super unless metadata[:hell] && !(metadata[:parent_example_group] && metadata[:parent_example_group].key?(:hell)) | |
pool_size = ENV['HELL'].to_i | |
q = Queue.new | |
ordering_strategy.order(descendant_filtered_examples).each { |ex| q << ex } | |
workers = [] | |
results = [] |
module StiUpdate | |
def as(type) | |
if self.type == type | |
self | |
else | |
klass = type.camelize.constantize | |
if klass.nil? | |
self | |
else | |
became = self.becomes!(klass) |
unless File.exist?('Gemfile') | |
File.write('Gemfile', <<-GEMFILE) | |
source 'https://rubygems.org' | |
gem 'rails', github: 'rails/rails' | |
gem 'arel', github: 'rails/arel' | |
gem 'sqlite3' | |
gem 'pry-byebug' | |
GEMFILE | |
system 'bundle' |
I hereby claim:
To claim this, I am signing this object:
class RackRewriteConfig | |
class << self | |
# Configure named rewrite rule | |
def configure(name, &block) | |
raise ArgumentError, "Block is required" unless block_given? | |
rules[name] = block | |
end | |
# Apply named rule to the target | |
def apply(target, name, *args) |
module AnyFixture | |
INSERT_RXP = /^INSERT INTO ([\S]+)/ | |
class Cache | |
attr_reader :store | |
delegate :clear, to: :store | |
def initialize | |
@store = {} |
From Pundit to ActionPolicy:
include Pundit
from ApplicationControlleralias authorize authorize!
authorize :current_user, as: :user
include ActionPolicy::Policy::Core
to ApplicationPolicy
ApplicationPolicy#initialize
:def initialize(target, user:)