#rails #minitest #testing
Add to test/test_helper.rb
def with_cache
@original_cache_store = Rails.cache
Rails.cache = ActiveSupport::Cache::MemoryStore.new
yield
ensure
Rails.cache = @original_cache_store| inherit_gem: | |
| rubocop-rails-omakase: rubocop.yml | |
| require: | |
| - rubocop-performance | |
| - rubocop-rails | |
| AllCops: | |
| NewCops: enable | |
| TargetRubyVersion: 3.3 |
| Since you can't update Stripe API version on a webhook, the only way to do it, is to disable one, and create a new one. |
#rails #minitest #testing
Add to test/test_helper.rb
def with_cache
@original_cache_store = Rails.cache
Rails.cache = ActiveSupport::Cache::MemoryStore.new
yield
ensure
Rails.cache = @original_cache_store#rails #actionmailer #callbacks
Callbacks for mailers are implemented using AbstractController::Callbacks.
This has a terminator lambda: https://github.com/rails/rails/blob/6af9cba73db6296ab9aec7dbeae1e193ea69f09f/actionpack/lib/abstract_controller/callbacks.rb#L34
AbstractController::Base defines performed? as: return response_body https://github.com/rails/rails/blob/6af9cba73db6296ab9aec7dbeae1e193ea69f09f/actionpack/lib/abstract_controller/base.rb#L188
So - as soon as we set any response body, no other callbacks or actions will occur.
| javascript: Promise.all([ | |
| import("https://unpkg.com/[email protected]?module"), | |
| import("https://unpkg.com/@tehshrike/[email protected]"), | |
| ]).then(([{ default: Turndown }, { default: Readability }]) => { | |
| const vault = ""; | |
| const folder = "quick"; | |
| const tags = "#clippings"; | |
| function getSelectionHtml() { | |
| var html = ""; |
| loop do | |
| puts "Gimme photo\n" | |
| path = gets | |
| exifdata = value = `exiftool -c "%+.10f" #{path} ` | |
| line = exifdata.split("\n").find{|l| l.include?("GPS Position")} | |
| if line.nil? | |
| puts exifdata | |
| puts "\nNO GPS 🤷♂️" | |
| else |
| require 'benchmark/ips' | |
| Benchmark.ips do |x| | |
| records = [] | |
| 10_000.times do |i| | |
| records << "#{['abc', 'rec', 'air'].sample}-#{i}-#{['abc', 'rec', 'air'].sample}-#{i}" | |
| end | |
| AIRTABLE_ID_REGEX = /rec(?!_)/.freeze |
| .DS_Store |
| # frozen_string_literal: true | |
| source 'https://rubygems.org' | |
| gem 'sinatra' | |
| gem 'twentysix' |