Retry a command until it fails.
Debugging brittle specs is annoying and time consuming work. Let's automate finding those brittle specs by retrying them until they fail.
Accompanying blog post.
require 'concurrent/array' | |
Capybara::Session.prepend(Spec::Support::Capybara::Console) | |
module Spec | |
module Support | |
module Capybara | |
module Console | |
def driver | |
@driver ||= super.tap { console.register } |
Retry a command until it fails.
Debugging brittle specs is annoying and time consuming work. Let's automate finding those brittle specs by retrying them until they fail.
Accompanying blog post.
# /spec/support/documentation/after_rspec_example.rb | |
# Normally, we'd want to break into multiple files, but then it becomes more to install (unless gemified) | |
module SomeApp | |
module Documentation | |
class AfterRspecExample | |
def self.apply!(context, example, response) | |
SwaggerExample::Request.apply!(context, example, response) | |
SwaggerExample::Response.apply!(context, example, response) | |
end |
ruby '2.7.1' | |
gem 'rails', github: 'rails/rails' | |
gem 'tzinfo-data', '>= 1.2016.7' # Don't rely on OSX/Linux timezone data | |
# Action Text | |
gem 'actiontext', github: 'basecamp/actiontext', ref: 'okra' | |
gem 'okra', github: 'basecamp/okra' | |
# Drivers |
Sometimes it's useful to know what IP ranges our servers are operating in. Since we run on Heroku, it's a little complicated. However, Heroku runs on AWS, which has this page dedicated to IP Ranges by Region.
Heroku recommends using this to identify which region are bing in use. If dynos are run in common spaces in US region, we can look up information about this region using Heroku's API:
using httpie:
http https://api.heroku.com/regions/us "Accept:application/vnd.heroku+json; version=3"
begin | |
require 'bundler/inline' | |
rescue LoadError => e | |
$stderr.puts 'Bundler version 1.10 or later is required. Please update your Bundler' | |
raise e | |
end | |
gemfile(true) do | |
source 'https://rubygems.org' | |
# gem 'rails', '~> 5.2' |
version: 2.1 | |
orbs: | |
heroku: circleci/[email protected] | |
references: | |
container_setup: &container_setup | |
docker: # run the steps with Docker | |
- image: circleci/ruby:2.6.0-rc1-node # ...with this image as the primary container; this is where all `steps` will run | |
environment: # environment variables for primary container |
initialize
: once, when the controller is first instantiatedconnect
: anytime the controller is connected to the DOM/* | |
This script is meant to be used with a Google Sheets spreadsheet. When you edit a cell containing a | |
valid CSS hexadecimal colour code (like #000 or #000000), the background colour will be changed to | |
that colour and the font colour will be changed to the inverse colour for readability. | |
To use this script in a Google Sheets spreadsheet: | |
1. go to Tools » Script Editor » Spreadsheet; | |
2. erase everything in the text editor; | |
3. change the title to "Set colour preview on edit"; |